lss233 / chatgpt-mirai-qq-bot

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

[BUG] Bing画图报错 'Chatbot' object has no attribute 'cookies' #927

Closed lsCoding666 closed 1 year ago

lsCoding666 commented 1 year ago

提交 issue 前,请先确认:

表现
画图报错 机器人返回:画图失败!原因: 'Chatbot' object has no attribute 'cookies' cookie没有过期,发现还能进行 bing对话 https://bing.com/create能正常画图

日志:

2023-06-07 02:10:03.525 | INFO     | platforms.http_service:construct_bot_request:174 - Get message from friend-liang2shuang3[liang2shuang3]:
画 cat
2023-06-07 02:10:03.526 | DEBUG    | platforms.http_service:process_request:101 - Start to process bot request 1686103803526.
2023-06-07 02:10:03.526 | DEBUG    | middlewares.concurrentlock:handle_request:40 - [Concurrent] 排队中,前面还有 0 个人!
2023-06-07 02:10:03.526 | DEBUG    | middlewares.concurrentlock:handle_request:42 - [Concurrent] 排到了!
INFO:quart.serving:130.162.139.153:47262 POST /v2/chat 1.1 200 13 2318
[2023-06-07 02:10:03,528] 130.162.139.153:47262 POST /v2/chat 1.1 200 13 2318
2023-06-07 02:10:03.528 | DEBUG    | middlewares.timeout:create_timeout_task:55 - [Timeout] 开始计时……
2023-06-07 02:10:03.528 | DEBUG    | adapter.ms.bing:text_to_img:129 - [Bing Image] Prompt:  cat
2023-06-07 02:10:03.529 | ERROR    | universal:handle_message:271 - 
Traceback (most recent call last):
  File "/app/conversation.py", line 173, in ask
    images = await self.drawing_adapter.text_to_img(prompt)
                   │    │               │           └ ' cat'
                   │    │               └ <function BingAdapter.text_to_img at 0xffff7e415080>
                   │    └ <adapter.ms.bing.BingAdapter object at 0xffff6318b150>
                   └ <conversation.ConversationContext object at 0xffff6319ad10>
  File "/app/adapter/ms/bing.py", line 143, in text_to_img
    raise e
  File "/app/adapter/ms/bing.py", line 132, in text_to_img
    next((cookie['value'] for cookie in self.bot.cookies if cookie['name'] == '_U'), None),
                                        │    └ <EdgeGPT.Chatbot object at 0xffff63166290>
                                        └ <adapter.ms.bing.BingAdapter object at 0xffff6318b150>
AttributeError: 'Chatbot' object has no attribute 'cookies'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/app/bot.py", line 54, in <module>
    loop.run_until_complete(asyncio.gather(*bots))
    │    │                  │       │       └ [<Task pending name='Task-2' coro=<start_task() running at /app/platforms/http_service.py:185> wait_for=<_GatheringFuture pen...
    │    │                  │       └ <function gather at 0xffffb422c5e0>
    │    │                  └ <module 'asyncio' from '/usr/local/lib/python3.11/asyncio/__init__.py'>
    │    └ <function BaseEventLoop.run_until_complete at 0xffffb42413a0>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete
    self.run_forever()
    │    └ <function BaseEventLoop.run_forever at 0xffffb4241300>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 607, in run_forever
    self._run_once()
    │    └ <function BaseEventLoop._run_once at 0xffffb4243100>
    └ <_UnixSelectorEventLoop running=True closed=False debug=False>
  File "/usr/local/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once
    handle._run()
    │      └ <function Handle._run at 0xffffb47b4040>
    └ <Handle Task.task_wakeup(<Future finished result=None>)>
  File "/usr/local/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
    │    │            │    │           │    └ <member '_args' of 'Handle' objects>
    │    │            │    │           └ <Handle Task.task_wakeup(<Future finished result=None>)>
    │    │            │    └ <member '_callback' of 'Handle' objects>
    │    │            └ <Handle Task.task_wakeup(<Future finished result=None>)>
    │    └ <member '_context' of 'Handle' objects>
    └ <Handle Task.task_wakeup(<Future finished result=None>)>
  File "/app/platforms/http_service.py", line 106, in process_request
    await handle_message(
          └ <function handle_message at 0xffff7e416ca0>
> File "/app/universal.py", line 269, in handle_message
    await action(session_id, message.strip(), conversation_context, respond)
          │      │           │       │        │                     └ <function handle_message.<locals>.respond at 0xffff7c5af880>
          │      │           │       │        └ None
          │      │           │       └ <method 'strip' of 'str' objects>
          │      │           └ '画 cat'
          │      └ 'friend-liang2shuang3'
          └ <function handle_message.<locals>.wrap_request.<locals>.call at 0xffff7c5adbc0>
  File "/app/universal.py", line 53, in call
    await m.handle_request(session_id, message, respond, conversation_context, n)
          │ │              │           │        │        │                     └ <function handle_message.<locals>.wrap_request.<locals>.call at 0xffff7c5ac040>
          │ │              │           │        │        └ None
          │ │              │           │        └ <function handle_message.<locals>.respond at 0xffff7c5af880>
          │ │              │           └ '画 cat'
          │ │              └ 'friend-liang2shuang3'
          │ └ <function MiddlewareConcurrentLock.handle_request at 0xffff7dc55ee0>
          └ <middlewares.concurrentlock.MiddlewareConcurrentLock object at 0xffff7e906b10>
  File "/app/middlewares/concurrentlock.py", line 43, in handle_request
    await action(session_id, prompt, conversation_context, respond)
          │      │           │       │                     └ <function handle_message.<locals>.respond at 0xffff7c5af880>
          │      │           │       └ None
          │      │           └ '画 cat'
          │      └ 'friend-liang2shuang3'
          └ <function handle_message.<locals>.wrap_request.<locals>.call at 0xffff7c5ac040>
  File "/app/universal.py", line 53, in call
    await m.handle_request(session_id, message, respond, conversation_context, n)
          │ │              │           │        │        │                     └ <function handle_message.<locals>.wrap_request.<locals>.call at 0xffff7c5adb20>
          │ │              │           │        │        └ None
          │ │              │           │        └ <function handle_message.<locals>.respond at 0xffff7c5af880>
          │ │              │           └ '画 cat'
          │ │              └ 'friend-liang2shuang3'
          │ └ <function Middleware.handle_request at 0xffff7dc55580>
          └ <middlewares.baiducloud.MiddlewareBaiduCloud object at 0xffff7dc4abd0>
  File "/app/middlewares/middleware.py", line 9, in handle_request
    await action(session_id, prompt, conversation_context, respond)
          │      │           │       │                     └ <function handle_message.<locals>.respond at 0xffff7c5af880>
          │      │           │       └ None
          │      │           └ '画 cat'
          │      └ 'friend-liang2shuang3'
          └ <function handle_message.<locals>.wrap_request.<locals>.call at 0xffff7c5adb20>
  File "/app/universal.py", line 53, in call
    await m.handle_request(session_id, message, respond, conversation_context, n)
          │ │              │           │        │        │                     └ <function handle_message.<locals>.wrap_request.<locals>.call at 0xffff7c5ae700>
          │ │              │           │        │        └ None
          │ │              │           │        └ <function handle_message.<locals>.respond at 0xffff7c5af880>
          │ │              │           └ '画 cat'
          │ │              └ 'friend-liang2shuang3'
          │ └ <function MiddlewareRatelimit.handle_request at 0xffff7dc56160>
          └ <middlewares.ratelimit.MiddlewareRatelimit object at 0xffff7dc4ae90>
  File "/app/middlewares/ratelimit.py", line 23, in handle_request
    await action(session_id, prompt, conversation_context, respond)
          │      │           │       │                     └ <function handle_message.<locals>.respond at 0xffff7c5af880>
          │      │           │       └ None
          │      │           └ '画 cat'
          │      └ 'friend-liang2shuang3'
          └ <function handle_message.<locals>.wrap_request.<locals>.call at 0xffff7c5ae700>
  File "/app/universal.py", line 53, in call
    await m.handle_request(session_id, message, respond, conversation_context, n)
          │ │              │           │        │        │                     └ <function handle_message.<locals>.request at 0xffff7c5ae8e0>
          │ │              │           │        │        └ None
          │ │              │           │        └ <function handle_message.<locals>.respond at 0xffff7c5af880>
          │ │              │           └ '画 cat'
          │ │              └ 'friend-liang2shuang3'
          │ └ <function MiddlewareTimeout.handle_request at 0xffff7dc562a0>
          └ <middlewares.timeout.MiddlewareTimeout object at 0xffff7ed27c50>
  File "/app/middlewares/timeout.py", line 27, in handle_request
    await asyncio.wait_for(coro_task, config.response.max_timeout)
          │       │        │          │      │        └ 600.0
          │       │        │          │      └ Response(mode='text', buffer_delay=15.0, default_ai='chatgpt-api', error_format='出现故障!如果这个问题持续出现,请和我说“重置会话” 来开启一段新的会话,或者发送 “回...
          │       │        │          └ <unprintable Config object>
          │       │        └ <Task finished name='Task-12145' coro=<handle_message.<locals>.request() done, defined at /app/universal.py:107> exception=Dr...
          │       └ <function wait_for at 0xffffb422c040>
          └ <module 'asyncio' from '/usr/local/lib/python3.11/asyncio/__init__.py'>
  File "/usr/local/lib/python3.11/asyncio/tasks.py", line 479, in wait_for
    return fut.result()
           │   └ <method 'result' of '_asyncio.Task' objects>
           └ <Task finished name='Task-12145' coro=<handle_message.<locals>.request() done, defined at /app/universal.py:107> exception=Dr...
  File "/app/universal.py", line 222, in request
    async for rendered in task:
                          └ <async_generator object retry.<locals>.decorator.<locals>.wrapper at 0xffff7dc31cc0>
  File "/app/utils/retry.py", line 21, in wrapper
    async for result in func(*args, **kwargs):
                        │     │       └ {'prompt': '画 cat', 'chain': MessageChain([Plain(text='Unsupported')]), 'name': 'liang2shuang3'}
                        │     └ (<conversation.ConversationContext object at 0xffff6319ad10>,)
                        └ <function ConversationContext.ask at 0xffff7dc54b80>
  File "/app/conversation.py", line 177, in ask
    raise DrawingFailedException from e
          └ <class 'exceptions.DrawingFailedException'>
exceptions.DrawingFailedException
2023-06-07 02:10:03.535 | INFO     | platforms.http_service:response:86 - Got response msg -> <class 'str'> -> 画图失败!原因: 'Chatbot' object has no attribute 'cookies'
lsCoding666 commented 1 year ago

补充:更换 cookie无效。

lsCoding666 commented 1 year ago

我怀疑是 docker镜像的问题。一天前更新了 docker镜像 @lss233

lsCoding666 commented 1 year ago
image

我回退下试试

lsCoding666 commented 1 year ago

已经解决 最新版本的 docker镜像有问题 回退到 v2.5.1后正常 请作者关注下修复

zhufenglu666 commented 1 year ago

如何回退,

zhufenglu666 commented 1 year ago

已经解决 最新版本的 docker镜像有问题 回退到 v2.5.1后正常 请作者关注下修复

如何装旧版本

G37H9 commented 1 year ago

已经解决 最新版本的 docker镜像有问题 回退到 v2.5.1后正常 请作者关注下修复

如何装旧版本

兄弟 问题解决了吗

lss233 commented 1 year ago

最新镜像修复

lss233 commented 1 year ago

released