Closed troublemakerMibu closed 3 months ago
Docker
other
Latest Release
channel
我使用了自定义的api接口,来自于项目https://github.com/missuo/FreeDuckDuckGo/tree/main,经过测试使用curl的方式可以获得正常的回复。 我使用的是钉钉进行连接,正确配置了相关参数之后可以正常在单聊和群聊中@bot。 但是在和机器人发信息的时候,机器人一直回复:[ERROR]我现在有点累了,等会再来吧
我查看服务器日志时显示:
我的docker-compose.yml配置: version: '2.0' services: chatgpt-on-wechat: image: zhayujie/chatgpt-on-wechat container_name: chatgpt-on-wechat security_opt:
seccomp:unconfined environment: OPEN_AI_API_KEY: 'sk-xxxxxx' MODEL: 'gpt-3.5-turbo' OPEN_AI_API_BASE: 'https://my_api_base/v1'
CHANNEL_TYPE: 'dingtalk' DINGTALK_CLIENT_ID: 'my_client_ID' DINGTALK_CLIENT_SECRET: 'my_secret_key' SINGLE_CHAT_PREFIX: '["bot", "@bot"]' SINGLE_CHAT_REPLY_PREFIX: '"[bot] "' GROUP_CHAT_PREFIX: '["@bot"]' GROUP_NAME_WHITE_LIST: '["ALL_GROUP","ALL_GROUP"]'
SPEECH_RECOGNITION: 'False' CHARACTER_DESC: '你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。' EXPIRES_IN_SECONDS: 3600 USE_GLOBAL_PLUGIN_CONFIG: 'True' USE_LINKAI: 'False' CLEAR_MEMORY_COMMANDS: '["#清除记忆"]'
chatgpt-tool-hub version: 0.5.0 [INFO][2024-05-09 12:28:04][plugin_manager.py:41] - Plugin tool_v0.5 registered, path=./plugins/tool [INFO][2024-05-09 12:28:04][plugin_manager.py:41] - Plugin Banwords_v1.0 registered, path=./plugins/banwords [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin GODCMD not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin KEYWORD not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin BANWORDS not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin LINKAI not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin TOOL not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin ROLE not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin DUNGEON not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin BDUNIT not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin HELLO not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin FINISH not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][godcmd.py:194] - [Godcmd] 因未设置口令,本次的临时口令为8579。 [INFO][2024-05-09 12:28:04][godcmd.py:210] - [Godcmd] inited [INFO][2024-05-09 12:28:04][keyword.py:40] - [keyword] {} [INFO][2024-05-09 12:28:04][keyword.py:42] - [keyword] inited. [WARNING][2024-05-09 12:28:04][banwords.py:54] - [Banwords] init failed, ignore or see https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/banwords . [WARNING][2024-05-09 12:28:04][plugin_manager.py:150] - Failed to init BANWORDS, diabled. [Errno 2] No such file or directory: '/app/plugins/banwords/banwords.txt' [INFO][2024-05-09 12:28:04][linkai.py:34] - [LinkAI] inited, config={'group_app_map': {'测试群名1': 'default', '测试群名2': 'Kv2fXJcH'}, 'midjourney': {'enabled': False, 'auto_translate': True, 'img_proxy': True, 'max_tasks': 3, 'max_tasks_per_user': 1, 'use_image_create_prefix': True}, 'summary': {'enabled': False, 'group_enabled': True, 'max_file_size': 5000, 'type': ['FILE', 'SHARING']}} [INFO][2024-05-09 12:28:05][tool.py:28] - [tool] inited [INFO][2024-05-09 12:28:05][role.py:69] - [Role] inited [INFO][2024-05-09 12:28:05][dungeon.py:56] - [Dungeon] inited [WARNING][2024-05-09 12:28:05][bdunit.py:42] - [BDunit] init failed, ignore [WARNING][2024-05-09 12:28:05][plugin_manager.py:150] - Failed to init BDUNIT, diabled. config.json not found [INFO][2024-05-09 12:28:05][hello.py:38] - [Hello] inited [INFO][2024-05-09 12:28:05][finish.py:23] - [Finish] inited 2024-05-09 12:28:05,854 dingtalk_stream.client INFO open connection, url=https://api.dingtalk.com/v1.0/gateway/connections/open [stream.py:131] 2024-05-09 12:28:06,090 dingtalk_stream.client INFO endpoint is {'endpoint': 'wss://wss-open-connection.dingtalk.com:443/connect', 'ticket': '9640d9b4-0dff-11ef-b568-d230038a41ab'} [stream.py:72] [INFO][2024-05-09 12:28:31][bridge.py:59] - create bot chatGPT for chat [INFO][2024-05-09 12:28:31][chat_gpt_bot.py:49] - [CHATGPT] query=@bot 你好 [ERROR][2024-05-09 12:28:37][chat_gpt_bot.py:155] - [CHATGPT] Exception: 'usage' Traceback (most recent call last): File "/app/bot/chatgpt/chat_gpt_bot.py", line 127, in reply_text "total_tokens": response["usage"]["total_tokens"], KeyError: 'usage'
应该是返回结果的格式和chatgpt的返回格式不一样导致response["usage"]["total_tokens"]这个值获取不了
解决了吗?我也遇到了这个问题
三方api返回不是标准的openai格式
不修复一下呀,没拿到usage给个默认值呗
前置确认
⚠️ 搜索issues中是否已存在类似问题
操作系统类型?
Docker
运行的python版本是?
other
使用的chatgpt-on-wechat版本是?
Latest Release
运行的
channel
类型是?other
复现步骤 🕹
我使用了自定义的api接口,来自于项目https://github.com/missuo/FreeDuckDuckGo/tree/main,经过测试使用curl的方式可以获得正常的回复。 我使用的是钉钉进行连接,正确配置了相关参数之后可以正常在单聊和群聊中@bot。 但是在和机器人发信息的时候,机器人一直回复:[ERROR]我现在有点累了,等会再来吧![image](https://github.com/zhayujie/chatgpt-on-wechat/assets/121711734/ecb1513c-fe19-4b1b-aa99-46c4858d305d)
我查看服务器日志时显示:![image](https://github.com/zhayujie/chatgpt-on-wechat/assets/121711734/c35ec70b-e7dd-40a9-9a9a-28ab2e9fe355)
问题描述 😯
我的docker-compose.yml配置: version: '2.0' services: chatgpt-on-wechat: image: zhayujie/chatgpt-on-wechat container_name: chatgpt-on-wechat security_opt:
seccomp:unconfined environment: OPEN_AI_API_KEY: 'sk-xxxxxx' MODEL: 'gpt-3.5-turbo' OPEN_AI_API_BASE: 'https://my_api_base/v1'
CHANNEL_TYPE: 'dingtalk' DINGTALK_CLIENT_ID: 'my_client_ID' DINGTALK_CLIENT_SECRET: 'my_secret_key' SINGLE_CHAT_PREFIX: '["bot", "@bot"]' SINGLE_CHAT_REPLY_PREFIX: '"[bot] "' GROUP_CHAT_PREFIX: '["@bot"]' GROUP_NAME_WHITE_LIST: '["ALL_GROUP","ALL_GROUP"]'
SPEECH_RECOGNITION: 'False' CHARACTER_DESC: '你是ChatGPT, 一个由OpenAI训练的大型语言模型, 你旨在回答并解决人们的任何问题,并且可以使用多种语言与人交流。' EXPIRES_IN_SECONDS: 3600 USE_GLOBAL_PLUGIN_CONFIG: 'True' USE_LINKAI: 'False' CLEAR_MEMORY_COMMANDS: '["#清除记忆"]'
终端日志 📒
chatgpt-tool-hub version: 0.5.0 [INFO][2024-05-09 12:28:04][plugin_manager.py:41] - Plugin tool_v0.5 registered, path=./plugins/tool [INFO][2024-05-09 12:28:04][plugin_manager.py:41] - Plugin Banwords_v1.0 registered, path=./plugins/banwords [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin GODCMD not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin KEYWORD not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin BANWORDS not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin LINKAI not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin TOOL not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin ROLE not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin DUNGEON not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin BDUNIT not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin HELLO not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][plugin_manager.py:123] - Plugin FINISH not found in pconfig, adding to pconfig... [INFO][2024-05-09 12:28:04][godcmd.py:194] - [Godcmd] 因未设置口令,本次的临时口令为8579。 [INFO][2024-05-09 12:28:04][godcmd.py:210] - [Godcmd] inited [INFO][2024-05-09 12:28:04][keyword.py:40] - [keyword] {} [INFO][2024-05-09 12:28:04][keyword.py:42] - [keyword] inited. [WARNING][2024-05-09 12:28:04][banwords.py:54] - [Banwords] init failed, ignore or see https://github.com/zhayujie/chatgpt-on-wechat/tree/master/plugins/banwords . [WARNING][2024-05-09 12:28:04][plugin_manager.py:150] - Failed to init BANWORDS, diabled. [Errno 2] No such file or directory: '/app/plugins/banwords/banwords.txt' [INFO][2024-05-09 12:28:04][linkai.py:34] - [LinkAI] inited, config={'group_app_map': {'测试群名1': 'default', '测试群名2': 'Kv2fXJcH'}, 'midjourney': {'enabled': False, 'auto_translate': True, 'img_proxy': True, 'max_tasks': 3, 'max_tasks_per_user': 1, 'use_image_create_prefix': True}, 'summary': {'enabled': False, 'group_enabled': True, 'max_file_size': 5000, 'type': ['FILE', 'SHARING']}} [INFO][2024-05-09 12:28:05][tool.py:28] - [tool] inited [INFO][2024-05-09 12:28:05][role.py:69] - [Role] inited [INFO][2024-05-09 12:28:05][dungeon.py:56] - [Dungeon] inited [WARNING][2024-05-09 12:28:05][bdunit.py:42] - [BDunit] init failed, ignore [WARNING][2024-05-09 12:28:05][plugin_manager.py:150] - Failed to init BDUNIT, diabled. config.json not found [INFO][2024-05-09 12:28:05][hello.py:38] - [Hello] inited [INFO][2024-05-09 12:28:05][finish.py:23] - [Finish] inited 2024-05-09 12:28:05,854 dingtalk_stream.client INFO open connection, url=https://api.dingtalk.com/v1.0/gateway/connections/open [stream.py:131] 2024-05-09 12:28:06,090 dingtalk_stream.client INFO endpoint is {'endpoint': 'wss://wss-open-connection.dingtalk.com:443/connect', 'ticket': '9640d9b4-0dff-11ef-b568-d230038a41ab'} [stream.py:72] [INFO][2024-05-09 12:28:31][bridge.py:59] - create bot chatGPT for chat [INFO][2024-05-09 12:28:31][chat_gpt_bot.py:49] - [CHATGPT] query=@bot 你好 [ERROR][2024-05-09 12:28:37][chat_gpt_bot.py:155] - [CHATGPT] Exception: 'usage' Traceback (most recent call last): File "/app/bot/chatgpt/chat_gpt_bot.py", line 127, in reply_text "total_tokens": response["usage"]["total_tokens"], KeyError: 'usage'