360 Secure SkillHub
360 安全技能中心

Ask Gemini/ChatGPT

该 Skill 用 Playwright 经 Chrome 远程调试端口驱动已登录的浏览器会话,把用户问题发送到 Google Gemini 或 ChatGPT 网页端,等待回答后原样输出,可选 JSON 输出;支持指定端口、超时、强制新会话,Chrome 未运行时启用启动脚本。用户需自行在浏览器中登录。

ljie-pi
ljie-pi
热度 81.71
最近更新 2026-05-11 17:29:24
分类:自动化依赖:联网浏览搜索 / 代码执行应用场景:自动化脚本 / 研究 / 概念解释

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add web-chat
Metadata
name
web-chat
description
Use when the user wants to interact with Google Gemini or ChatGPT via browser automation. Triggers on phrases like "ask Gemini", "ask ChatGPT", "ask GPT", "让 Gemini", "让 ChatGPT", "问一下 Gemini", "问一下 ChatGPT", "用 Gemini 查", "用 GPT 查". Sends the user's query to the target chatbot and returns the response verbatim.
version
1.0.0
metadata
{"openclaw":{"emoji":"✨","category":"ai-tools","tags":["gemini","google","chatgpt","openai","gpt","browser-automation","playwright","ai-chat"],"os":["linux","darwin"],"requires":{"bins":["python3"]}}}

Web Chat

Send messages to AI chatbots (Gemini, ChatGPT) via Playwright browser automation and return responses with citations.

Chatbot Script Website
Google Gemini scripts/ask_gemini.py gemini.google.com
ChatGPT scripts/ask_chatgpt.py chatgpt.com

Workflow

Step 1: Ensure Chrome is Running with CDP

If the script fails to connect (Chrome not running or no --remote-debugging-port), start Chrome:

{baseDir}/scripts/start_chrome.sh

The start script has built-in locking and CDP detection to handle concurrent starts safely. It launches Chrome with --remote-debugging-port=9222 and --user-data-dir=~/.openclaw/workspace/chrome_profile. Login sessions persist across restarts.

Step 2: Choose Chatbot and Extract Query

Choose chatbot: Use the one the user names ("ask Gemini", "用 ChatGPT 查"). "GPT" means ChatGPT. Default to Gemini if unspecified.

Extract query: Strip only the trigger prefix. Do NOT rephrase, translate, summarize, or add context. Pass the rest verbatim:

User says Extracted query
"ask Gemini what is MCP protocol" "what is MCP protocol"
"问一下 ChatGPT,transformer 的注意力机制怎么工作" "transformer 的注意力机制怎么工作"
"用 GPT 查一下 React 19 有什么新特性" "React 19 有什么新特性"

Step 3: Send the Query

# Gemini
{baseDir}/.venv/bin/python3 {baseDir}/scripts/ask_gemini.py "extracted query"

# ChatGPT
{baseDir}/.venv/bin/python3 {baseDir}/scripts/ask_chatgpt.py "extracted query"
Flag Description Default
--port PORT Chrome CDP port 9222
--timeout SECS Max wait for response 120
--new-chat Force new chat session false
--json JSON output false

Return the script output to the user VERBATIM. Do NOT summarize, rephrase, translate, or otherwise alter the response. Present the full, unmodified text exactly as the script printed it.

Error Handling

Error Action
"Cannot connect to Chrome on port 9222" Run {baseDir}/scripts/start_chrome.sh (has built-in lock and CDP check), wait 5 seconds, retry. Do NOT kill Chrome manually.
"You are not logged in" Inform user to log in manually in the Chrome window
"Could not find input field" Selectors may be outdated; inform user the script may need updating
Response timeout Retry with --timeout 300

Rebuilding .venv

cd {baseDir} && rm -rf .venv && python3 -m venv .venv && .venv/bin/pip install -r requirements.txt