feat: skills i18n 改造(schemaVersion 1.1,零向后兼容) (#1)

* feat: skills i18n 改造 — schemaVersion 1.1,零向后兼容

把 21 个 skills + 1 个 agent + manifest/categories 全量迁移到 schemaVersion 1.1
的 i18n 结构,配套 CI AI 翻译流水线(GitHub Models)与本地工具链。

## 关键变更

### 数据结构(破坏性,schemaVersion 1.0 → 1.1)
- SKILL.md: 顶层 name 改为 ASCII slug(== 目录名,符合 agentskills.io 规范);
  中文显示名/short_desc/description 全部迁入 metadata.i18n.<locale>
- agents/<id>/agent.json: shortDesc/fullDesc/tags/persona.{role,traits} 迁入
  i18n.<locale>;changelog[].changes 改为 { <locale>: string[] } 对象
- categories.json: 每个分类的 label/description 迁入 i18n.<locale>,顶层只剩
  color/icon
- manifest.json: 加 supportedLocales / defaultLocale;顶层 description 迁入
  i18n.<locale>

### Body 文件结构
- 根 SKILL.md = frontmatter + default_locale (en-US) body
- SKILL.<locale>.md = 各 locale 的 markdown body(首行 <!-- locale: xx --> 自校验)

### 工具链(scripts/i18n/)
- glossary.json: zh→en 术语表 + do_not_translate 白名单
- schema/skill-frontmatter.schema.json: i18n frontmatter JSON Schema
- validate-i18n.py: 8 条校验规则(name 合规 / locale 完整性 / hash 一致性等)
- translate.py: GitHub Models / Anthropic 双 backend,sha256 增量翻译
- migrate.py: 一次性迁移脚本(旧格式 → i18n 结构)

### CI(.github/workflows/)
- i18n-validate.yml: PR 触发跑 validate + translate --check
- i18n-translate.yml: PR 触发用 GitHub Models(默认 openai/gpt-5-mini)翻译缺失
  locale,自动追加 commit;可切到 ANTHROPIC_API_KEY 走 Claude

### 文档
- docs/I18N.md: 作者贡献指南(schema 说明 / 提交流程 / 常见问题)
- README.md: 加多语言段落

## 验证

- uv run scripts/i18n/validate-i18n.py: OK,49 文件 0 错误
- uv run scripts/i18n/translate.py --check: 0 stale locale
- 21 skills 标题数 zh-CN == en-US 严格对齐(最大 66=66)
- skills-ref 规范校验:全部通过(顶层 name ASCII slug + description 单字段)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

* fix(i18n): 修复 PR #1 review 反馈的 6 项问题

- schema: translated_by 正则放宽为 ^(human|ai:[A-Za-z0-9._:/-]+)$,接受
  'ai:github:openai/gpt-5-mini' 这类 backend:model 形式(CI 翻译输出格式)
- README + docs/I18N.md: 修正"CI 用 Claude API"误导描述,正确说明默认是
  GitHub Models(openai/gpt-5-mini)+ GITHUB_TOKEN,可选切到 Anthropic
- skills/minimax-tts/SKILL.md & SKILL.zh-CN.md: 删除多余的 ``` 闭合,避免
  Markdown 后续渲染错乱
- skills/docx/SKILL.md: 翻译时丢失的 • Unicode escape 示例已恢复,
  与 zh-CN 版本对齐

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-05 00:26:33 +08:00
committed by GitHub
parent 1c107a9344
commit 1f7c8b9673
59 changed files with 10533 additions and 2014 deletions

View File

@@ -1,5 +1,5 @@
---
name: MiniMax 文生图
name: minimax-image-gen
description: >-
Use this skill when the user wants to generate images using MiniMax's
image-01 model. Supports text-to-image and subject reference for character
@@ -23,6 +23,29 @@ requires:
metadata:
author: desirecore
updated_at: '2026-04-25'
i18n:
default_locale: en-US
source_locale: zh-CN
locales:
- zh-CN
- en-US
zh-CN:
name: MiniMax 文生图
short_desc: 基于 MiniMax image-01 的文本生成图片技能
description: >-
Use this skill when the user wants to generate images using MiniMax's image-01 model. Supports text-to-image and subject reference for character consistency. Use when 用户提到 生成图片、画图、文生图、创建图片、 AI 绘画、生成插图、画一张、帮我画、设计图片、MiniMax 画图。
body: ./SKILL.zh-CN.md
source_hash: sha256:4630268ef3bd4e23
translated_by: human
en-US:
name: MiniMax Image Generation
short_desc: Text-to-image generation skill powered by MiniMax image-01
description: >-
Use this skill when the user wants to generate images using MiniMax's image-01 model. Supports text-to-image and subject reference for character consistency. Use when the user mentions generate images, draw a picture, text-to-image, create an image, AI painting, generate illustration, draw one for me, help me draw, design an image, MiniMax drawing.
body: ./SKILL.md
source_hash: sha256:4630268ef3bd4e23
translated_by: ai:claude-opus-4-7
translated_at: '2026-05-03'
market:
icon: >-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0
@@ -32,7 +55,6 @@ market:
stroke-width="1.2"/><path d="M3 16l5-5 4 4 3-3 6 6" stroke="#34C759"
stroke-width="1.5" stroke-linecap="round"
stroke-linejoin="round"/></svg>
short_desc: 基于 MiniMax image-01 的文本生成图片技能
category: media
maintainer:
name: DesireCore Official
@@ -41,19 +63,19 @@ market:
listed: false
---
# minimax-image-gen 技能
# minimax-image-gen Skill
## 强制规则(违反将导致功能失败)
## Mandatory Rules (violations will cause feature failure)
1. **必须使用 `"response_format": "url"`** 禁止 `"base64"`base64 会导致输出截断
2. **必须用 HTTPS 访问 agent-service**`https://127.0.0.1:${PORT}` `-k` 跳过证书验证
3. **必须通过 `/api/media/upload` 上传到 media-store** — 禁止保存到本地路径
4. **必须使用 `dc-media://` 协议展示图片** — 唯一能让前端正确渲染的方式
5. **全程使用 Bash curl** — 不要使用 HttpRequest 工具或 Python
1. **Must use `"response_format": "url"`**`"base64"` is forbidden, base64 will cause output truncation
2. **Must access agent-service over HTTPS**`https://127.0.0.1:${PORT}` with `-k` to skip certificate verification
3. **Must upload to media-store via `/api/media/upload`** — saving to local paths is forbidden
4. **Must use the `dc-media://` protocol to display images** — the only way the frontend can render correctly
5. **Use Bash curl throughout** — do not use the HttpRequest tool or Python
## 完整执行流程(严格按此三步执行)
## Complete Execution Flow (strictly follow these three steps)
### 第一步:调用 API 生成图片
### Step 1: Call the API to generate the image
```bash
PORT=$(cat ~/.desirecore/agent-service.port)
@@ -73,9 +95,9 @@ curl -sk -X POST "https://127.0.0.1:${PORT}/api/media-proxy" \
}'
```
从 JSON 响应中提取 `data.data.image_urls[0]` 得到图片 URL
Extract `data.data.image_urls[0]` from the JSON response to obtain the image URL.
### 第二步:下载并上传到 media-store
### Step 2: Download and upload to media-store
```bash
PORT=$(cat ~/.desirecore/agent-service.port)
@@ -85,33 +107,33 @@ curl -sk -X POST "https://127.0.0.1:${PORT}/api/media/upload" \
-F "file=@/tmp/minimax-gen.png;type=image/png"
```
从 JSON 响应中提取 `mediaId` 字段(格式如 `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.png`)。
Extract the `mediaId` field from the JSON response (format like `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.png`).
### 第三步:用 dc-media 协议展示图片
### Step 3: Display the image with the dc-media protocol
在你的回复文本中直接写 Markdown 图片语法:
Write Markdown image syntax directly in your reply text:
```
![图片描述](dc-media://这里替换为mediaId)
```
例如:`![白色的猫坐在书桌上](dc-media://a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6.png)`
For example: `![白色的猫坐在书桌上](dc-media://a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6.png)`
前端会自动将 `dc-media://` 转为可访问的图片 URL 并渲染出来。
The frontend will automatically convert `dc-media://` into an accessible image URL and render it.
## 参数映射
## Parameter Mapping
| 用户意图 | aspect_ratio |
| User Intent | aspect_ratio |
|---------|-------------|
| 正方形/头像 | "1:1" |
| 横版/风景/壁纸 | "16:9" |
| 竖版/手机/海报 | "9:16" |
| 标准照片 | "4:3" |
| 竖版照片 | "3:4" |
| Square / avatar | "1:1" |
| Landscape / scenery / wallpaper | "16:9" |
| Portrait / phone / poster | "9:16" |
| Standard photo | "4:3" |
| Portrait photo | "3:4" |
## 主体参考(角色一致性)
## Subject Reference (character consistency)
在 body 中添加 `subject_reference`
Add `subject_reference` in the body:
```json
"subject_reference": [
@@ -119,8 +141,8 @@ curl -sk -X POST "https://127.0.0.1:${PORT}/api/media/upload" \
]
```
## 错误处理
## Error Handling
- `"error": "未找到匹配的供应商"`:未配置 MiniMax Media Provider
- `statusCode: 401`API Key 无效
- `statusCode: 429`:频率限制,稍后重试
- `"error": "未找到匹配的供应商"`: MiniMax Media Provider not configured
- `statusCode: 401`: Invalid API Key
- `statusCode: 429`: Rate limited, retry later

View File

@@ -0,0 +1,85 @@
<!-- locale: zh-CN -->
# minimax-image-gen 技能
## 强制规则(违反将导致功能失败)
1. **必须使用 `"response_format": "url"`** — 禁止 `"base64"`base64 会导致输出截断
2. **必须用 HTTPS 访问 agent-service**`https://127.0.0.1:${PORT}``-k` 跳过证书验证
3. **必须通过 `/api/media/upload` 上传到 media-store** — 禁止保存到本地路径
4. **必须使用 `dc-media://` 协议展示图片** — 唯一能让前端正确渲染的方式
5. **全程使用 Bash curl** — 不要使用 HttpRequest 工具或 Python
## 完整执行流程(严格按此三步执行)
### 第一步:调用 API 生成图片
```bash
PORT=$(cat ~/.desirecore/agent-service.port)
curl -sk -X POST "https://127.0.0.1:${PORT}/api/media-proxy" \
-H "Content-Type: application/json" \
-d '{
"providerId": "provider-minimax-media-001",
"endpoint": "/image_generation",
"body": {
"model": "image-01",
"prompt": "这里替换为英文图片描述",
"aspect_ratio": "1:1",
"response_format": "url",
"n": 1
},
"responseType": "json"
}'
```
从 JSON 响应中提取 `data.data.image_urls[0]` 得到图片 URL。
### 第二步:下载并上传到 media-store
```bash
PORT=$(cat ~/.desirecore/agent-service.port)
IMAGE_URL="第一步拿到的图片URL"
curl -sL "$IMAGE_URL" -o /tmp/minimax-gen.png && \
curl -sk -X POST "https://127.0.0.1:${PORT}/api/media/upload" \
-F "file=@/tmp/minimax-gen.png;type=image/png"
```
从 JSON 响应中提取 `mediaId` 字段(格式如 `xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.png`)。
### 第三步:用 dc-media 协议展示图片
在你的回复文本中直接写 Markdown 图片语法:
```
![图片描述](dc-media://这里替换为mediaId)
```
例如:`![白色的猫坐在书桌上](dc-media://a1b2c3d4-e5f6-47a8-b9c0-d1e2f3a4b5c6.png)`
前端会自动将 `dc-media://` 转为可访问的图片 URL 并渲染出来。
## 参数映射
| 用户意图 | aspect_ratio |
|---------|-------------|
| 正方形/头像 | "1:1" |
| 横版/风景/壁纸 | "16:9" |
| 竖版/手机/海报 | "9:16" |
| 标准照片 | "4:3" |
| 竖版照片 | "3:4" |
## 主体参考(角色一致性)
在 body 中添加 `subject_reference`
```json
"subject_reference": [
{ "type": "character", "image_file": { "url": "参考图片URL" } }
]
```
## 错误处理
- `"error": "未找到匹配的供应商"`:未配置 MiniMax Media Provider
- `statusCode: 401`API Key 无效
- `statusCode: 429`:频率限制,稍后重试