docs(comments): 注释中文化 · internal/runtime/model + internal/services/backthink(54 文件,纯替换)
- 只翻注释/文档字符串:`go/scanner` 剥注释后按 token 序列+literal 逐 token 比对,**54/54 文件 SAME**;
改动文件总行数与 HEAD 漂移 = 0(严格 1:1,无合并/拆行)
- 裁决编号与 design 节号逐字保留(03.4.1/03.4.2/03.4.3/14.4.1/14.4.5/07.4.2-4、design/04 §3.1/§3.2 等);
`chat_template_kwargs` / `enable_thinking` / `reasoning_effort` / `thinking:{type}` 字段名与形状说明未动
- 存疑译法(已登记):`persona` 在叙事语境用「角色」、标识符语境保留 `persona`(仓库既有模块本身混用);
`rung`→「级」;`provider` 存在「提供商/提供者」两种落笔(可按需一键统一)
- 复核:build/vet 绿 + 两包测试绿;gofmt 干净;残留英文注释 0 条
- 既有存量(未修,只报告):`model/anthropic_test.go` 612 行 >500;`applyAnthropicEvent` 115 行 >80
This commit is contained in:
1 parent
f5cf117482
commit
3dc1232bc2
54 files changed
+1923
-1923
No files matched your search
@@ -13,8 +13,8 @@ import (
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/config/runtimeconfig"
|
||||
)
|
||||
|
||||
// newFallbackDispatchServer serves two chain steps from one endpoint: the
|
||||
// "main" model fails so the chain moves on, every other model succeeds.
|
||||
// newFallbackDispatchServer 由一个端点服务两个链步骤:
|
||||
// "main" 模型失败以便链继续前进,其它所有模型成功。
|
||||
func newFallbackDispatchServer(t *testing.T, ch chan<- capturedRequest) *httptest.Server {
|
||||
t.Helper()
|
||||
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
@@ -42,8 +42,8 @@ func chatOnce(t *testing.T, chain *Chain) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestChain_Chat_GroupBudgetAppliesToPrimary asserts the active group's own
|
||||
// maxTokens is applied to a request that carries no explicit budget.
|
||||
// TestChain_Chat_GroupBudgetAppliesToPrimary 断言生效组自己的
|
||||
// maxTokens 会作用于未携带显式预算的请求。
|
||||
func TestChain_Chat_GroupBudgetAppliesToPrimary(t *testing.T) {
|
||||
t.Parallel()
|
||||
ch := make(chan capturedRequest, 1)
|
||||
@@ -57,8 +57,8 @@ func TestChain_Chat_GroupBudgetAppliesToPrimary(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestChain_Chat_ExplicitRequestWinsOverGroupBudget asserts an explicit
|
||||
// Request.MaxTokens is never overridden (the small review/judge budgets).
|
||||
// TestChain_Chat_ExplicitRequestWinsOverGroupBudget 断言显式的
|
||||
// Request.MaxTokens 绝不会被覆盖(用于小额的评审/裁判预算)。
|
||||
func TestChain_Chat_ExplicitRequestWinsOverGroupBudget(t *testing.T) {
|
||||
t.Parallel()
|
||||
ch := make(chan capturedRequest, 1)
|
||||
@@ -75,8 +75,8 @@ func TestChain_Chat_ExplicitRequestWinsOverGroupBudget(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestChain_Chat_FallbackEndAppliesEnvBudget asserts the last-resort budget only
|
||||
// reaches the final fallback step, never the primary.
|
||||
// TestChain_Chat_FallbackEndAppliesEnvBudget 断言兜底预算只
|
||||
// 到达最后的降级步骤,绝不到达主步骤。
|
||||
func TestChain_Chat_FallbackEndAppliesEnvBudget(t *testing.T) {
|
||||
t.Parallel()
|
||||
primaryCh := make(chan capturedRequest, 1)
|
||||
@@ -97,8 +97,8 @@ func TestChain_Chat_FallbackEndAppliesEnvBudget(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestChain_Chat_GroupBudgetWinsOverFallbackEnv asserts a group maxTokens beats
|
||||
// the last-resort env budget even on the final fallback step.
|
||||
// TestChain_Chat_GroupBudgetWinsOverFallbackEnv 断言组的 maxTokens 胜过
|
||||
// 兜底 env 预算,即便在最后的降级步骤上。
|
||||
func TestChain_Chat_GroupBudgetWinsOverFallbackEnv(t *testing.T) {
|
||||
t.Parallel()
|
||||
primaryCh := make(chan capturedRequest, 1)
|
||||
@@ -116,9 +116,9 @@ func TestChain_Chat_GroupBudgetWinsOverFallbackEnv(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestChain_Chat_SingleStepIgnoresFallbackEnv asserts a chain with no fallback
|
||||
// model (one step = the primary) never gets the last-resort budget, so the
|
||||
// adapter default is preserved.
|
||||
// TestChain_Chat_SingleStepIgnoresFallbackEnv 断言没有降级
|
||||
// 模型(单步 = 主模型)的链绝不会拿到兜底预算,因此
|
||||
// 适配器默认值得以保留。
|
||||
func TestChain_Chat_SingleStepIgnoresFallbackEnv(t *testing.T) {
|
||||
t.Parallel()
|
||||
ch := make(chan capturedRequest, 1)
|
||||
@@ -132,8 +132,8 @@ func TestChain_Chat_SingleStepIgnoresFallbackEnv(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestRuntimeLLM_GroupMaxTokensEndToEnd proves the models.json maxTokens field
|
||||
// reaches the provider request body through the real runtime stack.
|
||||
// TestRuntimeLLM_GroupMaxTokensEndToEnd 证明 models.json 的 maxTokens 字段
|
||||
// 经真实运行时栈到达提供商请求体。
|
||||
func TestRuntimeLLM_GroupMaxTokensEndToEnd(t *testing.T) {
|
||||
ch := make(chan capturedRequest, 1)
|
||||
srv := newCompletionServer(t, http.StatusOK, "application/json", okCompletion, ch)
|
||||
@@ -156,8 +156,8 @@ func TestRuntimeLLM_GroupMaxTokensEndToEnd(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestRuntimeLLM_FallbackEndAppliesEnvBudget proves LLM_FALLBACK_MAX_TOKENS is
|
||||
// wired from config through buildSnapshot into the final fallback step.
|
||||
// TestRuntimeLLM_FallbackEndAppliesEnvBudget 证明 LLM_FALLBACK_MAX_TOKENS
|
||||
// 由配置经 buildSnapshot 接线到最后的降级步骤。
|
||||
func TestRuntimeLLM_FallbackEndAppliesEnvBudget(t *testing.T) {
|
||||
ch := make(chan capturedRequest, 2)
|
||||
srv := newFallbackDispatchServer(t, ch)
|
||||
|
||||
Reference in new issue
Block a user