lss233 / chatgpt-mirai-qq-bot

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

[BUG] new bing 无法连接 #352

Closed d4renk closed 1 year ago

d4renk commented 1 year ago

提交 issue 前,请先确认:

表现
描述 BUG 的表现情况

运行环境:

复现步骤

预期行为
描述你认为正常情况下应该看见的情况

截图

Traceback (most recent call last):

  File "/home/app/app/chatgpt-mirai-qq-bot/bot.py", line 17, in <module>
    import ariadne_bot

  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed

  File "/home/app/app/chatgpt-mirai-qq-bot/ariadne_bot.py", line 199, in <module>
    app.launch_blocking()
    │   └ <classmethod object at 0x7f907fe91ac0>
    └ <graia.ariadne.app.Ariadne object at 0x7f908c1c7af0>

  File "/home/app/.local/lib/python3.9/site-packages/graia/ariadne/app.py", line 312, in launch_blocking
    cls.launch_manager.launch_blocking(loop=cls.service.loop, stop_signal=stop_signals)
    │   │              │                    │   │       │                 └ (<Signals.SIGINT: 2>,)
    │   │              │                    │   │       └ <property object at 0x7f907fe975e0>
    │   │              │                    │   └ <graia.ariadne.service.ElizabethService object at 0x7f908c1c7ac0>
    │   │              │                    └ <class 'graia.ariadne.app.Ariadne'>
    │   │              └ <function Launart.launch_blocking at 0x7f908c260790>
    │   └ <launart.manager.Launart object at 0x7f907eabc880>
    └ <class 'graia.ariadne.app.Ariadne'>
  File "/home/app/.local/lib/python3.9/site-packages/launart/manager.py", line 494, in launch_blocking
    loop.run_until_complete(launch_task)
    │    │                  └ <Task pending name='amnesia-launch' coro=<Launart.launch() running at /home/app/.local/lib/python3.9/site-packages/launart/ma...
    │    └ <function BaseEventLoop.run_until_complete at 0x7f90c1d82a60>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 629, in run_until_complete
    self.run_forever()
    │    └ <function BaseEventLoop.run_forever at 0x7f90c1d829d0>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 596, in run_forever
    self._run_once()
    │    └ <function BaseEventLoop._run_once at 0x7f90c1d85550>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/local/lib/python3.9/asyncio/base_events.py", line 1890, in _run_once
    handle._run()
    │      └ <function Handle._run at 0x7f90c1dca1f0>
    └ <Handle <TaskWakeupMethWrapper object at 0x7f907e0d7040>(<Future finished result=None>)>
  File "/usr/local/lib/python3.9/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
    │    │            │    │           │    └ <member '_args' of 'Handle' objects>
    │    │            │    │           └ <Handle <TaskWakeupMethWrapper object at 0x7f907e0d7040>(<Future finished result=None>)>
    │    │            │    └ <member '_callback' of 'Handle' objects>
    │    │            └ <Handle <TaskWakeupMethWrapper object at 0x7f907e0d7040>(<Future finished result=None>)>
    │    └ <member '_context' of 'Handle' objects>
    └ <Handle <TaskWakeupMethWrapper object at 0x7f907e0d7040>(<Future finished result=None>)>
  File "/home/app/.local/lib/python3.9/site-packages/graia/broadcast/__init__.py", line 191, in Executor
    result = await run_always_await(target_callable, **parameter_compile_result)
                   │                │                  └ {'app': <graia.ariadne.app.Ariadne object at 0x7f908c1c7af0>, 'target': Friend(id=******, nickname='~', remark='~'), 'sou...
                   │                └ <function friend_message_listener at 0x7f907ea61ca0>
                   └ <function run_always_await at 0x7f908c279550>
  File "/home/app/.local/lib/python3.9/site-packages/graia/broadcast/utilles.py", line 34, in run_always_await
    obj = await obj
                └ <coroutine object friend_message_listener at 0x7f907e1319c0>

  File "/home/app/app/chatgpt-mirai-qq-bot/ariadne_bot.py", line 86, in friend_message_listener
    await handle_message(response, f"friend-{target.id}", chain.display, chain)
          │              │                                │     │        └ MessageChain([Plain(text='你好')])
          │              │                                │     └ <property object at 0x7f907ffa5180>
          │              │                                └ MessageChain([Plain(text='你好')])
          │              └ <function friend_message_listener.<locals>.response at 0x7f907e12fc10>
          └ <function handle_message at 0x7f908c2b0160>

  File "/home/app/app/chatgpt-mirai-qq-bot/universal.py", line 155, in handle_message
    await action(session_id, message.strip(), conversation_context, respond)
          │      │           │       │        │                     └ <function handle_message.<locals>.respond at 0x7f907e12fee0>
          │      │           │       │        └ None
          │      │           │       └ <method 'strip' of 'str' objects>
          │      │           └ '你好'
          │      └ 'friend-******'
          └ <function handle_message.<locals>.wrap_request.<locals>.call at 0x7f907e0d6550>

  File "/home/app/app/chatgpt-mirai-qq-bot/universal.py", line 47, in call
    await m.handle_request(session_id, message, respond, conversation_context, n)
          │ │              │           │        │        │                     └ <function handle_message.<locals>.wrap_request.<locals>.call at 0x7f907e0d6310>
          │ │              │           │        │        └ None
          │ │              │           │        └ <function handle_message.<locals>.respond at 0x7f907e12fee0>
          │ │              │           └ '你好'
          │ │              └ 'friend-******'
          │ └ <function MiddlewareConcurrentLock.handle_request at 0x7f907eb10160>
          └ <middlewares.concurrentlock.MiddlewareConcurrentLock object at 0x7f908c1c74f0>

  File "/home/app/app/chatgpt-mirai-qq-bot/middlewares/concurrentlock.py", line 43, in handle_request
    await action(session_id, prompt, conversation_context, respond)
          │      │           │       │                     └ <function handle_message.<locals>.respond at 0x7f907e12fee0>
          │      │           │       └ None
          │      │           └ '你好'
          │      └ 'friend-******'
          └ <function handle_message.<locals>.wrap_request.<locals>.call at 0x7f907e0d6310>

  File "/home/app/app/chatgpt-mirai-qq-bot/universal.py", line 47, in call
    await m.handle_request(session_id, message, respond, conversation_context, n)
          │ │              │           │        │        │                     └ <function handle_message.<locals>.wrap_request.<locals>.call at 0x7f907e0d6280>
          │ │              │           │        │        └ None
          │ │              │           │        └ <function handle_message.<locals>.respond at 0x7f907e12fee0>
          │ │              │           └ '你好'
          │ │              └ 'friend-******'
          │ └ <function Middleware.handle_request at 0x7f907eb1faf0>
          └ <middlewares.baiducloud.MiddlewareBaiduCloud object at 0x7f908c1c7520>

  File "/home/app/app/chatgpt-mirai-qq-bot/middlewares/middleware.py", line 9, in handle_request
    await action(session_id, prompt, conversation_context, respond)
          │      │           │       │                     └ <function handle_message.<locals>.respond at 0x7f907e12fee0>
          │      │           │       └ None
          │      │           └ '你好'
          │      └ 'friend-******'
          └ <function handle_message.<locals>.wrap_request.<locals>.call at 0x7f907e0d6280>

  File "/home/app/app/chatgpt-mirai-qq-bot/universal.py", line 47, in call
    await m.handle_request(session_id, message, respond, conversation_context, n)
          │ │              │           │        │        │                     └ <function handle_message.<locals>.wrap_request.<locals>.call at 0x7f907e0d6040>
          │ │              │           │        │        └ None
          │ │              │           │        └ <function handle_message.<locals>.respond at 0x7f907e12fee0>
          │ │              │           └ '你好'
          │ │              └ 'friend-******'
          │ └ <function MiddlewareRatelimit.handle_request at 0x7f907eb10a60>
          └ <middlewares.ratelimit.MiddlewareRatelimit object at 0x7f908c1c7550>

  File "/home/app/app/chatgpt-mirai-qq-bot/middlewares/ratelimit.py", line 25, in handle_request
    await action(session_id, prompt, conversation_context, respond)
          │      │           │       │                     └ <function handle_message.<locals>.respond at 0x7f907e12fee0>
          │      │           │       └ None
          │      │           └ '你好'
          │      └ 'friend-******'
          └ <function handle_message.<locals>.wrap_request.<locals>.call at 0x7f907e0d6040>

  File "/home/app/app/chatgpt-mirai-qq-bot/universal.py", line 47, in call
    await m.handle_request(session_id, message, respond, conversation_context, n)
          │ │              │           │        │        │                     └ <function handle_message.<locals>.request at 0x7f907e12ff70>
          │ │              │           │        │        └ None
          │ │              │           │        └ <function handle_message.<locals>.respond at 0x7f907e12fee0>
          │ │              │           └ '你好'
          │ │              └ 'friend-******'
          │ └ <function MiddlewareTimeout.handle_request at 0x7f907eb10dc0>
          └ <middlewares.timeout.MiddlewareTimeout object at 0x7f908c1c7580>

  File "/home/app/app/chatgpt-mirai-qq-bot/middlewares/timeout.py", line 30, in handle_request
    await action(session_id, prompt, conversation_context, respond)
          │      │           │       │                     └ <function handle_message.<locals>.respond at 0x7f907e12fee0>
          │      │           │       └ None
          │      │           └ '你好'
          │      └ 'friend-******'
          └ <function handle_message.<locals>.request at 0x7f907e12ff70>

  File "/home/app/app/chatgpt-mirai-qq-bot/universal.py", line 114, in request
    async for rendered in task:
                          └ <async_generator object ConversationContext.ask at 0x7f907e0d65e0>

  File "/home/app/app/chatgpt-mirai-qq-bot/conversation.py", line 85, in ask
    async for item in self.adapter.ask(prompt):
                      │    │       │   └ '你好'
                      │    │       └ <function BingAdapter.ask at 0x7f907fa44f70>
                      │    └ <adapter.ms.bing.BingAdapter object at 0x7f907e9e6b80>
                      └ <conversation.ConversationContext object at 0x7f907e9e6a60>

> File "/home/app/app/chatgpt-mirai-qq-bot/adapter/ms/bing.py", line 46, in ask
    async for final, response in self.bot.ask_stream(prompt=prompt,
                                 │    │   │                 └ '你好'
                                 │    │   └ <function Chatbot.ask_stream at 0x7f907fe23dc0>
                                 │    └ <EdgeGPT.Chatbot object at 0x7f907e9e6b20>
                                 └ <adapter.ms.bing.BingAdapter object at 0x7f907e9e6b80>

  File "/home/app/.local/lib/python3.9/site-packages/EdgeGPT.py", line 295, in ask_stream
    async for response in self.chat_hub.ask_stream(
                          │    │        └ <function ChatHub.ask_stream at 0x7f907fe23af0>
                          │    └ <EdgeGPT.ChatHub object at 0x7f907e0d7730>
                          └ <EdgeGPT.Chatbot object at 0x7f907e9e6b20>
  File "/home/app/.local/lib/python3.9/site-packages/EdgeGPT.py", line 242, in ask_stream
    yield False, response["arguments"][0]["messages"][0][
                 └ {'type': 1, 'target': 'update', 'arguments': [{'requestId': '1a6c222b-900c-4c28-bb24-2b3eafa60a16', 'throttling': {'maxNumUse...

KeyError: 'messages'
2023-03-15 08:54:26.199 | DEBUG    | middlewares.timeout:handle_respond:42 - [Timeout] 取消计时……
2023-03-15 08:54:26.346 | INFO     | graia.ariadne.model:log:82 - ******: [SEND][~(******)] <- Bing 已结束本次会话。继续发送消息将重新开启一个新会话。

其他内容
昨天正常运行 早上发现报错 更新cookies依然报错

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"):

d4renk commented 1 year ago

上游依赖更新已解决 将requirements.txt里的EdgeGPT==0.0.55 改成EdgeGPT==0.0.56.2 在更新即可python3 -m pip install EdgeGPT --upgrade