Agnes 免费/限时免费标注 + 免费标签间距对齐(老板 2026-09-24)

老板两件事:
1) Agnes 的模型也要标免费或限时免费 —— 之前只有 OpenCode 的 space-bunny-free 有标注;
2) 免费标签跟模型名的间隔不一样,优化。

免费标注:
- 口径(照官方措辞,按 bullet 切块判定,不关键词泛扫):
  · OpenCode 价格表 Input/Output = Free(原逻辑)
  · Agnes 定价页「### 当前优惠」:当前(均)免费 → 免费;当前限时免费 → 限时免费
  坑:Agnes 视频 agnes-video-2.5 那条 bullet 写着「输入图片前 5 张免费」——
  那是计费公式的免费额度、不是模型免费,所以只认严格措辞「当前免费 / 当前均免费 /
  均免费 / 限时免费」,且只认反引号里的完整 id(agnes-video-2.5 是
  agnes-video-2.5-flash 的子串,字符串包含会串味)。
- 配置:free: true(免费)+ 新增 free_limited: true(限时免费)。
  落盘 7 条:3.0-flash / 2.5-flash / image-2.0-flash / image-2.1-flash /
  image-2.5-flash / video-v2.0 = 免费;video-2.5-flash = 限时免费。
- scripts/sync_models.py:新增 _agnes_free_map() / _set_agnes_free(),免费标注纳入
  漂移比对 + --apply 落盘(官方改口径 → 整行撤掉标注),回读校验新增 Agnes 免费位检查;
  新增模型块也会带上标注。
- 后端:ModelInfo.free_limited + /v1/models 带出 free_limited(别名随目标继承)。
- 前端:标签文案 免费 / 限时免费(中英各 +2 键,i18n 755/755 对称),提示语同步更新
  (原文案只提 OpenCode Go 计划,已不准确)。

间距:
- 根因:.st-row 是 flex(gap:8px),.name-free 又加 margin-left:6px → 标签左侧 8+6=14px、
  右侧 8px,与其它行「模型名 → 供应商名」的 8px 节奏不一致。
- 修法:.st-row .name-free { margin-left: 0 }(表格单元格是行内排布、无 flex gap,
  那边保留 6px)。同源最小页实测:修前 14/8,修后 8/8。

测试:新增 test_agnes_free_map_rules、test_agnes_free_apply_and_revoke_round_trip
(含 撤标注/限时→免费/幂等/相邻手写注释不被碰);195 passed / 0 failed。
This commit is contained in:
api-gateway committed 2026-09-24 13:49:48 +08:00
1 parent e3e8cac54f
commit aabd473b33
10 files changed
+312 -12

No files matched your search

+3
View File
@@ -1227,6 +1227,8 @@ def _models_payload():
# 2026-09-21: 免费模型标注(官方标 Free)—— 前端「能力」列据此打「免费」标签,
# 接口调用方也能提前知道这个模型不计费。
"free": bool(m.get("free")),
# 2026-09-24: 免费是否带期限(限时免费)—— 前端标签文案据此切换
"free_limited": bool(m.get("free_limited")),
# 第二十五轮: 暴露模型级强制参数(如 {"temperature": 1})。前端据此标挂锁,
# API 调用方也能提前知道自己传的采样参数会被上游要求覆盖。
"params": dict(m.get("params") or {}),
@@ -1256,6 +1258,7 @@ def _models_payload():
"vision": bool(aminfo.vision),
# 2026-09-21: 免费位随目标继承(与 vision / params 同一份事实来源)
"free": bool(aminfo.free),
"free_limited": bool(aminfo.free_limited),
"params": dict(aminfo.params or {}),
"protocols": list(ALIAS_PROTOCOLS),
"alias_of": aminfo.id, "alias_note": spec.note})