4 Commits

Author SHA1 Message Date
78728e61ed fix(i18n): GPT-5 / o-series 不支持自定义 temperature (#11)
## 接 PR #8 的进一步根因

本地用 personal PAT 端到端验证时发现:付费 quota 已生效、`gpt-5-mini`
可访问、`max_completion_tokens` 修复正确,但 translate.py 仍 400:
```
"message": "Unsupported value: 'temperature' does not support 0.1 with this model. Only the default (1) value is supported."
"param": "temperature"
"code": "unsupported_value"
```

GPT-5 系列和 o-series(o1 / o3 / o4)作为 reasoning models 强制
`temperature=1`,不允许自定义。

## 改动

`call_github_models` 基于 model id 条件设置 `temperature`:
- `gpt-5*` / `*o1*` / `*o3*` / `*o4*` → 不发该字段(用默认 1)
- 其他 model(gpt-4 系列、Anthropic Claude)→ 保持 `temperature=0.1`(翻译任务偏好
deterministic)

## 验证

本地实际跑通:`GITHUB_TOKEN=$(gh auth token) uv run --quiet
scripts/i18n/translate.py skills/markdown`
```
skills/markdown → en-US:
  - calling github/openai/gpt-5-mini for en-US translation ...
  - wrote root SKILL.md with translated body (3838 chars)
```

gpt-5-mini 返回 HTTP 200,3838 字符英文 body 正确写入,Markdown 结构保留。
2026-05-13 18:54:42 +08:00
94652d293c fix(i18n): GPT-5 用 max_completion_tokens 解锁付费 quota 真实翻译能力 (#8)
## 根因

我以为 PR #4 的 translate 失败是 `gpt-5-mini` 在免费 tier 不可用 / payload too large
/ quota 用尽。**实际不是**——付费 quota 已生效,gpt-5-mini 可访问。真正原因是 **OpenAI Chat
Completions 2024+ 契约变化**:

- GPT-5 系列要求 `max_completion_tokens`
- 旧的 `max_tokens` 会被拒绝:`HTTP 400
{"error":{"code":"unsupported_parameter","param":"max_tokens"}}`
- translate.py 之前对 400 也 retry 3 次,连续 retry 撞 RPM 触发
429,把“参数错误”错误诊断为“quota 用尽”

通过本地 curl 直接调 API 确认:gpt-5-mini + max_completion_tokens 返回 HTTP 200。

## 改动

- `call_github_models`: `max_tokens` → `max_completion_tokens`(GPT-4
也接受新参数名,向前兼容)
- `_post_with_retries`: 400 直接 raise 并打印 response body(payload 不会变,retry
浪费 quota);429/5xx retry 前先打印 body 让 budget / rate-limit 详情可见

## 验证

- 本地 curl 用 gpt-5-mini + max_completion_tokens:HTTP 200 通过
- CI 上本 PR 不触及 skill,translate workflow 走 skip 分支(验证 detect-changes
不破坏现有逻辑)
- 合并后再开一个 verify PR 实际触发翻译验证端到端
2026-05-13 18:21:51 +08:00
xyx
0cb3758669 fix: 补全 dashscope-image-gen 和 xiaomi-tts 的 i18n CI 校验 (#4)
## 变更说明

修复 dashscope-image-gen 和 xiaomi-tts 的 i18n CI 校验、补全英文翻译,并连带修复其他 stale
skill 的 source_hash 漂移问题。

### dashscope-image-gen / xiaomi-tts(PR 主线)
- `name` 字段从中文改为目录名(CI rule-1 要求 lowercase ASCII + hyphens)。
- 补全 `metadata.i18n` 块:`locales`、`zh-CN` (含 body 指向
SKILL.zh-CN.md)、`en-US`(含 description / body=./SKILL.md)。
- 新增 `SKILL.zh-CN.md`(zh-CN body 文件)。
- **root SKILL.md 改写为英文 body**(与 SKILL.zh-CN.md 内容对应),由本 PR
手工翻译;`default_locale=en-US`、`source_locale=zh-CN`,与 docs/I18N.md
约定一致:root SKILL.md = default_locale body (en-US)、SKILL.zh-CN.md =
source_locale body (zh-CN)。
- 两 locale 锁为 `translated_by: human` + 正确 `source_hash`。
- 内容质量修复:流程标题 "严格按此两步执行" 改为 "严格按此三步执行";强制规则 2 措辞精确化(/tmp
仅作中转);xiaomi-tts 用户意图映射表中 `response_format` 改为 `audio.format`
与请求体参数表一致;zh-CN.description 改为纯中文。
- locale header 由 shell 转义残留 `<\!--` 修正为标准 `<!-- locale: zh-CN -->`。

### 连带:6 个 main 上已 stale 的 skill(避免 translate workflow 失败)
- `manage-skills` / `minimax-music-gen` / `minimax-video-gen` /
`skill-creator` / `web-access`:`en-US.source_hash` 重新计算为当前 zh-CN source
实际 hash;`translated_by` 由 `ai:claude-opus-4-7` 改为 `human`
以锁定现有翻译不被自动重译覆盖。
- `markdown`:补正 `en-US.source_hash`(之前是占位 `sha256:0000000000000000`)。
- 这些 skill 的 `en-US` 翻译内容保持不变,仅修正元数据。

### scripts/i18n/translate.py 容错增强
- 413 Payload Too Large 时不再 retry(payload 不会变小,retry 浪费时间)。
- 主循环 catch RuntimeError,把单个 skill 的失败写入 `plan["errors"]` 后继续处理下一个
skill,避免一个大文件 fail 整个 workflow。
- `--check` 模式下 plans 含 errors 也 exit 1(之前仅看 needs_translation,broad
except 会把异常吃掉导致误报通过)。

## Test plan

- [x] `i18n-validate` 通过
- [x] `i18n-translate --check` 显示所有 skill `up-to-date` 或 `human-locked,
skipping`
- [x] CI 上 `validate` / `translate` / `wait-for-copilot-review` 全绿
- [ ] Copilot 评审 conversation 全部 resolve
- [ ] Squash merge

---------

Co-authored-by: yi-ge <a@wyr.me>
2026-05-13 12:57:25 +08:00
1f7c8b9673 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>
2026-05-05 00:26:33 +08:00