Ask Gemini/ChatGPT
简介
Ask Gemini/ChatGPT
原始描述
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", "让...
通过你的 Agent 添加
安装目录:web-chat/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
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: "\u2728"
category: "ai-tools"
tags: ["gemini", "google", "chatgpt", "openai", "gpt", "browser-automation", "playwright", "ai-chat"]
# NOTE: OpenClaw reports the host OS as "darwin" on macOS.
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
# 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
| 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 |
cd {baseDir} && rm -rf .venv && python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。