A-kirami / nonebot-plugin-chatgpt

MIT License
321 stars 37 forks source link

[BUG]: 错误信息:Verify you are human,应该怎么解决 #114

Open chung1912 opened 1 year ago

chung1912 commented 1 year ago

报告清单

影响版本

v0.7.4

问题描述

02-14 12:25:46 [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 126, in get_chat_response await self.get_cf_cookies(page) File "/usr/local/lib/python3.10/site-packages/nonebot_plugin_chatgpt/chatgpt.py", line 232, in get_cf_cookies button = page.get_by_role("button", name="Verify you are human") AttributeError: 'Page' object has no attribute 'get_by_role'

复现步骤

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

预期行为

No response

实际行为

No response

日志信息

No response

额外补充

No response

chung1912 commented 1 year ago

只出现几次吗

每次都这样,没有成功过

525716612 commented 1 year ago

image 你把chatgpt.py第55行的这个headless=True改成headless=False,然后重启用一下他会显示出它模拟打开浏览器做的步骤,看看他干了什么,卡在哪了

image 我也遇到这个问题 具体报错是在这里

525716612 commented 1 year ago

我的已经解决了 是因为playwright没装 而且默认浏览器启动的chrome 但是chatGPT回复永远都是超时

KnightKilito commented 1 year ago

一样,我装了playwright,我也试着替换了@CCYellowStar pr的更改后的chatgpt.py文件,但是还是报错。 服务器Ubuntu,在洛杉矶应该也用不着梯子。感觉就是CF的人机校验拦住了。

03-11 19:31:08 [INFO] nonebot | Event will be handled by Matcher(type='message', module=plugins.mute)
03-11 19:31:08 [INFO] nonebot | Event will be handled by Matcher(type='message', module=plugins.black_word)
03-11 19:31:08 [INFO] nonebot | Event will be handled by Matcher(type='message', module=basic_plugins.chat_history.chat_message)
03-11 19:31:08 [INFO] nonebot | Matcher(type='message', module=plugins.mute) running complete
03-11 19:31:08 [INFO] nonebot | Event will be handled by Matcher(type='message', module=plugins.parse_bilibili_json)
03-11 19:31:08 [INFO] nonebot | Matcher(type='message', module=plugins.black_word) running complete
03-11 19:31:08 [INFO] nonebot | Matcher(type='message', module=plugins.parse_bilibili_json) running complete
03-11 19:31:08 [INFO] nonebot | Matcher(type='message', module=basic_plugins.chat_history.chat_message) running complete
03-11 19:31:08 [INFO] nonebot | Event will be handled by Matcher(type='message', module=plugins.fudu)
03-11 19:31:08 [INFO] nonebot | Event will be handled by Matcher(type='message', module=extensive_plugin.nonebot_plugin_chatgpt.utils)
03-11 19:31:08 [INFO] nonebot | Matcher(type='message', module=plugins.fudu) running complete
03-11 19:31:14 [INFO] nonebot | Matcher(type='message', module=extensive_plugin.nonebot_plugin_chatgpt.utils) running complete
03-11 19:31:14 [ERROR] nonebot | Running Matcher(type='message', module=extensive_plugin.nonebot_plugin_chatgpt.utils) failed.
Traceback (most recent call last):
  File "/home/zhenxun_bot/bot.py", line 23, in <module>
    nonebot.run()
  File "/usr/local/lib/python3.9/dist-packages/nonebot/__init__.py", line 273, in run
    get_driver().run(*args, **kwargs)
  File "/usr/local/lib/python3.9/dist-packages/nonebot/drivers/fastapi.py", line 187, in run
    uvicorn.run(
  File "/usr/local/lib/python3.9/dist-packages/uvicorn/main.py", line 463, in run
    server.run()
  File "/usr/local/lib/python3.9/dist-packages/uvicorn/server.py", line 60, in run
    return asyncio.run(self.serve(sockets=sockets))
  File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/local/lib/python3.9/dist-packages/nonebot/message.py", line 141, in _check_matcher
    await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)
> File "/usr/local/lib/python3.9/dist-packages/nonebot/message.py", line 187, in _run_matcher
    await matcher.run(bot, event, state, stack, dependency_cache)
  File "/usr/local/lib/python3.9/dist-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.9/dist-packages/nonebot/internal/matcher/matcher.py", line 707, in simple_run
    await handler(
  File "/usr/local/lib/python3.9/dist-packages/nonebot/dependencies/__init__.py", line 108, in __call__
    return await cast(Callable[..., Awaitable[R]], self.call)(**values)
  File "/home/zhenxun_bot/extensive_plugin/nonebot_plugin_chatgpt/__init__.py", line 66, in ai_chat
    msg = await chat_bot(**session[event]).get_chat_response(text)
  File "/home/zhenxun_bot/extensive_plugin/nonebot_plugin_chatgpt/chatgpt.py", line 126, in get_chat_response
    await self.get_cf_cookies(page)
  File "/home/zhenxun_bot/extensive_plugin/nonebot_plugin_chatgpt/chatgpt.py", line 231, in get_cf_cookies
    button = page.get_by_role("button", name="Verify you are human")
AttributeError: 'Page' object has no attribute 'get_by_role'