AI Search Hub
Use this skill only for this repository's AI Search Hub browser automation scripts:
- - INLINECODE0
- INLINECODE1
- INLINECODE2
- INLINECODE3
- INLINECODE4
- INLINECODE5
When To Use
Use this skill when the user asks to:
- - run one of the supported chat sites from this repo
- normalize invocation across the three scripts
- auto-start a debug Chromium-family browser session
- detect whether
127.0.0.1:9222 is available - prompt for login if the target site is not logged in, then continue automatically
- seed an isolated debug profile from the user's local browser data
How To Run
Run the bundled wrapper script instead of calling the site script directly:
CODEBLOCK0
Key arguments:
- - INLINECODE7
- INLINECODE8 required
- INLINECODE9 if the current working directory is not the repo root
- INLINECODE10 to reuse an existing DevTools endpoint
- INLINECODE11 to force a specific Chromium-family browser binary
- INLINECODE12 to control the isolated debug profile location
- INLINECODE13 to force a specific source browser user-data-dir
- INLINECODE14 to control the destination file
Workflow
The wrapper script is the low-freedom path and should be preferred over hand-rolling the sequence.
It does the following:
- 1. Finds the repo root and target site script.
- Reuses
--cdp-http if 9222 is already listening. - Otherwise seeds an isolated Chromium-family debug profile from the user's source browser data and starts the browser with a remote-debugging port, opening the requested site directly instead of leaving a separate
about:blank startup tab behind. - For legacy sites (
yuanbao, longcat, doubao), opens the target site and checks for login UI before dispatching the site-specific script. - For generic sites (
qwen, gemini, grok), opens the target site, enters the prompt, and waits for a reply. - If the site requires login or produces no usable reply because login is required, prints a prompt and waits until login completes, then continues automatically.
- Invokes the matching site script with standardized flags and the resolved
--cdp-url. - Reuses the single startup page when possible so the browser does not keep an extra blank tab, and prefers DOM-side text entry over keyboard typing to reduce accidental interference from the user working elsewhere.
Site Notes
- -
doubao: requires a logged-in session. The visitor page usually does not answer prompts. - INLINECODE26 : login may appear as a modal with QQ, WeChat, or last-login buttons even when the page shell is visible.
- INLINECODE27 : the wrapper prefers a new chat before sending unless
--no-new-chat is requested downstream. - INLINECODE29 ,
gemini, grok: each has its own Playwright entry script backed by a shared site-chat core. gemini first targets the visible composer and attempts the send once before falling back to the login-wait loop, because the landing page exposes a real textbox even when the account is not yet in a usable chat state.
Constraints
- - Prefer headed Chromium browsers for login-recovery flows. Headless mode only makes sense when the copied debug profile is already logged in.
- Do not kill the user's normal browser session unless the user explicitly asks for that.
- The wrapper copies browser data into an isolated debug profile and skips lock files, so the user's normal browser can stay open.
- The wrapper bypasses Python proxy settings for local DevTools requests because
http://127.0.0.1:9222/json/version may otherwise return a false 502.
AI Search Hub
仅将此技能用于此仓库的AI Search Hub浏览器自动化脚本:
- - scripts/yuanbaoplaywright.py
- scripts/longcatplaywright.py
- scripts/doubaoplaywright.py
- scripts/qwenplaywright.py
- scripts/geminiplaywright.py
- scripts/grokplaywright.py
使用时机
当用户要求执行以下操作时使用此技能:
- - 运行此仓库中支持的某个聊天网站
- 统一三个脚本的调用方式
- 自动启动调试版Chromium系列浏览器会话
- 检测127.0.0.1:9222是否可用
- 如果目标网站未登录则提示登录,然后自动继续
- 从用户本地浏览器数据中生成隔离的调试配置文件
运行方法
运行捆绑的包装脚本,而不是直接调用网站脚本:
bash
python3 scripts/runwebchat.py --site doubao --prompt 给我一份简短的杭州美食指南。
关键参数:
- - --site yuanbao|longcat|doubao|qwen|gemini|grok
- --prompt ... 必填
- --repo-root <路径> 如果当前工作目录不是仓库根目录
- --cdp-http http://127.0.0.1:9222 重用现有的DevTools端点
- --browser-path <路径> 强制指定特定的Chromium系列浏览器可执行文件
- --debug-profile-dir <路径> 控制隔离调试配置文件的位置
- --user-data-source <路径> 强制指定源浏览器用户数据目录
- --output <路径> 控制目标文件
工作流程
包装脚本是低自由度路径,应优先于手动执行序列。
它执行以下操作:
- 1. 查找仓库根目录和目标网站脚本。
- 如果9222端口已在监听,则重用--cdp-http。
- 否则,从用户的源浏览器数据生成隔离的Chromium系列调试配置文件,并使用远程调试端口启动浏览器,直接打开请求的网站,而不是留下单独的about:blank启动标签页。
- 对于传统网站(yuanbao、longcat、doubao),在调用特定网站脚本前打开目标网站并检查登录界面。
- 对于通用网站(qwen、gemini、grok),打开目标网站,输入提示词,等待回复。
- 如果网站需要登录或因需要登录而未产生可用回复,则打印提示并等待登录完成,然后自动继续。
- 使用标准化标志和解析后的--cdp-url调用匹配的网站脚本。
- 尽可能重用单个启动页面,使浏览器不保留额外的空白标签页,并优先使用DOM端文本输入而非键盘输入,以减少用户在其他地方操作时的意外干扰。
网站说明
- - doubao:需要已登录的会话。访客页面通常不会回答提示。
- yuanbao:即使页面外壳可见,登录可能以包含QQ、微信或上次登录按钮的模态框形式出现。
- longcat:除非下游请求--no-new-chat,包装器在发送前优先创建新聊天。
- qwen、gemini、grok:每个都有自己基于共享聊天核心的Playwright入口脚本。gemini首先定位可见的编辑器并尝试发送一次,然后回退到登录等待循环,因为登录页面即使在账户尚未处于可用聊天状态时也会暴露真实的文本框。
约束条件
- - 对于登录恢复流程,优先使用有头Chromium浏览器。仅当复制的调试配置文件已登录时,无头模式才有意义。
- 除非用户明确要求,否则不要终止用户的正常浏览器会话。
- 包装器将浏览器数据复制到隔离的调试配置文件中,并跳过锁定文件,因此用户的正常浏览器可以保持打开状态。
- 包装器绕过本地DevTools请求的Python代理设置,因为http://127.0.0.1:9222/json/version否则可能返回错误的502。