osm-ai-bridge
v1.0.0OpenClaw AI 桥接技能。让本地OpenClaw能够向网页端AI助手(Gemini或豆包)发送求助,获取它们的分析和建议,与本地的OpenClaw一起讨论解决方案。支持三种模式:直接提问、深度讨论、答案验证。当遇到复杂问题、需要最新知识、需要多角度分析、或需要中文优化时,自动触发与AI助手的协作。
MIT-0
Security Scan
OpenClaw
Suspicious
medium confidencePurpose & Capability
Name/description promise: bridging local OpenClaw with web AIs (Gemini/豆包). The included scripts implement Playwright-driven browser automation to visit those sites, which is coherent with the purpose. However, the SKILL.md and code claim cookies will be saved for subsequent use, yet the code does not create a persistent Playwright storage state; instead it only opens fresh pages. Also registry metadata lists no required config paths, but the code writes files under ~/.openclaw — a mismatch.
Instruction Scope
SKILL.md instructs installing Playwright and running CLI scripts — consistent. But instructions claim cookies will be saved and environment variables (AI_BRIDGE_HEADLESS, AI_BRIDGE_TIMEOUT) are described; the code does not read those environment variables and does not implement explicit storage of login cookies/state. The scripts automate third‑party webpages (visiting gemini.google.com and www.doubao.com) and will interact with user-provided content; they write results to ~/.openclaw/*.json. No other external endpoints are contacted. The instruction text 'cookies will be saved' is misleading given the implementation.
Install Mechanism
There is no install spec (instruction-only for dependency installation). The SKILL.md recommends pip install playwright and running playwright install chromium — standard. There are no downloaded binaries or remote install URLs in the package itself.
Credentials
The package declares no required environment variables, but SKILL.md documents AI_BRIDGE_HEADLESS and AI_BRIDGE_TIMEOUT. The code does not read those env vars (headless is supplied via CLI flags). This mismatch suggests either sloppy documentation or missing/disabled features. The code does request no tokens/keys, which is proportionate, but it does write to the user's home directory (~/.openclaw) despite metadata asserting 'required config paths: none'.
Persistence & Privilege
always:false (normal). The skill will create and write files under ~/.openclaw/{gemini|doubao}_response.json, which is a per-user storage path — not a system-wide privilege escalation. It does not modify other skills or global agent settings. Autonomous invocation is allowed by default (not a problem by itself).
What to consider before installing
Before installing or running this skill, consider:
- It automates real websites (gemini.google.com and www.doubao.com) via Playwright and requires you to login in a browser; do not run it headless until you confirm login/state handling works.
- The package claims cookies are saved for reuse, but the code does not implement persistent Playwright storage state — expect you may need to re-login or modify the code to persist storage_state.
- The SKILL.md mentions environment variables (AI_BRIDGE_HEADLESS, AI_BRIDGE_TIMEOUT) but the code doesn't read them — documentation/code mismatch.
- The scripts write result files into ~/.openclaw/*.json even though the registry metadata lists no config paths; review and be comfortable with that location.
- There is a likely bug/typo in doubao_bridge.py (a stray 'p' after writing the JSON) and files are truncated in the provided bundle; run the code in a safe/isolated environment (container or VM) and inspect/fix the source before trusting it.
- No additional credentials or network backdoors were found in the visible code, but because this skill drives a browser to external services, treat it as code that can interact with remote sites and the content you send may be visible to those services.
Recommended actions: inspect and fix the source (remove stray characters, add persistent storage if desired), run non-headless to complete login and verify behavior, run in an isolated environment, and only grant it access to accounts you are willing to use via an automated browser.Like a lobster shell, security has layers — review code before you run it.
latest
License
MIT-0
Free to use, modify, and redistribute. No attribution required.
SKILL.md
OSM AI Bridge - OpenClaw 多AI智慧协作
支持的AI助手
| AI助手 | 特点 | 适用场景 |
|---|---|---|
| 🟢 Gemini | 知识面广、英文强 | 最新知识、技术研究 |
| 🟣 豆包 | 中文优化好、本土化 | 中文内容、本地化需求 |
快速开始
安装依赖
pip install playwright
playwright install chromium
命令行使用
# 问Gemini(默认)
python scripts/ai_bridge_cli.py ask "2024年诺贝尔物理学奖得主是谁?"
# 问豆包
python scripts/ai_bridge_cli.py ask "你好" --ai doubao
# 和Gemini讨论
python scripts/ai_bridge_cli.py discuss "如何设计这个系统?" \
--local-view "我认为应该用Python" \
--ai gemini
# 让豆包验证
python scripts/ai_bridge_cli.py verify "这个说法对吗?" \
--local-answer "对的" \
--ai doubao
Python 调用
from scripts.ai_bridge_cli import (
ask_gemini, ask_doubao,
discuss_with_gemini, discuss_with_doubao,
verify_with_gemini, verify_with_doubao
)
# 根据问题特点选择AI
# 需要最新知识 → Gemini
result = ask_gemini("2024年最新的AI突破是什么?")
# 需要中文优化 → 豆包
result = ask_doubao("这段中文表达自然吗?")
# 讨论技术方案 → Gemini(技术强)
view = discuss_with_gemini("微服务架构", "我的初步想法是...")
# 验证中文内容 → 豆包(中文好)
result = verify_with_doubao("这句话对吗?", "我的答案")
三种协作模式
1. Ask - 直接提问
当你不知道答案,或需要最新信息时使用。
用户: 2024年诺贝尔物理学奖得主是谁?
本地OpenClaw: 我不知道2024年后的信息...
[调用Gemini]
Gemini: 2024年诺贝尔物理学奖授予...
本地OpenClaw: 根据Gemini的最新信息...
2. Discuss - 深度讨论
当你需要多角度分析时使用。
用户: 如何设计一个高并发的Web系统?
本地OpenClaw: 给出初步方案...
用户: 豆包怎么看?
[调用豆包讨论模式]
豆包: 从中文用户角度补充...
本地OpenClaw: 综合两个方案...
3. Verify - 答案验证
当你不确定答案正确性时使用。
用户: 这句话中文表达地道吗?
本地OpenClaw: 看起来没问题...
[调用豆包验证]
豆包: 可以更口语化,建议修改为...
本地OpenClaw: 经过豆包验证,最佳表达是...
如何选择AI助手?
选 Gemini 当:
- ✅ 需要最新知识(2024年后事件)
- ✅ 技术性问题(代码、算法)
- ✅ 英文内容
- ✅ 学术研究
选 豆包 当:
- ✅ 中文内容优化
- ✅ 本土化需求
- ✅ 需要口语化表达
- ✅ 中国特有的场景
触发条件
以下情况自动触发AI协作:
关键词触发
- "最新"、"最近"、"2024"、"2025" → 触发 Gemini
- "中文"、"地道"、"口语化" → 触发 豆包
- "Gemini怎么看"、"问问Gemini"
- "豆包怎么看"、"问问豆包"
复杂度触发
- 问题涉及多个领域
- 需要最新知识
- 代码逻辑复杂
用户明确请求
/ask-gemini、/ask-doubao/discuss-with-gemini、/discuss-with-doubao/verify-with-gemini、/verify-with-doubao
工作流程
用户提问
↓
[本地OpenClaw分析]
↓
是否需要AI协助?
├─ 是 → 选择AI (Gemini/豆包) → 调用
└─ 否 → 直接回答
↓
整合AI回复
↓
给出综合答案
文件说明
scripts/gemini_bridge.py- Gemini核心桥接器scripts/doubao_bridge.py- 豆包核心桥接器scripts/ai_bridge_cli.py- 统一命令行接口scripts/gemini_mock.py- Gemini测试版scripts/doubao_mock.py- 豆包测试版
配置
环境变量
export AI_BRIDGE_HEADLESS=true # 无头模式
export AI_BRIDGE_TIMEOUT=60 # 超时时间
首次使用
- Gemini: 首次访问需要登录Google账号
- 豆包: 首次访问需要登录字节账号
- 登录后Cookie会保存,后续自动使用
限制
- 需要稳定的网络连接
- 网页版可能有使用频率限制
- 首次需要手动登录
- 回复需要等待5-30秒
- 如果网页改版,需要更新选择器
故障排除
找不到输入框
网页改版导致选择器失效,需要更新脚本中的CSS选择器。
登录失败
检查网络连接,或尝试手动在浏览器中登录。
回复为空
可能是等待时间不够,可以尝试增加超时时间。
示例场景
场景1: 最新科技新闻
用户: 最近AI有什么重大突破?
本地: 我需要查询最新信息...
[触发Gemini]
Gemini: 2024年最重要的突破...
本地: 根据Gemini...
场景2: 中文文案优化
用户: 帮我优化这段文案
本地: 初步优化...
[触发豆包]
豆包: 从中文语境优化...
本地: 经过豆包润色...
场景3: 代码审查
用户: 这段代码有bug吗?
本地: 初步分析...
[触发Gemini验证]
Gemini: 确认有3个问题...
本地: 综合检查...
场景4: 中英翻译对比
用户: 这个翻译准确吗?
本地: 初步翻译...
[问Gemini] 英文准确性
[问豆包] 中文自然度
本地: 综合两个AI意见...
Files
4 totalSelect a file
Select a file to preview.
Comments
Loading comments…
