A-kirami / nonebot-plugin-chatgpt

MIT License
319 stars 37 forks source link

[BUG]: 回复超时,cf cookies获取失败 #119

Open CounterpickToWin opened 1 year ago

CounterpickToWin commented 1 year ago

报告清单

影响版本

0.7.4

问题描述

在服务器(Ubuntu)上env中配置CHATGPT_SESSION_TOKEN登录,加载插件成功后,发送任意消息,后台均报错显示cf cookies获取失败,尝试更新session-token仍然出现同样bug。但是在Windows本地电脑上可以成功运行,并正常返回消息。

复现步骤

使用平台:Ubuntu 21 1.env中配置使用CHATGPT_SESSION_TOKEN登录 2.发送任意消息,后台显示cf cookies获取失败

预期行为

正常回复信息

实际行为

ChatGPT回复已超时

日志信息

02-15 20:24:46 [INFO] nonebot | Event will be handled by Matcher(type='message', module=nonebot_plugin_chatgpt.utils) 02-15 20:25:11 [ERROR] nonebot_plugin_chatgpt | cf cookies获取失败 02-15 20:25:41 [ERROR] nonebot_plugin_chatgpt | ChatGPT request failed: TimeoutError: Timeout 30000ms exceeded while waiting for event "response" =========================== logs =========================== waiting for response https://chat.openai.com/backend-api/conversation

Traceback (most recent call last): File "/root/first/.venv/lib/python3.10/site-packages/nonebot_plugin_chatgpt/chatgpt.py", line 159, in get_chat_response await textarea.fill(prompt) File "/root/first/.venv/lib/python3.10/site-packages/playwright/async_api/_generated.py", line 15625, in fill await self._impl_obj.fill( File "/root/first/.venv/lib/python3.10/site-packages/playwright/_impl/_locator.py", line 198, in fill return await self._frame.fill(self._selector, strict=True, **params) File "/root/first/.venv/lib/python3.10/site-packages/playwright/_impl/_frame.py", line 528, in fill await self._channel.send("fill", locals_to_params(locals())) File "/root/first/.venv/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 44, in send return await self._connection.wrap_api_call( File "/root/first/.venv/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 419, in wrap_api_call return await cb() File "/root/first/.venv/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 79, in inner_send result = next(iter(done)).result() playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded. =========================== logs =========================== waiting for locator("textarea")

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 17, in File "/root/first/.venv/lib/python3.10/site-packages/nonebot/init.py", line 273, in run get_driver().run(*args, kwargs) File "/root/first/.venv/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 187, in run uvicorn.run( File "/root/first/.venv/lib/python3.10/site-packages/uvicorn/main.py", line 569, in run server.run() File "/root/first/.venv/lib/python3.10/site-packages/uvicorn/server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/root/first/.venv/lib/python3.10/site-packages/nonebot/message.py", line 141, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache) File "/root/first/.venv/lib/python3.10/site-packages/nonebot/message.py", line 187, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "/root/first/.venv/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 "/root/first/.venv/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 707, in simple_run await handler( File "/root/first/.venv/lib/python3.10/site-packages/nonebot/dependencies/init.py", line 108, in call return await cast(Callable[..., Awaitable[R]], self.call)(values)

File "/root/first/.venv/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 "/root/first/.venv/lib/python3.10/site-packages/nonebot_plugin_chatgpt/chatgpt.py", line 151, in get_chat_response async with page.expect_response( File "/root/first/.venv/lib/python3.10/site-packages/playwright/_impl/_async_base.py", line 53, in aexit await self._event.value File "/root/first/.venv/lib/python3.10/site-packages/playwright/_impl/_async_base.py", line 34, in value return mapping.from_maybe_impl(await self._future) playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded while waiting for event "response" =========================== logs =========================== waiting for response https://chat.openai.com/backend-api/conversation

额外补充

No response

koking0 commented 1 year ago

我也是。 image

zxczaq001 commented 1 year ago

前两天还可以用 昨天开始就这样了

IvoryTurq commented 1 year ago

呜呜呜找到问题在哪,但是我解决不了,现在有几率检测人类的按钮会被替换成这个,但我不知道怎么用playwright点击这个

image 这段代码不就是点击这个的吗?

Momo-Tori commented 1 year ago

我在元素里找了半天硬是没找到label span是哪个

可以用 checkbox 来找吗?

            inputL = page.locator(".checkbox")
            if await inputL.count():
                await inputL.click()

我试着加入这个了,还没检查能不能应对这种情况,毕竟不是很经常出现

Erlla commented 1 year ago

我在元素里找了半天硬是没找到label span是哪个

可以用 checkbox 来找吗?

            inputL = page.locator(".checkbox")
            if await inputL.count():
                await inputL.click()

我试着加入这个了,还没检查能不能应对这种情况,毕竟不是很经常出现

这个问题已经解决了,我pr的那个

更新后还是会显示cf cookies获取失败 = =

Erlla commented 1 year ago

我在元素里找了半天硬是没找到label span是哪个

可以用 checkbox 来找吗?

            inputL = page.locator(".checkbox")
            if await inputL.count():
                await inputL.click()

我试着加入这个了,还没检查能不能应对这种情况,毕竟不是很经常出现

这个问题已经解决了,我pr的那个

更新后还是会显示cf cookies获取失败 = =

报错是什么

跟上面贴出来的一模一样 QQ截图20230316214346 QQ截图20230316214401

Erlla commented 1 year ago

你直接访问能进去吗

能进去,没有任何人机验证啥的

Erlla commented 1 year ago

你直接访问能进去吗

能进去,没有任何人机验证啥的

你这是什么系统的服务器

群晖上docker ubuntu系统

Erlla commented 1 year ago

你直接访问能进去吗

能进去,没有任何人机验证啥的

你这是什么系统的服务器

群晖上docker ubuntu系统

chatgpt.py这行改成False,看看他打开浏览器后的情况 image

出现报错 QQ截图20230316220042 QQ截图20230316220030

Erlla commented 1 year ago

虚拟环境下playwright install 我下午的时候装过了一次,这次没有任何输出 QQ截图20230316220042

Erlla commented 1 year ago

还有

Erlla commented 1 year ago

还有

看看

QQ截图20230316221319 QQ截图20230316221311 QQ截图20230316220042

Erlla commented 1 year ago

我去研究研究

EnchantedHay commented 1 year ago

更新最新版本后仍然出现cf cookies获取失败的情况。 headless设为false后发现是卡在了verify you are human上 甚至在please stand by check了一下我的browser之后连verify的按钮都不给我了

zxczaq001 commented 1 year ago

更新最新版本后仍然出现cf cookies获取失败的情况。 headless设为false后发现是卡在了verify you are human上 甚至在please stand by check了一下我的browser之后连verify的按钮都不给我了

能手动点掉吗

image 我现在是这个报错好多天了

EnchantedHay commented 1 year ago

更新最新版本后仍然出现cf cookies获取失败的情况。 headless设为false后发现是卡在了verify you are human上 甚至在please stand by check了一下我的browser之后连verify的按钮都不给我了

能手动点掉吗

手动点掉是可以的,但仍然不会收到回复,仍会显示超时,浏览器页面显示对话框内会有QQ那一端输入的文字,但并没有执行回复,回车执行回复后QQ那一端也不会收到回复内容。

zmq175 commented 1 year ago

我这边运行报错 image

modongfox commented 1 year ago

我这边也报这个错误,按照上面的提示修改还是报cf cookies获取失败 设备:ubuntu20.04,与该问题描述基本一致 错误代码1 错误代码2 错误代码3