A-kirami / nonebot-plugin-chatgpt

MIT License
319 stars 37 forks source link

[BUG]: Error refreshing session #125

Open JackTvT opened 1 year ago

JackTvT commented 1 year ago

报告清单

影响版本

v0.7.4

问题描述

能正常收到消息,但是会报错Error refreshing session,尝试使用重新配置chatgpt_session_token,使用账号密码,都没有解决

复现步骤

正常运行,@QQ机器人发送消息

预期行为

返回想要的消息

实际行为

No response

日志信息

02-21 21:13:54 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_chatgpt) failed. Traceback (most recent call last): File "/data/data/com.termux/files/home/software/QQbot/.venv/lib/python3.11/site-packages/nonebot_plugin_chatgpt/chatgpt.py", line 97, in refresh_session self.authorization = response.json()["accessToken"] File "/data/data/com.termux/files/home/software/QQbot/.venv/lib/python3.11/site-packages/httpx/_models.py", line 756, in json return jsonlib.loads(self.text, **kwargs) File "/data/data/com.termux/files/usr/lib/python3.11/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/data/data/com.termux/files/usr/lib/python3.11/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/data/data/com.termux/files/usr/lib/python3.11/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

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

Traceback (most recent call last): File "", line 17, in File "/data/data/com.termux/files/home/software/QQbot/.venv/lib/python3.11/site-packages/nonebot/init.py", line 273, in run get_driver().run(*args, *kwargs) File "/data/data/com.termux/files/home/software/QQbot/.venv/lib/python3.11/site-packages/nonebot/drivers/fastapi.py", line 187, in run uvicorn.run( File "/data/data/com.termux/files/home/software/QQbot/.venv/lib/python3.11/site-packages/uvicorn/main.py", line 569, in run server.run() File "/data/data/com.termux/files/home/software/QQbot/.venv/lib/python3.11/site-packages/uvicorn/server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "/data/data/com.termux/files/usr/lib/python3.11/asyncio/runners.py", line 190, in run return runner.run(main) File "/data/data/com.termux/files/usr/lib/python3.11/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) File "/data/data/com.termux/files/usr/lib/python3.11/asyncio/base_events.py", line 640, in run_until_complete self.run_forever() File "/data/data/com.termux/files/usr/lib/python3.11/asyncio/base_events.py", line 607, in run_forever self._run_once() File "/data/data/com.termux/files/usr/lib/python3.11/asyncio/base_events.py", line 1922, in _run_once handle._run() File "/data/data/com.termux/files/usr/lib/python3.11/asyncio/events.py", line 80, in _run self._context.run(self._callback, self._args) File "/data/data/com.termux/files/home/software/QQbot/.venv/lib/python3.11/site-packages/nonebot/message.py", line 141, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)

File "/data/data/com.termux/files/home/software/QQbot/.venv/lib/python3.11/site-packages/nonebot/message.py", line 187, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "/data/data/com.termux/files/home/software/QQbot/.venv/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 732, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "/data/data/com.termux/files/home/software/QQbot/.venv/lib/python3.11/site-packages/nonebot/internal/matcher/matcher.py", line 707, in simple_run await handler( File "/data/data/com.termux/files/home/software/QQbot/.venv/lib/python3.11/site-packages/nonebot/dependencies/init.py", line 108, in call return await cast(Callable[..., Awaitable[R]], self.call)(values) File "/data/data/com.termux/files/home/software/QQbot/.venv/lib/python3.11/site-packages/nonebot_plugin_chatgpt/init.py", line 50, in ai_chat msg = await chat_bot(session[session_id]).get_chat_response(text) File "/data/data/com.termux/files/home/software/QQbot/.venv/lib/python3.11/site-packages/nonebot_plugin_chatgpt/chatgpt.py", line 64, in get_chat_response await self.refresh_session() File "/data/data/com.termux/files/home/software/QQbot/.venv/lib/python3.11/site-packages/nonebot_plugin_chatgpt/chatgpt.py", line 99, in refresh_session raise RuntimeError("Error refreshing session") from e RuntimeError: Error refreshing session

额外补充

No response

JackTvT commented 1 year ago

以上有误,实际影响版本为从nonebot官方商店下载的0.2.2版,github直接拉v0.7.4源码报错找不到playwright模块(我用的手机Termux终端arm架构),,,整了几天了求解