A-kirami / nonebot-plugin-chatgpt

MIT License
319 stars 37 forks source link

[BUG]: 无法私聊使用管理命令 #94

Open yyk725 opened 1 year ago

yyk725 commented 1 year ago

报告清单

影响版本

3ecfec8

问题描述

无法在私聊中使用任何管理命令,包括以下表格内所有指令,对话可正常进行 image

复现步骤

向机器人发送管理命令,例如:刷新会话

预期行为

正常应回复“当前会话已刷新”

实际行为

qq无回复,日志中报错

日志信息

12-20 15:43:21 [SUCCESS] nonebot | OneBot V11 3255414965 | [message.private.friend]: Message 724509116 from 2901136436 "刷新会话" 12-20 15:43:21 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_chatgpt) 12-20 15:43:21 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_chatgpt) running complete 12-20 15:43:21 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_chatgpt) failed. Traceback (most recent call last): File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 196, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\runpy.py", line 86, in _run_code exec(code, run_globals) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\Scripts\nb.exe__main.py", line 7, in sys.exit(main()) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1130, in call return self.main(*args, kwargs) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1055, in main rv = self.invoke(ctx) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1657, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\click\core.py", line 760, in invoke return callback(*args, *kwargs) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\nb_cli\commands\main.py", line 30, in run run_bot(file, app) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\nb_cli\handlers\deploy.py", line 25, in run_bot nonebot.run(app=f"{module_name}:{app}") File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot__init__.py", line 273, in run get_driver().run(args, *kwargs) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\drivers\fastapi.py", line 172, in run uvicorn.run( File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\main.py", line 569, in run server.run() File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\uvicorn\server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 628, in run_until_complete self.run_forever() File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 316, in run_forever super().run_forever() File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 595, in run_forever self._run_once() File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1881, in _run_once handle._run() File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, self._args) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\message.py", line 142, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)

File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\message.py", line 188, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\internal\matcher\matcher.py", line 727, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\internal\matcher\matcher.py", line 702, in simple_run await handler( File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot\dependencies__init.py", line 108, in call return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot_plugin_chatgpt__init__.py", line 91, in refresh_conversation del session[event] File "C:\Users\Ivan\AppData\Local\Programs\Python\Python310\lib\site-packages\nonebot_plugin_chatgpt\utils.py", line 103, in delitem return super().delitem__(self.id(event)) KeyError: '2901136436'

额外补充

No response

A-kirami commented 1 year ago

除了刷新会话之外,其他指令是否有错误日志

yyk725 commented 1 year ago

日志没有报错,只有收到消息的通知而没有响应