Skip to content

LLM 产出按 language 生成中英文,生成层缓存按语言判定(i18n C3) - #268

Merged
zj1123581321 merged 13 commits into
mainfrom
card/VideoTranscriptAPI-20261019-05
Oct 19, 2026
Merged

zj1123581321 merged 13 commits into
mainfrom
card/VideoTranscriptAPI-20261019-05

Conversation

@zj1123581321

@zj1123581321 zj1123581321 commented Oct 19, 2026 •

Copy link
Copy Markdown
Collaborator

概要

C3:LLM 产出(总结 / 笔记 / 章节)按全局 language 生成中英文,生成层缓存按语言判定。设计依据 docs/sessions/vta-i18n-261019/design.md「方案要点」3、4、5 与「关键不变式」1、4、5。

  • 中文 prompt 原样不动(测试锁定与 Base 字节一致);英文 prompt 原生撰写于 llm/prompts/en.py,llm/prompts/localized.py 按 get_language() 选择。
  • 英文篇幅系数 1.8(英文 prompt 模块常量,作用于总结预算与 min_summary_threshold);英文章节标题至多 12 词、本地截断 48 字符。
  • artifact_provenance 生成层记录 language(缺字段视为 zh-CN)。语言不一致的判定只有一个计算点 cache_manager.language_mismatched_generation_layers,只用于「是否复用」:transcription 分层补层、llm_ops、generate_notes 准入。get_cache 不过滤,结果页在重生成前照常展示旧语言产物。
  • 重生成时打 LANGUAGE-MISMATCH-REGENERATE layer=… old=… new=… WARNING。
  • 说话人兜底占位名:zh-CN 说话人N 不变,en Speaker N。
  • 校对层不受 language 影响(仍按内容语言选 prompt)。

验证

  • uv run --frozen pytest -q tests/unit/i18n_llm tests/llm tests/unit/test_cache_manager.py tests/unit/test_view_token_resolver.py …(主脑在合入当前 main 后复跑全绿)
  • 红验:说话人与缓存判定新测试在 Base 708352f6 上为断言失败
  • make test(执行器报告退出码 0;CI 复核)

已知限制

  • 未在真实模型上验证英文总结质量(本机无真实 LLM 凭据);另开 issue 跟踪。
  • 分享卡不单独做语言判定,随总结重生成删除重建。

审查处置

独立审查(Codex,verdict docs/sessions/vta-i18n-261019/reviews/C3-llm-output-verdict.md,见提交 b338095):

  • 采纳并修复:英文笔记长度判定按语言系数缩放(P2);总结最短长度阈值 coordinator 与 processor 统一计算;summary-ratio 统计按总结产出语言取系数;章节标题长度常量每种语言一处定义(P3)。
  • 不采纳:「分享卡无语言 provenance、切语言不重生成」。api/services/llm_ops.py 中总结每次重新生成都先删除旧 llm_share_card.json、再按新总结写新卡,分享卡语言恒等于总结语言;总结层的语言判定已覆盖分享卡,单独为分享卡记 provenance 会再引入一个与总结层重复的判定点。

🤖 Generated with Claude Code

zj1123581321 and others added 8 commits October 19, 2026 20:48
C3 先用测试锁死 prompts/__init__.py 与中文 builder 产出,避免后续英文路径改写中文正文。

Agent-Executor: grok-pi
Agent-Model: grok-4.6
Agent-Effort: high
Dispatch-Id: dlg-20261019-123838-df4d56
Task-Id: VideoTranscriptAPI-20261019-05
中文 prompt 模块保持不动;总结/笔记/章节走 localized 访问函数。英文预算系数 1.8。

Agent-Executor: grok-pi
Agent-Model: grok-4.6
Agent-Effort: high
Dispatch-Id: dlg-20261019-123838-df4d56
Task-Id: VideoTranscriptAPI-20261019-05
zh-CN 保持说话人N,en 输出 Speaker N;复合推测名沿用该前缀。

Agent-Executor: grok-pi
Agent-Model: grok-4.6
Agent-Effort: high
Dispatch-Id: dlg-20261019-123838-df4d56
Task-Id: VideoTranscriptAPI-20261019-05
不一致时 get_cache 隐藏该层,llm_ops 打 LANGUAGE-MISMATCH-REGENERATE;校对层不重跑。

Agent-Executor: grok-pi
Agent-Model: grok-4.6
Agent-Effort: high
Dispatch-Id: dlg-20261019-123838-df4d56
Task-Id: VideoTranscriptAPI-20261019-05
LANGUAGE-MISMATCH-REGENERATE 断言已红验;scope check 绿。

Agent-Executor: grok-pi
Agent-Model: grok-4.6
Agent-Effort: high
Dispatch-Id: dlg-20261019-123838-df4d56
Task-Id: VideoTranscriptAPI-20261019-05
get_cache 不再按语言隐藏生成层;transcription 与 generate_notes 共用 language_mismatched_generation_layers。

Agent-Executor: grok-pi
Agent-Model: grok-4.6
Agent-Effort: high
Dispatch-Id: dlg-20261019-135859-60717b
Task-Id: VideoTranscriptAPI-20261019-05
分享卡无 provenance,缺字段被当成 zh-CN,会把已匹配的英文总结每次都重跑。

Agent-Executor: grok-pi
Agent-Model: grok-4.6
Agent-Effort: high
Dispatch-Id: dlg-20261019-142938-142def
Task-Id: VideoTranscriptAPI-20261019-05
非法 JSON 仍 fail-loud;语言判定用同一份 payload,不再在准入段调用 get_cache。

Agent-Executor: grok-pi
Agent-Model: grok-4.6
Agent-Effort: high
Dispatch-Id: dlg-20261019-142938-142def
Task-Id: VideoTranscriptAPI-20261019-05
zj1123581321 and others added 5 commits October 19, 2026 23:33
Agent-Executor: codex-pi
Agent-Model: gpt-6-luna
Agent-Effort: xhigh
Dispatch-Id: dlg-20261019-152921-f1ed10
Task-Id: VideoTranscriptAPI-20261019-05
Agent-Executor: codex-pi
Agent-Model: gpt-6-luna
Agent-Effort: xhigh
Dispatch-Id: dlg-20261019-152921-f1ed10
Task-Id: VideoTranscriptAPI-20261019-05
Agent-Executor: codex-pi
Agent-Model: gpt-6-luna
Agent-Effort: xhigh
Dispatch-Id: dlg-20261019-152921-f1ed10
Task-Id: VideoTranscriptAPI-20261019-05
Agent-Executor: codex-pi
Agent-Model: gpt-6-luna
Agent-Effort: xhigh
Dispatch-Id: dlg-20261019-152921-f1ed10
Task-Id: VideoTranscriptAPI-20261019-05
@zj1123581321
zj1123581321 marked this pull request as ready for review October 19, 2026 16:52
@github-actions

Copy link
Copy Markdown

Advisory review

OCR 复核:原始 8 条 → 实锤 4 / 驳回 0 / 未定 4(另有 0 条超预算未复核) OpenCodeReview advisory 补充评审:8 条评论,14 个文件

Findings

@github-actions

Copy link
Copy Markdown

Required Gate v2 — 状态面板

当前状态:pass · 可合并

当前裁决:code_pass / primary_pass

PR 累计主审轮(影子):1/5 · collecting

历史可能不完整:1 个制品处理失败:URLError;1 个历史重建预算耗尽

Gate 历史(v1;来源为持久化 gate_terminal 制品)

Run Attempt Head 状态 PR 累计主审轮(影子) 收件人动作
39273571034 1 324421e skipped — 无需动作(主审未跑,绿≠过审)
39278924004 1 fd4ed0b fail — 要修代码
39279121675 1 7f33df5 fail — 要修代码
39279358161 1 228f148 fail — 要修代码
39279727544 1 4745aa8 skipped — 无需动作(主审未跑,绿≠过审)
39289217809 1 64f8898 fail — 要修代码
39289243767 1 64f8898 pass 1/5 · collecting 可合并

历史行按 run_id + run_attempt 去重并只增不删;删除本评论后可由 gate_terminal 制品重建。

@zj1123581321
zj1123581321 merged commit 341dc87 into main Oct 19, 2026
20 of 26 checks passed
@zj1123581321
zj1123581321 deleted the card/VideoTranscriptAPI-20261019-05 branch October 19, 2026 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant