Skip to content
This repository has been archived by the owner on Jan 10, 2025. It is now read-only.

RECVD_MSG_API 的接口持续收到异常请求 #140

Closed
4 tasks done
Tracked by #144
leinad59 opened this issue Jan 23, 2024 · 5 comments · Fixed by #144
Closed
4 tasks done
Tracked by #144

RECVD_MSG_API 的接口持续收到异常请求 #140

leinad59 opened this issue Jan 23, 2024 · 5 comments · Fixed by #144
Labels
enhancement New feature or request

Comments

@leinad59
Copy link
Contributor

提bug前先检查以下是否已经执行

  • 我已更新了最新版本的代码
  • 我已经仔细地阅读了readme 文档
  • 我已在FAQ里查找了可能寻找的答案
  • 我已经尝试搜索过历史关闭issue寻找可能的答案

bug描述

简短描述一下你在什么场景下遇到的问题

早上起来发现 RECVD_MSG_API 接入的 gpt token 都用完了,通过查看调用日志发现,从凌晨5点25开始间歇性地有大量请求。

提供有用的信息

提供任何代码片段/日志/输出/截图 以便于帮助快速定位问题

查看项目日志发现没有消息内容,只有 starting fetching API: xxxAssertionError: 3 == 0

image

由接口逻辑推断,消息的 typetext,否则不会走到调用 gpt 请求的逻辑:

image

日志中打印了 source 字段,内容为 {"room":"","to":"","from":""}

token 消耗记录显示,提示词的长度有两种,分别为 464 和 546:

image

根据 gpt 的调用日志,猜测消息的 content 为以下两种:

image image

理论上来说,这种消息不应该发送到 RECVD_MSG_API,我也没有正确做出过滤。请问应该如何避免这个问题再次出现?

@leinad59
Copy link
Contributor Author

image

期间没有其他异常,是到凌晨5:25突然出问题的(日志需要+8h到北京时间)

@danni-cool
Copy link
Owner

无他,掉线了,但是wechaty 一直没登出所以一直报错,临时处理可以判断payload.isSystemEvent === false && type=== 'text'

@danni-cool
Copy link
Owner

后期考虑优化该结构,去除 payload.isSystemEvent, 增加 type 类型 _systemEvent,以便与其他结构区分

@danni-cool danni-cool added bug Something isn't working enhancement New feature or request labels Jan 23, 2024
@leinad59
Copy link
Contributor Author

无他,掉线了,但是wechaty 一直没登出所以一直报错,临时处理可以判断payload.isSystemEvent === false && type=== 'text'

看这里的朋友,记得确认文档中 isSystemEvent 的值是字符串的 '0'/'1' 还是布尔值 false/true,现状是 '0'/'1'

@danni-cool
Copy link
Owner

嗯,以文档为准,我看的源码

@danni-cool danni-cool linked a pull request Jan 26, 2024 that will close this issue
16 tasks
@danni-cool danni-cool mentioned this issue Feb 4, 2024
16 tasks
@danni-cool danni-cool removed the bug Something isn't working label Feb 7, 2024
danni-cool added a commit that referenced this issue Mar 2, 2024
- [x] #165
暂时只用文本展示
  - [x] 代码提交 @Daydaylw3 
  - [x] 文档增加说明
- [x] #159
    - [x] 增加有条件开启是否转发自己消息
    - [x] 消息增加标识自己
    - [x] 设备上自己发送消息上报recvd-api
    - [x] 通过推消息api自己发送的消息上报recvd-api
- [x] #140
  - [x] 系统消息单独定义类型 
  - [x] 根据特定的错误标识,提前触发logout 事件,并且屏蔽上报请求
  - [x] 完善readme
- [x] #160
  - [x] 尝试根据wechaty的通用错误手动触发 logout 事件,并且登出当前账号
  - [x] 版本部署测试环境,观测掉线事件中
  - [x] 优化代码,确保登出事件只触发一次
danni-cool added a commit that referenced this issue Mar 2, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.6.1](v2.6.0...v2.6.1)
(2024-03-02)

### Feature

🎸 收消息API支持配置接受自己发的消,可配置开启close:#159
🎸 增加 收消息API 对 unKnown类型的 #165 
🎸 增加服务稳定性,针对web协议连续登录和登出场景优化,登出后报错至多上报一次 recvd_api, 登出消息通知更加及时。错误类型单独定义
#140, #160

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants