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
@@ -4,8 +4,8 @@ import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
// openAIChatResponse is the JSON body returned by /chat/completions, for both
|
||||
// the non-streaming payload and each SSE stream chunk.
|
||||
// openAIChatResponse 是 /chat/completions 返回的 JSON 体,既用于
|
||||
// 非流式负载,也用于每个 SSE 流块。
|
||||
type openAIChatResponse struct {
|
||||
ID string `json:"id"`
|
||||
Model string `json:"model"`
|
||||
@@ -13,7 +13,7 @@ type openAIChatResponse struct {
|
||||
Usage *openAIUsage `json:"usage,omitempty"`
|
||||
}
|
||||
|
||||
// openAIChoice is one candidate completion.
|
||||
// openAIChoice 是一个候选补全。
|
||||
type openAIChoice struct {
|
||||
Index int `json:"index"`
|
||||
Message openAIResponseMessage `json:"message"`
|
||||
@@ -21,16 +21,16 @@ type openAIChoice struct {
|
||||
FinishReason string `json:"finish_reason,omitempty"`
|
||||
}
|
||||
|
||||
// openAIResponseMessage is the assistant message inside a non-streaming choice.
|
||||
// openAIResponseMessage 是非流式 choice 里的助手消息。
|
||||
type openAIResponseMessage struct {
|
||||
Role string `json:"role"`
|
||||
Content string `json:"content"`
|
||||
ToolCalls []openAIToolCall `json:"tool_calls,omitempty"`
|
||||
}
|
||||
|
||||
// openAIDelta is the incremental payload inside a stream chunk. Reasoning content
|
||||
// (OpenAI o-series / DeepSeek / DashScope) arrives in ReasoningContent; streaming
|
||||
// function calls arrive in ToolCalls, accumulated per fragment index.
|
||||
// openAIDelta 是流块里的增量负载。推理内容
|
||||
// (OpenAI o 系 / DeepSeek / DashScope)到达 ReasoningContent;流式
|
||||
// 函数调用到达 ToolCalls,按片段索引累积。
|
||||
type openAIDelta struct {
|
||||
Role string `json:"role"`
|
||||
Content string `json:"content"`
|
||||
@@ -38,17 +38,17 @@ type openAIDelta struct {
|
||||
ToolCalls []openAIToolCallDelta `json:"tool_calls"`
|
||||
}
|
||||
|
||||
// openAIToolCallDelta is one streaming function-call fragment. OpenAI emits a
|
||||
// sequence of these sharing the same Index: the ID and Function.Name usually
|
||||
// arrive once (in the first fragment) while Function.Arguments streams across
|
||||
// fragments.
|
||||
// openAIToolCallDelta 是一个流式函数调用片段。OpenAI 会发出一串
|
||||
// 共享同一 Index 的此类片段:ID 与 Function.Name 通常
|
||||
// 只在第一个片段里出现一次,而 Function.Arguments 跨
|
||||
// 多个片段流式到达。
|
||||
type openAIToolCallDelta struct {
|
||||
Index int `json:"index"`
|
||||
ID string `json:"id"`
|
||||
Function openAIToolCallFn `json:"function"`
|
||||
}
|
||||
|
||||
// openAIUsage reports token consumption.
|
||||
// openAIUsage 上报 token 消耗。
|
||||
type openAIUsage struct {
|
||||
PromptTokens int `json:"prompt_tokens"`
|
||||
CompletionTokens int `json:"completion_tokens"`
|
||||
|
||||
Reference in new issue
Block a user