A-kirami / nonebot-plugin-chatgpt

MIT License
319 stars 37 forks source link

[BUG]: 出现错误TypeError: expected string or bytes-like object #115

Open chung1912 opened 1 year ago

chung1912 commented 1 year ago

报告清单

影响版本

v0.7.4

问题描述

02-15 11:01:34 [INFO] nonebot | Matcher(type='message', module=nonebot_plugin_chatgpt.utils) running complete 02-15 11:01:34 [ERROR] nonebot | Running Matcher(type='message', module=nonebot_plugin_chatgpt.utils) failed. Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.10/multiprocessing/spawn.py", line 116, in spawn_main exitcode = _main(fd, parent_sentinel) File "/usr/local/lib/python3.10/multiprocessing/spawn.py", line 129, in _main return self._bootstrap(parent_sentinel) File "/usr/local/lib/python3.10/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/local/lib/python3.10/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.10/site-packages/uvicorn/subprocess.py", line 76, in subprocess_started target(sockets=sockets) File "/usr/local/lib/python3.10/site-packages/uvicorn/server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 141, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)

File "/usr/local/lib/python3.10/site-packages/nonebot/message.py", line 187, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 732, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "/usr/local/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 707, in simple_run await handler( File "/usr/local/lib/python3.10/site-packages/nonebot/dependencies/init.py", line 108, in call return await cast(Callable[..., Awaitable[R]], self.call)(values) File "/usr/local/lib/python3.10/site-packages/nonebot_plugin_chatgpt/init.py", line 66, in ai_chat msg = await chat_bot(session[event]).get_chat_response(text) File "/usr/local/lib/python3.10/site-packages/nonebot_plugin_chatgpt/chatgpt.py", line 172, in get_chat_response f"非预期的响应内容: HTTP{response.status} {escape_tag(response.text)}" File "/usr/local/lib/python3.10/site-packages/nonebot/utils.py", line 51, in escape_tag return re.sub(r"</?((?:[fb]g\s)?[^<>\s]*)>", r"\\g<0>", s) File "/usr/local/lib/python3.10/re.py", line 209, in sub return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or bytes-like object

复现步骤

使用CHATGPT_SESSION_TOKEN配置,使用时出现如上错误

预期行为

No response

实际行为

No response

日志信息

No response

额外补充

No response