mirror of
https://git.openapi.site/https://github.com/desirecore/market.git
synced 2026-06-06 08:30:42 +08:00
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:
175
skills/minimax-video-gen/SKILL.zh-CN.md
Normal file
175
skills/minimax-video-gen/SKILL.zh-CN.md
Normal file
@@ -0,0 +1,175 @@
|
||||
<!-- locale: zh-CN -->
|
||||
|
||||
# minimax-video-gen 技能
|
||||
|
||||
## 强制规则(违反将导致功能失败)
|
||||
|
||||
1. **必须用 HTTPS 访问 agent-service** — `https://127.0.0.1:${PORT}` 加 `-k` 跳过证书验证
|
||||
2. **全程使用 Bash curl** — 不要使用 HttpRequest 工具或 Python
|
||||
3. **轮询间隔 10 秒** — 使用 `sleep 10` 等待
|
||||
|
||||
## 完整执行流程
|
||||
|
||||
### 前置条件
|
||||
|
||||
- 用户已在资源管理器-算力中配置 MiniMax Media Provider 并填写 API Key
|
||||
- agent-service 正在运行
|
||||
|
||||
### 核心概念:三步异步流程
|
||||
|
||||
MiniMax 视频生成采用异步任务模式:
|
||||
|
||||
1. **提交任务**:POST 创建视频生成任务,返回 `task_id`
|
||||
2. **轮询状态**:用 `task_id` 查询任务状态,直到 `status` 为 `"Success"` 或 `"Fail"`
|
||||
3. **下载视频**:用 `file_id` 获取下载 URL
|
||||
|
||||
### 模型选择与降级策略
|
||||
|
||||
| 模型 | 支持模式 | 特点 | 适用场景 |
|
||||
|------|---------|------|---------|
|
||||
| MiniMax-Hailuo-2.3 | 文生视频 + 图生视频 | 最高画质,默认首选 | 用户未指定时的默认选择 |
|
||||
| MiniMax-Hailuo-2.3-fast | **仅图生视频** | 速度快,成本低 50% | 图生视频场景下额度不足时降级 |
|
||||
|
||||
**降级规则(强制)**:
|
||||
1. 默认使用 `MiniMax-Hailuo-2.3`
|
||||
2. **文生视频(T2V)额度不足时**:`MiniMax-Hailuo-2.3-fast` 不支持文生视频,无法降级。应直接告知用户额度不足,建议等待额度重置或切换到其他视频生成服务(如可灵)
|
||||
3. **图生视频(I2V)额度不足时**:可降级到 `MiniMax-Hailuo-2.3-fast`,告知用户"已切换到快速模型生成"
|
||||
4. 如果用户做图生视频且明确要求快速生成,直接使用 `MiniMax-Hailuo-2.3-fast`
|
||||
|
||||
### 第一步:提交文生视频任务
|
||||
|
||||
```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": "/video_generation",
|
||||
"body": {
|
||||
"model": "MiniMax-Hailuo-2.3",
|
||||
"prompt": "用户描述的视频内容"
|
||||
},
|
||||
"responseType": "json"
|
||||
}'
|
||||
```
|
||||
|
||||
可选参数(加入 body 中):
|
||||
- `"duration"`: 视频时长秒数(6 或 10)
|
||||
- `"resolution"`: `"768P"` 或 `"1080P"`
|
||||
|
||||
从 JSON 响应中提取 `data.task_id`。
|
||||
|
||||
### 第一步(备选):图生视频
|
||||
|
||||
```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": "/video_generation",
|
||||
"body": {
|
||||
"model": "MiniMax-Hailuo-2.3",
|
||||
"prompt": "描述图片中场景的动态变化",
|
||||
"first_frame_image": "https://图片URL"
|
||||
},
|
||||
"responseType": "json"
|
||||
}'
|
||||
```
|
||||
|
||||
### 第二步:轮询任务状态
|
||||
|
||||
每隔 10 秒调用一次,直到 `status` 为 `"Success"` 或 `"Fail"`。将 `TASK_ID` 替换为第一步返回的 `task_id`。
|
||||
|
||||
```bash
|
||||
PORT=$(cat ~/.desirecore/agent-service.port)
|
||||
TASK_ID="第一步返回的task_id"
|
||||
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\": \"/query/video_generation?task_id=${TASK_ID}\",
|
||||
\"method\": \"GET\",
|
||||
\"responseType\": \"json\"
|
||||
}"
|
||||
```
|
||||
|
||||
轮询响应(进行中):
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"task_id": "task_xxx",
|
||||
"status": "Processing",
|
||||
"file_id": ""
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
轮询响应(完成):
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"data": {
|
||||
"task_id": "task_xxx",
|
||||
"status": "Success",
|
||||
"file_id": "file_xxx"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### 第三步:获取视频下载链接
|
||||
|
||||
将 `FILE_ID` 替换为第二步完成响应中的 `file_id`。
|
||||
|
||||
```bash
|
||||
PORT=$(cat ~/.desirecore/agent-service.port)
|
||||
FILE_ID="第二步返回的file_id"
|
||||
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\": \"/files/retrieve?file_id=${FILE_ID}\",
|
||||
\"method\": \"GET\",
|
||||
\"responseType\": \"json\"
|
||||
}"
|
||||
```
|
||||
|
||||
从响应中提取 `data.file.download_url`。
|
||||
|
||||
### 第四步:下载并上传到 media-store
|
||||
|
||||
下载 URL 有 24 小时时效,必须立即下载并保存到本地 media-store。
|
||||
|
||||
```bash
|
||||
PORT=$(cat ~/.desirecore/agent-service.port)
|
||||
VIDEO_URL="第三步获取的download_url"
|
||||
curl -sL "$VIDEO_URL" -o /tmp/minimax-video.mp4 && \
|
||||
curl -sk -X POST "https://127.0.0.1:${PORT}/api/media/upload" \
|
||||
-F "file=@/tmp/minimax-video.mp4;type=video/mp4"
|
||||
```
|
||||
|
||||
从 JSON 响应中提取 `mediaId` 字段。
|
||||
|
||||
### 第五步:用 dc-media 协议展示视频
|
||||
|
||||
在你的回复文本中直接写 Markdown 图片语法(前端会自动识别视频扩展名并渲染播放器):
|
||||
|
||||
```
|
||||

|
||||
```
|
||||
|
||||
### 错误处理
|
||||
|
||||
- `status: "Fail"`:视频生成失败,向用户说明
|
||||
- `success: false` + `error: "未找到匹配的供应商"`:未配置 MiniMax Media Provider
|
||||
- `success: false` + `error: "未配置 API Key"`:未填写 API Key
|
||||
- **额度不足**(`statusCode: 429`、`insufficient_quota`、`balance` 相关错误):文生视频无法降级(Fast 模型不支持 T2V),告知用户额度不足;图生视频可换用 `MiniMax-Hailuo-2.3-fast` 从第一步重试
|
||||
- 轮询超过 10 分钟未完成:告知用户任务可能超时
|
||||
|
||||
### 注意事项
|
||||
|
||||
- MiniMax 视频生成是异步的,通常需要 2-10 分钟
|
||||
- 轮询间隔建议 10 秒
|
||||
- 下载 URL 有 24 小时时效
|
||||
- 如果用户未明确要求,默认不传 duration 和 resolution(使用 API 默认值)
|
||||
Reference in New Issue
Block a user