Harry-Jing / nonebot-plugin-bing-chat

一个可以使用新版Bing进行聊天的NoneBot插件
GNU General Public License v3.0
168 stars 12 forks source link

无法正常连续会话 #33

Closed Arymodu closed 1 year ago

Arymodu commented 1 year ago

只有第一次开始对话会正常回复,之后继续使用指令对话和回复均出现以下回复信息:

<无法询问,如果出现多次请试刷新> Cannot write to closing transport

不过刷新后开启的是新一轮会话。

其中使用指令对话的报错信息如下:

[ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_bing_chat.common.utils) failed.
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 116, in spawn_main
    exitcode = _main(fd, parent_sentinel)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\multiprocessing\spawn.py", line 129, in _main
    return self._bootstrap(parent_sentinel)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 314, in _bootstrap
    self.run()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\multiprocessing\process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "F:\Bot\.venv\lib\site-packages\nonebot_plugin_reboot\reloader.py", line 27, in _run
    _nb_run(*args, **kwargs)
  File "F:\Bot\.venv\lib\site-packages\nonebot\__init__.py", line 273, in run
    get_driver().run(*args, **kwargs)
  File "F:\Bot\.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 187, in run
    uvicorn.run(
  File "F:\Bot\.venv\lib\site-packages\uvicorn\main.py", line 569, in run
    server.run()
  File "F:\Bot\.venv\lib\site-packages\uvicorn\server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete
    self.run_forever()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever
    super().run_forever()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever
    self._run_once()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1909, in _run_once
    handle._run()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "F:\Bot\.venv\lib\site-packages\nonebot\message.py", line 141, in _check_matcher
    await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
> File "F:\Bot\.venv\lib\site-packages\nonebot\message.py", line 187, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "F:\Bot\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 732, in run
    await self.simple_run(bot, event, state, stack, dependency_cache)
  File "F:\Bot\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 707, in simple_run
    await handler(
  File "F:\Bot\.venv\lib\site-packages\nonebot\dependencies\__init__.py", line 108, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "F:\Bot\.venv\lib\site-packages\nonebot_plugin_bing_chat\onebotv11\main.py", line 110, in bingchat_command_chat
    raise exc
  File "F:\Bot\.venv\lib\site-packages\nonebot_plugin_bing_chat\onebotv11\main.py", line 101, in bingchat_command_chat
    response = await chatbot.ask(
  File "F:\Bot\.venv\lib\site-packages\EdgeGPT.py", line 327, in ask
    async for final, response in self.chat_hub.ask_stream(
  File "F:\Bot\.venv\lib\site-packages\EdgeGPT.py", line 268, in ask_stream
    await self.wss.send_str(append_identifier(self.request.struct))
  File "F:\Bot\.venv\lib\site-packages\aiohttp\client_ws.py", line 151, in send_str
    await self._writer.send(data, binary=False, compress=compress)
  File "F:\Bot\.venv\lib\site-packages\aiohttp\http_websocket.py", line 690, in send
    await self._send_frame(message, WSMsgType.TEXT, compress)
  File "F:\Bot\.venv\lib\site-packages\aiohttp\http_websocket.py", line 601, in _send_frame
    raise ConnectionResetError("Cannot write to closing transport")
ConnectionResetError: Cannot write to closing transport

使用回复对话的报错和上一个Issue相同。

不太清楚怎么解决,gocqhttp也没有更新。 话说这和new bing开放有关系么,我就是看到开放来接入bot了(x

Yiyoki commented 1 year ago

旧版本的会在finally把对话关闭掉,新版本的插件已经解决,更新插件版本即可

Harry-Jing commented 1 year ago

我刚才看了一下,是依赖的问题,我会提交pr

Harry-Jing commented 1 year ago

请更新插件到 v0.6.5