XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet
公开
关注 0 Fork 0 Star 1
返回提交历史

XFEstudio/gpt4free

feat: add delays and input actions for captcha and auth flows

- Added `await asyncio.sleep(1)` inside captcha verification loop in `EasyChat.py` to introduce delay between checks - Modified `Grok.py` to send "Hello" input to a selected textarea element during auth flow - Added delay after sending keys to textarea in `Grok.py` using `await asyncio.sleep(1)` - Added logic to select and click a submit button if present in `Grok.py` during header check loop - All changes are within the `EasyChat` and `Grok` class definitions respectively

5b65101a
hlohaus <983577+hlohaus@users.noreply.github.com>
提交于

代码差异

2 个文件 +7 -0
Modified g4f/Provider/EasyChat.py +1 -0
@@ -65,6 +65,7 @@ class EasyChat(OpenaiTemplate, AuthFileMixin):
65 65 if not modal:
66 66 break
67 67 debug.log("EasyChaat: Waiting for captcha verification...")
68 await asyncio.sleep(1)
68 69 if cls.captchaToken:
69 70 debug.log("EasyChat: Captcha token found, proceeding.")
70 71 break
Modified g4f/Provider/needs_auth/Grok.py +6 -0
@@ -62,6 +62,12 @@ class Grok(AsyncAuthedProvider, ProviderModelMixin):
62 62 while True:
63 63 if has_headers:
64 64 break
65 textarea = await page.select("textarea", 180)
66 await textarea.send_keys("Hello")
67 await asyncio.sleep(1)
68 button = await page.select("button[type='submit']")
69 if button:
70 await button.click()
65 71 await asyncio.sleep(1)
66 72 auth_result.cookies = {}
67 73 for c in await page.send(nodriver.cdp.network.get_cookies([cls.url])):