lss233 / chatgpt-mirai-qq-bot

🚀 一键部署!真正的 AI 聊天机器人!支持ChatGPT、文心一言、讯飞星火、Bing、Bard、ChatGLM、POE,多账号,人设调教,虚拟女仆、图片渲染、语音发送 | 支持 QQ、Telegram、Discord、微信 等平台
GNU Affero General Public License v3.0
12.61k stars 1.53k forks source link

new bing 显示KeyError:'message'[BUG] 请填写标题 #354

Closed KamijyouTouma closed 1 year ago

KamijyouTouma commented 1 year ago

提交 issue 前,请先确认:

表现
描述 BUG 的表现情况

运行环境:

复现步骤
描述你是如何触发这个 BUG 的 可以切换为newbing,但只会输出“bing已结束本次对话。继续发送消息将开启一个新会话。” 预期行为
正常与newbing交流。

截图
[2023-03-15 09:04:40 +0800] [9624] [INFO] 127.0.0.1:51484 GET /ws 1.1 101 - 999 2023-03-15 09:04:52.539 | DEBUG | middlewares.concurrentlock:handle_request:40 - [Concurrent] 排队中<utils.QueueInfo object at 0x000002A66C234890>,前面还有 0 个人! 2023-03-15 09:04:52.540 | DEBUG | middlewares.concurrentlock:handle_request:42 - [Concurrent] 排到了! 2023-03-15 09:04:52.685 | ERROR | universal:request:147 - not enough values to unpack (expected 2, got 1) Traceback (most recent call last):

File "F:\clash\chat\chatgpt\bot.py", line 11, in import onebot_bot

File "", line 1178, in _find_and_load File "", line 1149, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed

File "F:\clash\chat\chatgpt\onebot_bot.py", line 183, in bot.run(host=config.onebot.reverse_ws_host, port=config.onebot.reverse_ws_port) │ │ │ │ │ │ │ └ 8080 │ │ │ │ │ │ └ Onebot(qq=2755623448, manager_qq=1619157478, reverse_ws_host='0.0.0.0', reverse_ws_port=8080) │ │ │ │ │ └ │ │ │ │ └ '0.0.0.0' │ │ │ └ Onebot(qq=2755623448, manager_qq=1619157478, reverse_ws_host='0.0.0.0', reverse_ws_port=8080) │ │ └ │ └ <function CQHttp.run at 0x000002A670DC2480> └ <aiocqhttp.CQHttp object at 0x000002A66B0FF1D0>

File "F:\clash\chat\chatgpt\python3.11\Lib\site-packages\aiocqhttp__init__.py", line 222, in run self._server_app.run(host=host, port=port, *args, *kwargs) │ │ │ │ │ │ └ {'use_reloader': False} │ │ │ │ │ └ () │ │ │ │ └ 8080 │ │ │ └ '0.0.0.0' │ │ └ <function Quart.run at 0x000002A670D9C720> │ └ <Quart ''> └ <aiocqhttp.CQHttp object at 0x000002A66B0FF1D0> File "F:\clash\chat\chatgpt\python3.11\Lib\site-packages\quart\app.py", line 1423, in run loop.run_until_complete(asyncio.gather(tasks)) │ │ │ │ └ [<Task pending name='Task-1' coro=<serve() running at F:\clash\chat\chatgpt\python3.11\Lib\site-packages\hypercorn\asyncio__... │ │ │ └ <function gather at 0x000002A643C3C5E0> │ │ └ <module 'asyncio' from 'F:\clash\chat\chatgpt\python3.11\python311.zip\asyncio\init.pyc'> │ └ <function BaseEventLoop.run_until_complete at 0x000002A643C41300> └

File "asyncio\base_events.py", line 640, in run_until_complete sock.setblocking(False)

File "asyncio\windows_events.py", line 321, in run_forever

File "asyncio\base_events.py", line 607, in run_forever sock.close()

File "asyncio\base_events.py", line 1922, in _run_once

File "asyncio\events.py", line 80, in _run self._loop = loop │ └ <member '_loop' of 'Handle' objects> └ <Handle <TaskStepMethWrapper object at 0x000002A67108B400>()>

File "F:\clash\chat\chatgpt\onebotbot.py", line 96, in await handle_message(response, f"friend-{event.userid}", msg.display, chain) │ │ │ │ └ MessageChain([Plain(text='切换AI bing-c')]) │ │ │ └ <property object at 0x000002A66C228450> │ │ └ MessageChain([Plain(text='切换AI bing-c')]) │ └ <function ..response at 0x000002A671087A60> └ <function handle_message at 0x000002A670DC3880>

File "F:\clash\chat\chatgpt\universal.py", line 155, in handle_message await action(session_id, message.strip(), conversation_context, respond) │ │ │ │ │ └ <function handle_message..respond at 0x000002A6710E4180> │ │ │ │ └ None │ │ │ └ <method 'strip' of 'str' objects> │ │ └ '切换AI bing-c' │ └ 'friend-1619157478' └ <function handle_message..wrap_request..call at 0x000002A6710E44A0>

File "F:\clash\chat\chatgpt\universal.py", line 47, in call await m.handle_request(session_id, message, respond, conversation_context, n) │ │ │ │ │ │ └ <function handle_message..wrap_request..call at 0x000002A6710E4400> │ │ │ │ │ └ None │ │ │ │ └ <function handle_message..respond at 0x000002A6710E4180> │ │ │ └ '切换AI bing-c' │ │ └ 'friend-1619157478' │ └ <function MiddlewareConcurrentLock.handle_request at 0x000002A671084680> └ <middlewares.concurrentlock.MiddlewareConcurrentLock object at 0x000002A670DCDB50>

File "F:\clash\chat\chatgpt\middlewares\concurrentlock.py", line 43, in handle_request await action(session_id, prompt, conversation_context, respond) │ │ │ │ └ <function handle_message..respond at 0x000002A6710E4180> │ │ │ └ None │ │ └ '切换AI bing-c' │ └ 'friend-1619157478' └ <function handle_message..wrap_request..call at 0x000002A6710E4400>

File "F:\clash\chat\chatgpt\universal.py", line 47, in call await m.handle_request(session_id, message, respond, conversation_context, n) │ │ │ │ │ │ └ <function handle_message..wrap_request..call at 0x000002A6710E4360> │ │ │ │ │ └ None │ │ │ │ └ <function handle_message..respond at 0x000002A6710E4180> │ │ │ └ '切换AI bing-c' │ │ └ 'friend-1619157478' │ └ <function Middleware.handle_request at 0x000002A67106FF60> └ <middlewares.baiducloud.MiddlewareBaiduCloud object at 0x000002A670DCD890>

File "F:\clash\chat\chatgpt\middlewares\middleware.py", line 9, in handle_request await action(session_id, prompt, conversation_context, respond) │ │ │ │ └ <function handle_message..respond at 0x000002A6710E4180> │ │ │ └ None │ │ └ '切换AI bing-c' │ └ 'friend-1619157478' └ <function handle_message..wrap_request..call at 0x000002A6710E4360>

File "F:\clash\chat\chatgpt\universal.py", line 47, in call await m.handle_request(session_id, message, respond, conversation_context, n) │ │ │ │ │ │ └ <function handle_message..wrap_request..call at 0x000002A6710E42C0> │ │ │ │ │ └ None │ │ │ │ └ <function handle_message..respond at 0x000002A6710E4180> │ │ │ └ '切换AI bing-c' │ │ └ 'friend-1619157478' │ └ <function MiddlewareRatelimit.handle_request at 0x000002A671084720> └ <middlewares.ratelimit.MiddlewareRatelimit object at 0x000002A670DCE410>

File "F:\clash\chat\chatgpt\middlewares\ratelimit.py", line 25, in handle_request await action(session_id, prompt, conversation_context, respond) │ │ │ │ └ <function handle_message..respond at 0x000002A6710E4180> │ │ │ └ None │ │ └ '切换AI bing-c' │ └ 'friend-1619157478' └ <function handle_message..wrap_request..call at 0x000002A6710E42C0>

File "F:\clash\chat\chatgpt\universal.py", line 47, in call await m.handle_request(session_id, message, respond, conversation_context, n) │ │ │ │ │ │ └ <function handle_message..request at 0x000002A6710E4220> │ │ │ │ │ └ None │ │ │ │ └ <function handle_message..respond at 0x000002A6710E4180> │ │ │ └ '切换AI bing-c' │ │ └ 'friend-1619157478' │ └ <function MiddlewareTimeout.handle_request at 0x000002A671085440> └ <middlewares.timeout.MiddlewareTimeout object at 0x000002A670F0C610>

File "F:\clash\chat\chatgpt\middlewares\timeout.py", line 30, in handle_request await action(session_id, prompt, conversation_context, respond) │ │ │ │ └ <function handle_message..respond at 0x000002A6710E4180> │ │ │ └ None │ │ └ '切换AI bing-c' │ └ 'friend-1619157478' └ <function handle_message..request at 0x000002A6710E4220>

File "F:\clash\chat\chatgpt\universal.py", line 70, in request conversation_handler.current_conversation = await conversation_handler.create( │ │ │ └ <function ConversationHandler.create at 0x000002A67106FB00> │ │ └ <conversation.ConversationHandler object at 0x000002A670C17F10> │ └ <conversation.ConversationContext object at 0x000002A6710BBC50> └ <conversation.ConversationHandler object at 0x000002A670C17F10>

File "F:\clash\chat\chatgpt\conversation.py", line 156, in create conversation = ConversationContext(_type, self.session_id) │ │ │ └ 'friend-1619157478' │ │ └ <conversation.ConversationHandler object at 0x000002A670C17F10> │ └ 'bing-c' └ <class 'conversation.ConversationContext'>

File "F:\clash\chat\chatgpt\conversation.py", line 47, in init self.adapter = BingAdapter(self.session_id, ConversationStyle.creative) │ │ │ │ │ └ <ConversationStyle.creative: 'h3imaginative'> │ │ │ │ └ <enum 'ConversationStyle'> │ │ │ └ 'friend-1619157478' │ │ └ <conversation.ConversationContext object at 0x000002A6710B95D0> │ └ <class 'adapter.ms.bing.BingAdapter'> └ <conversation.ConversationContext object at 0x000002A6710B95D0>

File "F:\clash\chat\chatgpt\adapter\ms\bing.py", line 28, in init name, value = line.split("=", 1) │ │ └ <method 'split' of 'str' objects> │ └ '' └ 'ai_session'

ValueError: not enough values to unpack (expected 2, got 1) 2023-03-15 09:04:52.758 | DEBUG | middlewares.timeout:create_timeout_task:12 - [Timeout] 开始计时…… 2023-03-15 09:04:52.761 | DEBUG | middlewares.timeout:on_respond:36 - [Timeout] 取消计时…… 2023-03-15 09:04:58.305 | DEBUG | middlewares.concurrentlock:handle_request:40 - [Concurrent] 排队中<utils.QueueInfo object at 0x000002A66C234890>,前面还有 0 个人! 2023-03-15 09:04:58.306 | DEBUG | middlewares.concurrentlock:handle_request:42 - [Concurrent] 排到了! 2023-03-15 09:04:59.363 | DEBUG | middlewares.timeout:create_timeout_task:12 - [Timeout] 开始计时…… 2023-03-15 09:04:59.365 | DEBUG | middlewares.timeout:on_respond:36 - [Timeout] 取消计时…… 2023-03-15 09:05:05.443 | DEBUG | middlewares.concurrentlock:handle_request:40 - [Concurrent] 排队中<utils.QueueInfo object at 0x000002A66C234890>,前面还有 0 个人! 2023-03-15 09:05:05.444 | DEBUG | middlewares.concurrentlock:handle_request:42 - [Concurrent] 排到了! 2023-03-15 09:05:05.446 | DEBUG | middlewares.timeout:create_timeout_task:12 - [Timeout] 开始计时…… 2023-03-15 09:05:06.374 | ERROR | adapter.ms.bing:ask:64 - 'messages' Traceback (most recent call last):

File "F:\clash\chat\chatgpt\bot.py", line 11, in import onebot_bot

File "", line 1178, in _find_and_load File "", line 1149, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "", line 940, in exec_module File "", line 241, in _call_with_frames_removed

File "F:\clash\chat\chatgpt\onebot_bot.py", line 183, in bot.run(host=config.onebot.reverse_ws_host, port=config.onebot.reverse_ws_port) │ │ │ │ │ │ │ └ 8080 │ │ │ │ │ │ └ Onebot(qq=2755623448, manager_qq=1619157478, reverse_ws_host='0.0.0.0', reverse_ws_port=8080) │ │ │ │ │ └ │ │ │ │ └ '0.0.0.0' │ │ │ └ Onebot(qq=2755623448, manager_qq=1619157478, reverse_ws_host='0.0.0.0', reverse_ws_port=8080) │ │ └ │ └ <function CQHttp.run at 0x000002A670DC2480> └ <aiocqhttp.CQHttp object at 0x000002A66B0FF1D0>

File "F:\clash\chat\chatgpt\python3.11\Lib\site-packages\aiocqhttp__init__.py", line 222, in run self._server_app.run(host=host, port=port, *args, *kwargs) │ │ │ │ │ │ └ {'use_reloader': False} │ │ │ │ │ └ () │ │ │ │ └ 8080 │ │ │ └ '0.0.0.0' │ │ └ <function Quart.run at 0x000002A670D9C720> │ └ <Quart ''> └ <aiocqhttp.CQHttp object at 0x000002A66B0FF1D0> File "F:\clash\chat\chatgpt\python3.11\Lib\site-packages\quart\app.py", line 1423, in run loop.run_until_complete(asyncio.gather(tasks)) │ │ │ │ └ [<Task pending name='Task-1' coro=<serve() running at F:\clash\chat\chatgpt\python3.11\Lib\site-packages\hypercorn\asyncio__... │ │ │ └ <function gather at 0x000002A643C3C5E0> │ │ └ <module 'asyncio' from 'F:\clash\chat\chatgpt\python3.11\python311.zip\asyncio\init.pyc'> │ └ <function BaseEventLoop.run_until_complete at 0x000002A643C41300> └

File "asyncio\base_events.py", line 640, in run_until_complete sock.setblocking(False)

File "asyncio\windows_events.py", line 321, in run_forever

File "asyncio\base_events.py", line 607, in run_forever sock.close()

File "asyncio\base_events.py", line 1922, in _run_once

File "asyncio\events.py", line 80, in _run self._loop = loop │ └ <member '_loop' of 'Handle' objects> └ <Handle Task.task_wakeup()>

File "F:\clash\chat\chatgpt\onebotbot.py", line 96, in await handle_message(response, f"friend-{event.userid}", msg.display, chain) │ │ │ │ └ MessageChain([Plain(text='你好')]) │ │ │ └ <property object at 0x000002A66C228450> │ │ └ MessageChain([Plain(text='你好')]) │ └ <function ..response at 0x000002A6710E47C0> └ <function handle_message at 0x000002A670DC3880>

File "F:\clash\chat\chatgpt\universal.py", line 155, in handle_message await action(session_id, message.strip(), conversation_context, respond) │ │ │ │ │ └ <function handle_message..respond at 0x000002A6710E6D40> │ │ │ │ └ None │ │ │ └ <method 'strip' of 'str' objects> │ │ └ '你好' │ └ 'friend-1619157478' └ <function handle_message..wrap_request..call at 0x000002A6710E42C0>

File "F:\clash\chat\chatgpt\universal.py", line 47, in call await m.handle_request(session_id, message, respond, conversation_context, n) │ │ │ │ │ │ └ <function handle_message..wrap_request..call at 0x000002A6710E4540> │ │ │ │ │ └ None │ │ │ │ └ <function handle_message..respond at 0x000002A6710E6D40> │ │ │ └ '你好' │ │ └ 'friend-1619157478' │ └ <function MiddlewareConcurrentLock.handle_request at 0x000002A671084680> └ <middlewares.concurrentlock.MiddlewareConcurrentLock object at 0x000002A670DCDB50>

File "F:\clash\chat\chatgpt\middlewares\concurrentlock.py", line 43, in handle_request await action(session_id, prompt, conversation_context, respond) │ │ │ │ └ <function handle_message..respond at 0x000002A6710E6D40> │ │ │ └ None │ │ └ '你好' │ └ 'friend-1619157478' └ <function handle_message..wrap_request..call at 0x000002A6710E4540>

File "F:\clash\chat\chatgpt\universal.py", line 47, in call await m.handle_request(session_id, message, respond, conversation_context, n) │ │ │ │ │ │ └ <function handle_message..wrap_request..call at 0x000002A6710E6980> │ │ │ │ │ └ None │ │ │ │ └ <function handle_message..respond at 0x000002A6710E6D40> │ │ │ └ '你好' │ │ └ 'friend-1619157478' │ └ <function Middleware.handle_request at 0x000002A67106FF60> └ <middlewares.baiducloud.MiddlewareBaiduCloud object at 0x000002A670DCD890>

File "F:\clash\chat\chatgpt\middlewares\middleware.py", line 9, in handle_request await action(session_id, prompt, conversation_context, respond) │ │ │ │ └ <function handle_message..respond at 0x000002A6710E6D40> │ │ │ └ None │ │ └ '你好' │ └ 'friend-1619157478' └ <function handle_message..wrap_request..call at 0x000002A6710E6980>

File "F:\clash\chat\chatgpt\universal.py", line 47, in call await m.handle_request(session_id, message, respond, conversation_context, n) │ │ │ │ │ │ └ <function handle_message..wrap_request..call at 0x000002A6710E6C00> │ │ │ │ │ └ None │ │ │ │ └ <function handle_message..respond at 0x000002A6710E6D40> │ │ │ └ '你好' │ │ └ 'friend-1619157478' │ └ <function MiddlewareRatelimit.handle_request at 0x000002A671084720> └ <middlewares.ratelimit.MiddlewareRatelimit object at 0x000002A670DCE410>

File "F:\clash\chat\chatgpt\middlewares\ratelimit.py", line 25, in handle_request await action(session_id, prompt, conversation_context, respond) │ │ │ │ └ <function handle_message..respond at 0x000002A6710E6D40> │ │ │ └ None │ │ └ '你好' │ └ 'friend-1619157478' └ <function handle_message..wrap_request..call at 0x000002A6710E6C00>

File "F:\clash\chat\chatgpt\universal.py", line 47, in call await m.handle_request(session_id, message, respond, conversation_context, n) │ │ │ │ │ │ └ <function handle_message..request at 0x000002A6710E6CA0> │ │ │ │ │ └ None │ │ │ │ └ <function handle_message..respond at 0x000002A6710E6D40> │ │ │ └ '你好' │ │ └ 'friend-1619157478' │ └ <function MiddlewareTimeout.handle_request at 0x000002A671085440> └ <middlewares.timeout.MiddlewareTimeout object at 0x000002A670F0C610>

File "F:\clash\chat\chatgpt\middlewares\timeout.py", line 30, in handle_request await action(session_id, prompt, conversation_context, respond) │ │ │ │ └ <function handle_message..respond at 0x000002A6710E6D40> │ │ │ └ None │ │ └ '你好' │ └ 'friend-1619157478' └ <function handle_message..request at 0x000002A6710E6CA0>

File "F:\clash\chat\chatgpt\universal.py", line 114, in request async for rendered in task: └ <async_generator object ConversationContext.ask at 0x000002A670FF1470>

File "F:\clash\chat\chatgpt\conversation.py", line 85, in ask async for item in self.adapter.ask(prompt): │ │ │ └ '你好' │ │ └ <function BingAdapter.ask at 0x000002A670F04AE0> │ └ <adapter.ms.bing.BingAdapter object at 0x000002A671168490> └ <conversation.ConversationContext object at 0x000002A6710AE450>

File "F:\clash\chat\chatgpt\adapter\ms\bing.py", line 46, in ask async for final, response in self.bot.ask_stream(prompt=prompt, │ │ │ └ '你好' │ │ └ <function Chatbot.ask_stream at 0x000002A670E52A20> │ └ <EdgeGPT.Chatbot object at 0x000002A671169ED0> └ <adapter.ms.bing.BingAdapter object at 0x000002A671168490>

File "F:\clash\chat\chatgpt\python3.11\Lib\site-packages\EdgeGPT.py", line 295, in ask_stream async for response in self.chat_hub.ask_stream( │ │ └ <function ChatHub.ask_stream at 0x000002A670E52700> │ └ <EdgeGPT.ChatHub object at 0x000002A6710D7B90> └ <EdgeGPT.Chatbot object at 0x000002A671169ED0> File "F:\clash\chat\chatgpt\python3.11\Lib\site-packages\EdgeGPT.py", line 242, in ask_stream yield False, response["arguments"][0]["messages"][0][ └ {'type': 1, 'target': 'update', 'arguments': [{'requestId': 'cee7a5f5-163c-40a3-b530-c04717ee4bc0', 'throttling': {'maxNumUse...

KeyError: 'messages' 2023-03-15 09:05:07.897 | DEBUG | middlewares.timeout:handle_respond:42 - [Timeout] 取消计时……

其他内容
此处填写其他内容,没有可跳过

AngalPeng commented 1 year ago

https://github.com/acheong08/EdgeGPT/pull/124#issue-1624462893 这条链接有解决办法 在python包里找EdgeGPT.py,在里面找到if response.get("type") == 1这行 用这行替换掉它if response.get("type") == 1 and response["arguments"][0].get("messages"):

KamijyouTouma commented 1 year ago

谢谢,已解决