lss233 / chatgpt-mirai-qq-bot

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

[BUG] exceptions.NoAvailableBotException: chatgpt-web #433

Closed TaoXiaoBai closed 1 year ago

TaoXiaoBai commented 1 year ago

提交 issue 前,请先确认:

表现
登陆以后向bot发送消息会提示ERROR:telegram.ext._application:No error handlers are registered, logging exception.

运行环境:

截图

> 2023-03-27 00:11:10.289 | ERROR    | config:scan_presets:356 - 检查预设:正常 <==> presets/default.txt [失败:文件不存在]
> 2023-03-27 00:11:10.296 | SUCCESS  | config:scan_presets:354 - 检查预设:猫娘 <==> presets/catgirl.txt [成功]
> 2023-03-27 00:11:10.304 | SUCCESS  | config:scan_presets:367 - 注册预设:bing <==> ./presets\assistant\bing.txt [成功]
> 2023-03-27 00:11:10.309 | SUCCESS  | config:scan_presets:367 - 注册预设:dan <==> ./presets\assistant\dan.txt [成功]
> 2023-03-27 00:11:10.316 | SUCCESS  | config:scan_presets:367 - 注册预设:debater <==> ./presets\assistant\debater.txt [ 成功]
> 2023-03-27 00:11:10.322 | SUCCESS  | config:scan_presets:367 - 注册预设:default <==> ./presets\assistant\default.txt [ 成功]
> 2023-03-27 00:11:10.328 | SUCCESS  | config:scan_presets:367 - 注册预设:kp <==> ./presets\assistant\kp.txt [成功]
> 2023-03-27 00:11:10.335 | SUCCESS  | config:scan_presets:367 - 注册预设:lawyer <==> ./presets\assistant\lawyer.txt [成 功]
> 2023-03-27 00:11:10.342 | SUCCESS  | config:scan_presets:367 - 注册预设:Lss233 <==> ./presets\assistant\Lss233.txt [成 功]
> 2023-03-27 00:11:10.348 | SUCCESS  | config:scan_presets:367 - 注册预设:novelist <==> ./presets\assistant\novelist.txt [成功]
> 2023-03-27 00:11:10.356 | SUCCESS  | config:scan_presets:367 - 注册预设:poet <==> ./presets\assistant\poet.txt [成功]
> 2023-03-27 00:11:10.365 | SUCCESS  | config:scan_presets:367 - 注册预设:shineisheji <==> ./presets\assistant\shineisheji.txt [成功]
> 2023-03-27 00:11:10.372 | SUCCESS  | config:scan_presets:367 - 注册预设:catgirl <==> ./presets\role-play\catgirl.txt [ 成功]
> 2023-03-27 00:11:10.384 | SUCCESS  | config:scan_presets:367 - 注册预设:crazy <==> ./presets\role-play\crazy.txt [成功]
> 2023-03-27 00:11:10.393 | SUCCESS  | config:scan_presets:367 - 注册预设:debatestick <==> ./presets\role-play\debatestick.txt [成功]
> 2023-03-27 00:11:10.403 | SUCCESS  | config:scan_presets:367 - 注册预设:dingzhen <==> ./presets\role-play\dingzhen.txt [成功]
> 2023-03-27 00:11:10.408 | SUCCESS  | config:scan_presets:367 - 注册预设:DJ <==> ./presets\role-play\DJ.txt [成功]
> 2023-03-27 00:11:10.417 | SUCCESS  | config:scan_presets:367 - 注册预设:ERNIE <==> ./presets\role-play\ERNIE.txt [成功]
> 2023-03-27 00:11:10.422 | SUCCESS  | config:scan_presets:367 - 注册预设:gaoqiqiang <==> ./presets\role-play\gaoqiqiang.txt [成功]
> 2023-03-27 00:11:10.432 | SUCCESS  | config:scan_presets:367 - 注册预设:hanli <==> ./presets\role-play\hanli.txt [成功]
> 2023-03-27 00:11:10.442 | SUCCESS  | config:scan_presets:367 - 注册预设:huxijin <==> ./presets\role-play\huxijin.txt [ 成功]
> 2023-03-27 00:11:10.457 | SUCCESS  | config:scan_presets:367 - 注册预设:ikun <==> ./presets\role-play\ikun.txt [成功]
> 2023-03-27 00:11:10.467 | SUCCESS  | config:scan_presets:367 - 注册预设:MOSS <==> ./presets\role-play\MOSS.txt [成功]
> 2023-03-27 00:11:10.478 | SUCCESS  | config:scan_presets:367 - 注册预设:welldone <==> ./presets\role-play\welldone.txt [成功]
> 2023-03-27 00:11:10.494 | SUCCESS  | config:scan_presets:367 - 注册预设:zhangweiwei <==> ./presets\role-play\zhangweiwei.txt [成功]
> 2023-03-27 00:11:10.508 | ERROR    | config:scan_presets:364 - 注册预设:dan <==> ./presets\utils\dan.txt [失败:关键词 已存在]
> 2023-03-27 00:11:10.522 | ERROR    | config:scan_presets:364 - 注册预设:catgirl <==> ./presets\catgirl.txt [失败:关键 词已存在]
> 2023-03-27 00:11:10.536 | SUCCESS  | config:scan_presets:367 - 注册预设:issue402 <==> ./presets\issue402.txt [成功]
> 2023-03-27 00:11:10.548 | SUCCESS  | config:scan_presets:367 - 注册预设:预设模板 <==> ./presets\预设模板.txt [成功]
> 2023-03-27 00:11:10.560 | INFO     | __main__:<module>:13 - 检测到 telegram 配置,将以 telegram bot 模式启动……
> 2023-03-27 00:11:15.365 | INFO     | manager.bot:__check_proxy:233 - [代理测试] 正在检查代理配置:http://127.0.0.1:59457
> 2023-03-27 00:11:16.972 | SUCCESS  | manager.bot:__check_proxy:241 - [代理测试] 连接成功!
> 2023-03-27 00:11:16.979 | INFO     | manager.bot:login_bing:123 - 正在解析第 1 个 Bing 账号
> 2023-03-27 00:11:16.990 | SUCCESS  | manager.bot:login_bing:128 - 解析成功!
> 2023-03-27 00:11:17.001 | SUCCESS  | manager.bot:login_bing:134 - 成功解析 1/1 个 Bing 账号!
> 2023-03-27 00:11:17.013 | INFO     | manager.bot:login_yiyan:153 - 正在解析第 1 个 文心一言 账号
> 2023-03-27 00:11:17.026 | SUCCESS  | manager.bot:login_yiyan:158 - 解析成功!
> 2023-03-27 00:11:17.033 | SUCCESS  | manager.bot:login_yiyan:164 - 成功解析 1/1 个 文心一言 账号!
> 2023-03-27 00:11:17.046 | INFO     | manager.bot:login:105 - AI 类型:chatgpt-web - 可用账号: 0 个
> 2023-03-27 00:11:17.056 | INFO     | manager.bot:login:105 - AI 类型:openai-api - 可用账号: 0 个
> 2023-03-27 00:11:17.070 | INFO     | manager.bot:login:105 - AI 类型:bing-cookie - 可用账号: 1 个
> 2023-03-27 00:11:17.079 | INFO     | manager.bot:login:105 - AI 类型:bard-cookie - 可用账号: 0 个
> 2023-03-27 00:11:17.084 | INFO     | manager.bot:login:105 - AI 类型:yiyan-cookie - 可用账号: 1 个
> 2023-03-27 00:11:17.092 | INFO     | platforms.telegram_bot:bootstrap:96 - 启动完毕,接收消息中……
> ERROR:telegram.ext._application:No error handlers are registered, logging exception.
> Traceback (most recent call last):
>   File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\ext\_application.py", line 1115, in process_update
>     await coroutine
>   File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\ext\_handler.py", line 141, in handle_update
>     return await self.callback(update, context)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "I:\tgbot\chatgpt\platforms\telegram_bot.py", line 49, in on_message
>     await handle_message(
>   File "I:\tgbot\chatgpt\universal.py", line 50, in handle_message
>     conversation_handler.current_conversation = await conversation_handler.create(
>                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "I:\tgbot\chatgpt\conversation.py", line 227, in create
>     conversation = ConversationContext(_type, self.session_id)
>                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "I:\tgbot\chatgpt\conversation.py", line 63, in __init__
>     self.adapter = ChatGPTWebAdapter(self.session_id)
>                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "I:\tgbot\chatgpt\adapter\chatgpt\web.py", line 32, in __init__
>     self.bot = botManager.pick('chatgpt-web')
>                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "I:\tgbot\chatgpt\manager\bot.py", line 371, in pick
>     raise NoAvailableBotException(type)
> exceptions.NoAvailableBotException: chatgpt-web
> ERROR:telegram.ext._application:No error handlers are registered, logging exception.
> Traceback (most recent call last):
>   File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\ext\_application.py", line 1115, in process_update
>     await coroutine
>   File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\ext\_handler.py", line 141, in handle_update
>     return await self.callback(update, context)
>            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "I:\tgbot\chatgpt\platforms\telegram_bot.py", line 49, in on_message
>     await handle_message(
>   File "I:\tgbot\chatgpt\universal.py", line 50, in handle_message
>     conversation_handler.current_conversation = await conversation_handler.create(
>                                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "I:\tgbot\chatgpt\conversation.py", line 227, in create
>     conversation = ConversationContext(_type, self.session_id)
>                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "I:\tgbot\chatgpt\conversation.py", line 63, in __init__
>     self.adapter = ChatGPTWebAdapter(self.session_id)
>                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "I:\tgbot\chatgpt\adapter\chatgpt\web.py", line 32, in __init__
>     self.bot = botManager.pick('chatgpt-web')
>                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File "I:\tgbot\chatgpt\manager\bot.py", line 371, in pick
>     raise NoAvailableBotException(type)
> exceptions.NoAvailableBotException: chatgpt-web

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

lss233 commented 1 year ago

如果你想只使用文心一言,参考 README 设置一下 default_ai 为 yiyan。

TaoXiaoBai commented 1 year ago

如果你想只使用文心一言,参考 README 设置一下 default_ai 为 yiyan。

我是想默认使用new bing,当我把default_ai切换到bing-b的时候,日志是这样的```

`2023-03-27 00:58:16.497 | INFO     | platforms.telegram_bot:bootstrap:96 - 启动完毕,接收消息中……
ERROR:telegram.ext._updater:Error while getting Updates: httpx.ConnectError:
ERROR:telegram.ext._updater:Exception happened while polling for updates.
Traceback (most recent call last):
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\anyio\streams\tls.py", line 130, in _call_sslobject_method
    result = func(*args)
             ^^^^^^^^^^^
  File "ssl.py", line 979, in do_handshake
ssl.SSLSyscallError: Some I/O error occurred (_ssl.c:992)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpcore\_exceptions.py", line 10, in map_exceptions
    yield
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpcore\backends\asyncio.py", line 78, in start_tls
    raise exc
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpcore\backends\asyncio.py", line 69, in start_tls
    ssl_stream = await anyio.streams.tls.TLSStream.wrap(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\anyio\streams\tls.py", line 122, in wrap
    await wrapper._call_sslobject_method(ssl_object.do_handshake)
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\anyio\streams\tls.py", line 151, in _call_sslobject_method
    raise BrokenResourceError from exc
anyio.BrokenResourceError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpx\_transports\default.py", line 60, in map_httpcore_exceptions
    yield
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpx\_transports\default.py", line 353, in handle_async_request
    resp = await self._pool.handle_async_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpcore\_async\connection_pool.py", line 253, in handle_async_request
    raise exc
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpcore\_async\connection_pool.py", line 237, in handle_async_request
    response = await connection.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpcore\_async\http_proxy.py", line 289, in handle_async_request
    stream = await stream.start_tls(**kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpcore\backends\asyncio.py", line 66, in start_tls
    with map_exceptions(exc_map):
  File "contextlib.py", line 155, in __exit__
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpcore\_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc)
httpcore.ConnectError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\request\_httpxrequest.py", line 216, in do_request
    res = await self._client.request(
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpx\_client.py", line 1533, in request
    return await self.send(request, auth=auth, follow_redirects=follow_redirects)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpx\_client.py", line 1620, in send
    response = await self._send_handling_auth(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpx\_client.py", line 1648, in _send_handling_auth
    response = await self._send_handling_redirects(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpx\_client.py", line 1685, in _send_handling_redirects
    response = await self._send_single_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpx\_client.py", line 1722, in _send_single_request
    response = await transport.handle_async_request(request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpx\_transports\default.py", line 352, in handle_async_request
    with map_httpcore_exceptions():
  File "contextlib.py", line 155, in __exit__
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\httpx\_transports\default.py", line 77, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\ext\_updater.py", line 607, in _network_loop_retry
    if not await action_cb():
           ^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\ext\_updater.py", line 335, in polling_action_cb
    raise exc
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\ext\_updater.py", line 320, in polling_action_cb
    updates = await self.bot.get_updates(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\ext\_extbot.py", line 530, in get_updates
    updates = await super().get_updates(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\_bot.py", line 368, in decorator
    result = await func(*args, **kwargs)  # skipcq: PYL-E1102
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\_bot.py", line 3623, in get_updates
    await self._post(
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\_bot.py", line 456, in _post
    return await self._do_post(
           ^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\ext\_extbot.py", line 312, in _do_post
    return await super()._do_post(
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\_bot.py", line 487, in _do_post
    return await request.post(
           ^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\request\_baserequest.py", line 165, in post
    result = await self._request_wrapper(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\request\_baserequest.py", line 288, in _request_wrapper
    raise exc

File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\request_baserequest.py", line 274, in _request_wrapper code, payload = await self.do_request( ^^^^^^^^^^^^^^^^^^^^^^ File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\request_httpxrequest.py", line 240, in do_request raise NetworkError(f"httpx.{err.class.name}: {err}") from err telegram.error.NetworkError: httpx.ConnectError:`

lss233 commented 1 year ago

你这个就是单纯的网络问题了。 换个好点的梯子吧

TaoXiaoBai commented 1 year ago

你这个就是单纯的网络问题了。 换个好点的梯子吧

尝试更换以后log是这样```

2023-03-27 01:12:45.950 | INFO | platforms.telegram_bot:bootstrap:96 - 启动完毕,接收消息中…… ERROR:telegram.ext._application:No error handlers are registered, logging exception. Traceback (most recent call last): File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\ext_application.py", line 1115, in process_update await coroutine File "I:\tgbot\chatgpt\python3.11\Lib\site-packages\telegram\ext_handler.py", line 141, in handle_update return await self.callback(update, context) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "I:\tgbot\chatgpt\platforms\telegram_bot.py", line 49, in on_message await handle_message( File "I:\tgbot\chatgpt\universal.py", line 50, in handle_message conversation_handler.current_conversation = await conversation_handler.create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "I:\tgbot\chatgpt\conversation.py", line 227, in create conversation = ConversationContext(_type, self.session_id) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "I:\tgbot\chatgpt\conversation.py", line 71, in init self.adapter = BingAdapter(self.session_id, ConversationStyle.balanced) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "I:\tgbot\chatgpt\adapter\ms\bing.py", line 30, in init name, value = line.split("=", 1) ^^^^^^^^^^^ ValueError: not enough values to unpack (expected 2, got 1)

lss233 commented 1 year ago

估计是你cookie有问题,读取的时候出错了。

TaoXiaoBai commented 1 year ago

估计是你cookie有问题,读取的时候出错了。

感谢,应该是cookie出问题了,刚刚试了下api可以用,我白天再试试new bing。