mcpField
T
tuzi-danger-gemini-web

tuzi-danger-gemini-web

github.com/tuziapi创意与媒体39155 次安装27 周前更新
代码仓库

关于 tuzi-danger-gemini-web

该技能通过 Gemini Web API 提供文本和图像生成,面向需要在命令行中使用 Gemini 的用户。它支持参考图像和多轮对话,并可保存会话。

主要功能

  1. 01生成文本和图像
  2. 02使用参考图像作为输入
  3. 03支持多轮会话
  4. 04选择 Gemini 模型
  5. 05支持 JSON 输出

适用场景

  1. 01通过提示词生成文本
  2. 02根据参考图生成图像
  3. 03延续已保存的多轮会话

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/tuziapi/tuzi-skills --skill tuzi-danger-gemini-web

安装后在 Claude Code 中输入/tuzi-danger-gemini-web确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

scripts/
main.ts
scripts/gemini-webapi/
client.ts
constants.ts
exceptions.ts
index.ts
scripts/gemini-webapi/components/
gem-mixin.ts
index.ts
scripts/gemini-webapi/types/
candidate.ts
gem.ts
grpc.ts
image.ts
index.ts
modeloutput.ts
scripts/gemini-webapi/utils/
cookie-file.ts
decorators.ts
get-access-token.ts
http.ts
index.ts
load-browser-cookies.ts
logger.ts
parsing.ts
paths.ts
rotate-1psidts.ts
upload-file.ts

详细介绍

Gemini Web 客户端

通过 Gemini Web API 生成文本/图像。支持参考图像和多轮对话。

脚本目录

重要:所有脚本都位于此技能的 scripts/ 子目录中。

Agent 执行说明:

  1. 将此 SKILL.md 文件所在目录路径确定为 SKILL_DIR
  2. 脚本路径 = ${SKILL_DIR}/scripts/<script-name>.ts
  3. 将本文档中的所有 ${SKILL_DIR} 替换为实际路径

脚本参考:

脚本用途
scripts/main.ts文本/图像生成的 CLI 入口
scripts/gemini-webapi/*gemini_webapi 的 TypeScript 移植版(GeminiClient、类型、工具函数)

同意检查(必需)

首次使用前,请确认用户同意使用逆向工程 API。

同意文件位置:

  • macOS:~/Library/Application Support/tuzi-skills/gemini-web/consent.json
  • Linux:~/.local/share/tuzi-skills/gemini-web/consent.json
  • Windows:%APPDATA%\tuzi-skills\gemini-web\consent.json

流程:

  1. 检查同意文件是否存在,且包含 accepted: true 和 disclaimerVersion: "1.0"
  2. 如果同意有效 → 打印包含 acceptedAt 日期的警告,然后继续
  3. 如果没有同意 → 显示免责声明,并通过 AskUserQuestion 询问用户:
    • “是,我接受” → 创建包含 ISO 时间戳的同意文件,然后继续
    • “不,我拒绝” → 输出拒绝消息,然后停止
  4. 同意文件格式:{"version":1,"accepted":true,"acceptedAt":"<ISO>","disclaimerVersion":"1.0"}

偏好设置(EXTEND.md)

使用 Bash 按优先级顺序检查 EXTEND.md 是否存在:

# Check project-level first
test -f .tuzi-skills/tuzi-danger-gemini-web/EXTEND.md && echo "project"

# Then user-level (cross-platform: $HOME works on macOS/Linux/WSL)
test -f "$HOME/.tuzi-skills/tuzi-danger-gemini-web/EXTEND.md" && echo "user"

┌──────────────────────────────────────────────────────────┬───────────────────┐ │ 路径 │ 位置 │ ├──────────────────────────────────────────────────────────┼───────────────────┤ │ .tuzi-skills/tuzi-danger-gemini-web/EXTEND.md │ 项目目录 │ ├──────────────────────────────────────────────────────────┼───────────────────┤ │ $HOME/.tuzi-skills/tuzi-danger-gemini-web/EXTEND.md │ 用户主目录 │ └──────────────────────────────────────────────────────────┴───────────────────┘

┌───────────┬───────────────────────────────────────────────────────────────────────────┐ │ 结果 │ 操作 │ ├───────────────────────────────────────────────────────────────────────────────────────┤ │ 找到 │ 读取、解析并应用设置 │ ├───────────────────────────────────────────────────────────────────────────────────────┤ │ 未找到 │ 使用默认值 │ └───────────┴───────────────────────────────────────────────────────────────────────────┘

EXTEND.md 支持:默认模型 | 代理设置 | 自定义数据目录

用法

# Text generation
npx -y bun ${SKILL_DIR}/scripts/main.ts "Your prompt"
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Your prompt" --model gemini-3-flash

# Image generation
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "A cute cat" --image cat.png
npx -y bun ${SKILL_DIR}/scripts/main.ts --promptfiles system.md content.md --image out.png

# Vision input (reference images)
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Describe this" --reference image.png
npx -y bun ${SKILL_DIR}/scripts/main.ts --prompt "Create variation" --reference a.png --image out.png

# Multi-turn conversation
npx -y bun ${SKILL_DIR}/scripts/main.ts "Remember: 42" --sessionId session-abc
npx -y bun ${SKILL_DIR}/scripts/main.ts "What number?" --sessionId session-abc

# JSON output
npx -y bun ${SKILL_DIR}/scripts/main.ts "Hello" --json

选项

选项说明
--prompt, -p提示词文本
--promptfiles从文件读取提示词(拼接)
--model, -m模型:gemini-3-pro(默认)、gemini-3-flash、gemini-3-flash-thinking、gemini-3.1-pro-preview
--image [path]生成图像(默认:generated.png)
--reference, --ref用于视觉输入的参考图像
--sessionId多轮对话的会话 ID
--list-sessions列出已保存的会话
--json以 JSON 格式输出
--login刷新 Cookie,然后退出
--cookie-path自定义 Cookie 文件路径
--profile-dirChrome 配置文件目录

模型

模型说明
gemini-3-pro默认,最新的 3.0 Pro
gemini-3-flash快速、轻量的 3.0 Flash
gemini-3-flash-thinking带有思考功能的 3.0 Flash
gemini-3.1-pro-preview3.1 Pro 预览版(空 header,自动路由)

身份验证

首次运行时会打开浏览器进行 Google 身份验证。Cookie 会自动缓存。

支持的浏览器(自动检测):Chrome、Chrome Canary/Beta、Chromium、Edge。

强制刷新:--login 标志。覆盖浏览器:GEMINI_WEB_CHROME_PATH 环境变量。

环境变量

变量描述
GEMINI_WEB_DATA_DIR数据目录
GEMINI_WEB_COOKIE_PATHCookie 文件路径
GEMINI_WEB_CHROME_PROFILE_DIRChrome 配置目录
GEMINI_WEB_CHROME_PATHChrome 可执行文件路径
HTTP_PROXY, HTTPS_PROXY用于访问 Google 的代理(在命令中内联设置)

会话

会话文件存储在数据目录下的 sessions/<id>.json 中。

包含:id、metadata(Gemini 聊天状态)、messages 数组、时间戳。

扩展支持

通过 EXTEND.md 使用自定义配置。路径和支持的选项请参阅 偏好设置 部分。

评论

支持 Markdown