chatgpt-on-wechat icon indicating copy to clipboard operation
chatgpt-on-wechat copied to clipboard

使用自定义api_base后报错[chat_gpt_bot.py:155] - [CHATGPT] Exception: 'usage'

Open troublemakerMibu opened this issue 1 month ago • 2 comments

前置确认

  • [X] 我确认我运行的是最新版本的代码,并且安装了所需的依赖,在FAQS中也未找到类似问题。

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

  • [X] 我已经搜索过issues和disscussions,没有跟我遇到的问题相关的issue

操作系统类型?

Docker

运行的python版本是?

other

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

Latest Release

运行的channel类型是?

other

复现步骤 🕹

我使用了自定义的api接口,来自于项目https://github.com/missuo/FreeDuckDuckGo/tree/main,经过测试使用curl的方式可以获得正常的回复。 我使用的是钉钉进行连接,正确配置了相关参数之后可以正常在单聊和群聊中@bot。 但是在和机器人发信息的时候,机器人一直回复:[ERROR]我现在有点累了,等会再来吧 image

我查看服务器日志时显示: image

问题描述 😯

我的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'

troublemakerMibu avatar May 09 '24 12:05 troublemakerMibu