zhayujie / chatgpt-on-wechat

基于大模型搭建的聊天机器人,同时支持 微信公众号、企业微信应用、飞书、钉钉 等接入,可选择GPT3.5/GPT-4o/GPT-o1/ Claude/文心一言/讯飞星火/通义千问/ Gemini/GLM-4/Claude/Kimi/LinkAI,能处理文本、语音和图片,访问操作系统和互联网,支持基于自有知识库进行定制企业智能客服。
https://docs.link-ai.tech/cow
MIT License
31.2k stars 8.14k forks source link

项目运行一阵之后,就无法触发了,并且得等好一会才能重新连上 #2382

Open namas0312 opened 2 days ago

namas0312 commented 2 days ago

前置确认

⚠️ 搜索issues中是否已存在类似问题

操作系统类型?

Linux

运行的python版本是?

python 3.8

使用的chatgpt-on-wechat版本是?

Latest Release

运行的channel类型是?

wx(个人微信, itchat)

复现步骤 🕹

复现频繁,就是有可能前一秒还能正常触发ai,正常微信聊天,后一秒就没反应了

问题描述 😯

如同这个情况(https://github.com/zhayujie/chatgpt-on-wechat/issues/2323) 在发出本issue前,已经从github上更新了最新版, 症状是在通常情况下,运行python3 app.py,都能正常触发扫描,并且扫码后可以显示出user_id和nickname,之后就是Start auto replying. 正常使用

但是就会莫名其妙地类似于死机一样,终端窗口不滚动资讯,微信对话也没反应,类似于死机了,然后我的操作就是手机微信上最上方点退出电脑端,然后乌班图内这个终端窗口ctrl+c多次后终止进程,然后关了这个终端重新开一个 重复运行python3 app.py的操作,然后就会出现2个情况,一个就是扫码后可以显示出user_id和nickname,等于这个项目复活了,又可以正常使用一阵子了;但是多数情况是,扫码之后user_id和nickname是空的,尝试多次也是这样,如图,一般这种情况我就会玄学地改微信名字,改微信头像,手机微信退出登录重新登录等等的操作,反正要等好久之后 才能在乌班图扫码后,显示出user_id和nickname,然后才正常,确实不知道问题出在哪了

终端日志 📒

~/chatgpt-on-wechat$ python3 app.py [INFO][2024-11-14 14:38:57][config.py:299] - [INIT] load config: {'channel_type': 'wx', 'model': 'gpt-4o', 'open_ai_api_key': '****', 'claude_api_key': '****', 'text_to_image': 'dall-e-2', 'voice_to_text': 'openai', 'text_to_voice': 'openai', 'proxy': '', 'hot_reload': True, 'single_chat_prefix': [''], 'open_ai_api_base': 'https://api.chatanywhere.tech/v1', 'single_chat_reply_prefix': '[REPLY] ', 'group_chat_prefix': ['@bot'], 'group_name_white_list': ['ALL_GROUP'], 'image_create_prefix': ['画'], 'speech_recognition': True, 'group_speech_recognition': True, 'voice_reply_voice': False, 'conversation_max_tokens': 2500, 'expires_in_seconds': 3600, 'character_desc': '你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。', 'temperature': 0.7, 'subscribe_msg': '感谢您的关注!\n这里是AI智能助手,可以自由对话。\n支持语音对话。\n支持图片输入。\n支持图片输出,画字开头的消息将按要求创作图片。\n支持tool、角色扮演和文字冒险等丰富的插件。\n输入{trigger_prefix}#help 查看详细指令。', 'use_linkai': True, 'linkai_api_key': '****', 'linkai_app_code': '**'} [INFO][2024-11-14 14:33:24][config.py:223] - [Config] User datas loaded. /home/naroka/.local/lib/python3.10/site-packages/pydub/utils.py:170: RuntimeWarning: Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work warn("Couldn't find ffmpeg or avconv - defaulting to ffmpeg, but may not work", RuntimeWarning) [INFO][2024-11-14 14:33:24][plugin_manager.py:50] - Loading plugins config... [INFO][2024-11-14 14:33:24][plugin_manager.py:88] - Scaning plugins ... [INFO][2024-11-14 14:33:24][plugin_manager.py:41] - Plugin linkai_v0.1.0 registered, path=./plugins/linkai [INFO][2024-11-14 14:33:24][plugin_manager.py:41] - Plugin BDunit_v0.1 registered, path=./plugins/bdunit [INFO][2024-11-14 14:33:24][plugin_manager.py:41] - Plugin Apilot_v0.2 registered, path=./plugins/Apilot chatgpt-tool-hub version: 0.5.0 [INFO][2024-11-14 14:33:25][plugin_manager.py:41] - Plugin tool_v0.5 registered, path=./plugins/tool [INFO][2024-11-14 14:33:25][plugin_manager.py:41] - Plugin Role_v1.0 registered, path=./plugins/role [INFO][2024-11-14 14:33:25][plugin_manager.py:41] - Plugin Banwords_v1.0 registered, path=./plugins/banwords [INFO][2024-11-14 14:33:25][plugin_manager.py:41] - Plugin KFCwenan_v1.0 registered, path=./plugins/KFCwenan [INFO][2024-11-14 14:33:25][plugin_manager.py:41] - Plugin summaryV2_v0.0.2 registered, path=./plugins/plugin_summary 未安装ntchat: No module named 'channel.wechatnt' 未安装wework: No module named 'ntwork' 未安装ntchat: No module named 'channel.wechatnt' [INFO][2024-11-14 14:33:25][plugin_manager.py:41] - Plugin timetask_v2.8 registered, path=./plugins/timetask [INFO][2024-11-14 14:33:25][plugin_manager.py:41] - Plugin TicketQuery_v1.0 registered, path=./plugins/HighSpeedTicket [INFO][2024-11-14 14:33:25][plugin_manager.py:41] - Plugin Keyword_v0.1 registered, path=./plugins/keyword [INFO][2024-11-14 14:33:25][plugin_manager.py:41] - Plugin Finish_v1.0 registered, path=./plugins/finish [INFO][2024-11-14 14:33:25][plugin_manager.py:41] - Plugin Godcmd_v1.0 registered, path=./plugins/godcmd [INFO][2024-11-14 14:33:25][plugin_manager.py:41] - Plugin Dungeon_v1.0 registered, path=./plugins/dungeon [INFO][2024-11-14 14:33:25][plugin_manager.py:41] - Plugin Hello_v0.1 registered, path=./plugins/hello [INFO][2024-11-14 14:33:25][plugin_manager.py:80] - load all config from plugins/config.json: {'godcmd': {'password': '0312', 'admin_users': []}, 'banwords': {'action': 'replace', 'reply_filter': True, 'reply_action': 'ignore'}, 'tool': {'tools': ['python', 'url-get', 'terminal', 'meteo-weather'], 'kwargs': {'top_k_results': 2, 'no_default': False, 'model_name': 'gpt-3.5-turbo'}}, 'linkai': {'group_app_map': {'测试群1': 'default', '测试群2': 'Kv2fXJcH'}, 'midjourney': {'enabled': True, 'auto_translate': True, 'img_proxy': True, 'max_tasks': 3, 'max_tasks_per_user': 1, 'use_image_create_prefix': True}, 'summary': {'enabled': True, 'group_enabled': True, 'max_file_size': 5000, 'type': ['FILE', 'SHARING']}}} [ERROR][2024-11-14 14:33:25][plugin_manager.py:182] - Plugin sum4all not found, but found in plugins.json [ERROR][2024-11-14 14:33:25][plugin_manager.py:182] - Plugin summary not found, but found in plugins.json [INFO][2024-11-14 14:33:25][godcmd.py:210] - [Godcmd] inited [timetask] inited [INFO][2024-11-14 14:33:25][keyword.py:40] - [keyword] {} [INFO][2024-11-14 14:33:25][keyword.py:42] - [keyword] inited. [INFO][2024-11-14 14:33:25][HighSpeedTicket.py:32] - [TicketQuery] inited [INFO][2024-11-14 14:33:25][KFCwenan.py:21] - [KFCwenan] inited [INFO][2024-11-14 14:33:25][linkai.py:35] - [LinkAI] inited, config={'group_app_map': {'测试群1': 'default', '测试群2': 'Kv2fXJcH'}, 'midjourney': {'enabled': True, 'auto_translate': True, 'img_proxy': True, 'max_tasks': 3, 'max_tasks_per_user': 1, 'use_image_create_prefix': True}, 'summary': {'enabled': True, 'group_enabled': True, 'max_file_size': 5000, 'type': ['FILE', 'SHARING']}} [INFO][2024-11-14 14:33:25][Apilot.py:35] - [Apilot] inited and alapi_token loaded successfully [WARNING][2024-11-14 14:33:26][tool.py:236] - [tool] filter invalid tool: 'meteo-weather' [INFO][2024-11-14 14:33:26][tool.py:29] - [tool] inited [INFO][2024-11-14 14:33:26][role.py:69] - [Role] inited [INFO][2024-11-14 14:33:26][dungeon.py:56] - [Dungeon] inited [INFO][2024-11-14 14:33:26][main.py:70] - [summary] inited, config={'rate_limit_summary': 30, 'save_time': 1440} [ERROR][2024-11-14 14:33:26][db.py:69] - parameters are of unsupported type [INFO][2024-11-14 14:33:26][main.py:109] - Scheduler started. Cleaning old records every day at midnight. [INFO][2024-11-14 14:33:26][main.py:81] - [Summary] inited [INFO][2024-11-14 14:33:26][hello.py:38] - [Hello] inited [INFO][2024-11-14 14:33:26][finish.py:23] - [Finish] inited [INFO][2024-11-14 14:33:26][client.py:258] - Client no need connect, ignore Hot reload failed, logging in normally, error={'BaseResponse': {'ErrMsg': '服务器拒绝连接', 'Ret': -1003, 'RawMsg': 'server refused, loading login status failed.'}} ERROR:itchat:Hot reload failed, logging in normally, error={'BaseResponse': {'ErrMsg': '服务器拒绝连接', 'Ret': -1003, 'RawMsg': 'server refused, loading login status failed.'}} Ready to login. INFO:itchat:Ready to login. Getting uuid of QR code. INFO:itchat:Getting uuid of QR code. Downloading QR code. INFO:itchat:Downloading QR code. You can also scan QRCode in any website below: https://api.pwmqr.com/qrcode/create/?url=https://login.weixin.qq.com/l/IeEV0SAcmQ== https://my.tv.sohu.com/user/a/wvideo/getQRCode.do?text=https://login.weixin.qq.com/l/IeEV0SAcmQ== https://api.qrserver.com/v1/create-qr-code/?size=400×400&data=https://login.weixin.qq.com/l/IeEV0SAcmQ== https://api.isoyu.com/qr/?m=1&e=L&p=20&url=https://login.weixin.qq.com/l/IeEV0SAcmQ== █▀▀▀▀▀▀▀██▀█▀█▀▀▀█▀████▀▀▀▀▀▀▀█ █ █▀▀▀█ █ ▀██▄█▀█▄█▄█▄█ █▀▀▀█ █ █ █   █ █▄▄  ▀▄█▀▀  ▀▀█ █   █ █ █ ▀▀▀▀▀ █▀▄▀▄ ▄▀█▀▄▀█▀█ ▀▀▀▀▀ █ █▀█████▀█ ██▄█▀ ▀▀▀▄ ▄▀▀██▀▀▀██ █ ▄▀▄ █▀ ▄ █ ▄▄  ▄▀ ▄▄█▀  █▄▄██ █▀▀█▄█ ▀▄█▄▀█▀▀▄ ▄██▄ ▀ ▀█▄██▀█ █▄█▀ █ ▀██▀▀▄▄█▄▀  ▄▄ █  ▄▀▀▄▄█ █▄ █▄▀ ▀▄▄ ▄█ ▀█▀█▀█▀▄██▄▄▀ █▄█ █   ▄ █▀▀██ ▄  ▄▀▄ ▄  ▄ ▄▄▀▄▄ █ █ █  ▄ ▀▄▄ ▄▀█▀▄▀▄▀▀▀▀   ▀█▀▀▀█ █▀▀▀▀▀▀▀█▄▄██▄▄▀ ▀ ▄  █▀█  ▀███ █ █▀▀▀█ ██▀█▀▀▀ █▀██  ▀▀▀ ▀█▀▄█ █ █   █ ███  █ ▀▀ ▄▄▄▀ ▀▀▀  ▀▄█ █ ▀▀▀▀▀ █▀▄█▄ █▄▄█▀ ▀█▄▄▀▄▄ █▄█ ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀ timeTask文件已存在, 无需创建 Please press confirm on your phone. INFO:itchat:Please press confirm on your phone. Loading the contact, this may take a little while. INFO:itchat:Loading the contact, this may take a little while. [INFO][2024-11-14 14:33:42][wechat_channel.py:134] - Wechat login success, user_id: , nickname: Start auto replying. INFO:itchat:Start auto replying.

namas0312 commented 2 days ago

以下log为打断瞬间前后的代码: 如代码所示在中午2024-11-14 11:42:32最后一条消息刷新之后,便卡主了 2024-11-14 14:04:50是本人操作退出重启,然后就遇到了,nickname和user_id空白的问题

[INFO][2024-11-14 11:07:08][wechat_channel.py:55] - Wechat message 73558898243094568 already received, ignore [INFO][2024-11-14 11:07:08][wechat_channel.py:55] - Wechat message 73558898243094568 already received, ignore [INFO][2024-11-14 11:07:26][wechat_channel.py:55] - Wechat message 4711678064238843899 already received, ignore [INFO][2024-11-14 11:07:26][wechat_channel.py:55] - Wechat message 4711678064238843899 already received, ignore [INFO][2024-11-14 11:14:43][wechat_channel.py:55] - Wechat message 8880841261123993380 already received, ignore [INFO][2024-11-14 11:14:43][wechat_channel.py:55] - Wechat message 8880841261123993380 already received, ignore [INFO][2024-11-14 11:14:49][wechat_channel.py:55] - Wechat message 4292753682028950768 already received, ignore [INFO][2024-11-14 11:14:49][wechat_channel.py:55] - Wechat message 4292753682028950768 already received, ignore [INFO][2024-11-14 11:15:10][wechat_channel.py:55] - Wechat message 5326129015787240597 already received, ignore [INFO][2024-11-14 11:15:10][wechat_channel.py:55] - Wechat message 5326129015787240597 already received, ignore [INFO][2024-11-14 11:15:26][wechat_channel.py:55] - Wechat message 3036455175635855702 already received, ignore [INFO][2024-11-14 11:15:26][wechat_channel.py:55] - Wechat message 3036455175635855702 already received, ignore [INFO][2024-11-14 11:19:33][wechat_channel.py:55] - Wechat message 4922605572692656272 already received, ignore [INFO][2024-11-14 11:19:33][wechat_channel.py:55] - Wechat message 4922605572692656272 already received, ignore [INFO][2024-11-14 11:20:09][wechat_channel.py:55] - Wechat message 2446834465803913063 already received, ignore [INFO][2024-11-14 11:20:09][wechat_channel.py:55] - Wechat message 2446834465803913063 already received, ignore [INFO][2024-11-14 11:20:28][wechat_channel.py:55] - Wechat message 2570009408213946216 already received, ignore [INFO][2024-11-14 11:20:28][wechat_channel.py:55] - Wechat message 2570009408213946216 already received, ignore [INFO][2024-11-14 11:21:23][wechat_channel.py:55] - Wechat message 490859146872994487 already received, ignore [INFO][2024-11-14 11:21:23][wechat_channel.py:55] - Wechat message 490859146872994487 already received, ignore [INFO][2024-11-14 11:21:28][wechat_channel.py:55] - Wechat message 8986283253068743625 already received, ignore [INFO][2024-11-14 11:21:28][wechat_channel.py:55] - Wechat message 8986283253068743625 already received, ignore [INFO][2024-11-14 11:21:39][wechat_channel.py:55] - Wechat message 5427745035293656527 already received, ignore [INFO][2024-11-14 11:21:39][wechat_channel.py:55] - Wechat message 5427745035293656527 already received, ignore [INFO][2024-11-14 11:22:34][wechat_channel.py:55] - Wechat message 8376437148598686321 already received, ignore [INFO][2024-11-14 11:22:34][wechat_channel.py:55] - Wechat message 8376437148598686321 already received, ignore [INFO][2024-11-14 11:22:56][wechat_channel.py:55] - Wechat message 8978635026210349983 already received, ignore [INFO][2024-11-14 11:22:56][wechat_channel.py:55] - Wechat message 8978635026210349983 already received, ignore [INFO][2024-11-14 11:23:17][wechat_channel.py:55] - Wechat message 2277049366503327626 already received, ignore [INFO][2024-11-14 11:23:17][wechat_channel.py:55] - Wechat message 2277049366503327626 already received, ignore [INFO][2024-11-14 11:27:33][wechat_channel.py:55] - Wechat message 3713136596255869540 already received, ignore [INFO][2024-11-14 11:27:33][wechat_channel.py:55] - Wechat message 3713136596255869540 already received, ignore [INFO][2024-11-14 11:30:13][wechat_channel.py:55] - Wechat message 4279520231057579693 already received, ignore [INFO][2024-11-14 11:30:13][wechat_channel.py:55] - Wechat message 4279520231057579693 already received, ignore [INFO][2024-11-14 11:39:55][wechat_channel.py:55] - Wechat message 7010568019042860390 already received, ignore [INFO][2024-11-14 11:39:55][wechat_channel.py:55] - Wechat message 7010568019042860390 already received, ignore [INFO][2024-11-14 11:40:02][wechat_channel.py:55] - Wechat message 1172117913643233329 already received, ignore [INFO][2024-11-14 11:40:02][wechat_channel.py:55] - Wechat message 1172117913643233329 already received, ignore [INFO][2024-11-14 11:40:15][wechat_channel.py:55] - Wechat message 6540042721163446108 already received, ignore [INFO][2024-11-14 11:40:15][wechat_channel.py:55] - Wechat message 6540042721163446108 already received, ignore [INFO][2024-11-14 11:41:20][wechat_channel.py:55] - Wechat message 8283740554178964188 already received, ignore [INFO][2024-11-14 11:41:20][wechat_channel.py:55] - Wechat message 8283740554178964188 already received, ignore [INFO][2024-11-14 11:41:35][wechat_channel.py:55] - Wechat message 2631105567472409570 already received, ignore [INFO][2024-11-14 11:41:35][wechat_channel.py:55] - Wechat message 2631105567472409570 already received, ignore [INFO][2024-11-14 11:41:43][wechat_channel.py:55] - Wechat message 6883384668417531888 already received, ignore [INFO][2024-11-14 11:41:43][wechat_channel.py:55] - Wechat message 6883384668417531888 already received, ignore [INFO][2024-11-14 11:42:32][wechat_channel.py:55] - Wechat message 4605184902355720788 already received, ignore [INFO][2024-11-14 11:42:32][wechat_channel.py:55] - Wechat message 4605184902355720788 already received, ignore [INFO][2024-11-14 14:04:50][app.py:19] - signal 2 received, exiting... [INFO][2024-11-14 14:04:50][config.py:234] - [Config] User datas saved. [INFO][2024-11-14 14:04:50][app.py:19] - signal 2 received, exiting... [INFO][2024-11-14 14:04:50][config.py:234] - [Config] User datas saved. [INFO][2024-11-14 14:04:57][config.py:299] - [INIT] load config: {'channel_type': 'wx', 'model': 'gpt-4o', 'open_ai_api_key': '****', 'claude_api_key': '', 'text_to_image': 'dall-e-2', 'voice_to_text': 'openai', 'text_to_voice': 'openai', 'proxy': '', 'hot_reload': True, 'single_chat_prefix': [''], 'open_ai_api_base': 'https://api.chatanywhere.tech/v1', 'single_chat_reply_prefix': '[REPLY] ', 'group_chat_prefix': ['@bot'], 'group_name_white_list': ['ALL_GROUP'], 'image_create_prefix': ['画'], 'speech_recognition': True, 'group_speech_recognition': True, 'voice_reply_voice': False, 'conversation_max_tokens': 2500, 'expires_in_seconds': 3600, 'character_desc': '你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。', 'temperature': 0.7, 'subscribe_msg': '感谢您的关注!\n这里是AI智能助手,可以自由对话。\n支持语音对话。\n支持图片输入。\n支持图片输出,画字开头的消息将按要求创作图片。\n支持tool、角色扮演和文字冒险等丰富的插件。\n输入{trigger_prefix}#help 查看详细指令。', 'use_linkai': True, 'linkai_api_key': '****', 'linkai_app_code': '****'}