docs(runtime): internal/runtime/loop 44 个文件注释改中文(逐行 1:1,代码零字节改动)

主人 2026-10-03 拍板「注释一律中文」;本模块按长期分批协议(一个模块一次派工)执行。
注释行数 1329 → 1329 逐行 1:1(含中文 33 → 1304);行尾注释 5 条一并译。
校验:机械校验(非注释改动行)= 空;独立 Go AST 程序(剥注释复渲)证明 44/44 文件代码全等;
全树 go test ./... 58 包 ok / 0 FAIL;交叉编译绿。
gofmt:capacity_loop_test.go / flow.go 改动前即未格式化,按铁律保留原样未动。
This commit is contained in:
AskaEth committed 2026-10-03 22:28:21 +08:00
1 parent 355f81d04a
commit 91e8d7a029
44 files changed
+1315 -1315

No files matched your search

+9 -9
View File
@@ -5,12 +5,12 @@ import (
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/model"
)
// appendToolCallHistory renders the assistant tool-call turn followed by every
// tool result, in call order. When every call carries a provider id (native
// Anthropic tool_use / OpenAI tool_calls), the turn is emitted as native
// tool_use + tool_result blocks so the provider can correlate each result to its
// call; a batch without ids (the legacy JSON-envelope convention) keeps the
// plain RoleTool text feed-back shape.
// appendToolCallHistory 按调用顺序渲染 assistant 工具调用轮,其后是每个
// 工具结果。当每个调用都带 provider id(原生
// Anthropic tool_use / OpenAI tool_calls)时,该轮以原生
// tool_use + tool_result 块发出,使 provider 能把每个结果关联到其
// 调用;不带 id 的批次(旧式 JSON 信封约定)保持
// 纯 RoleTool 文本回灌形态。
func appendToolCallHistory(messages []model.Message, calls []agent.ToolCall, outcomes []ToolOutcome) []model.Message {
native := nativeModelToolCalls(calls)
if len(native) == 0 {
@@ -27,9 +27,9 @@ func appendToolCallHistory(messages []model.Message, calls []agent.ToolCall, out
return messages
}
// nativeModelToolCalls converts a batch into model.ToolCall only when every call
// carries a provider id; a batch without ids (the legacy JSON-envelope
// convention) returns nil so the caller keeps the plain-text feed-back shape.
// nativeModelToolCalls 仅在每个调用都带 provider id 时把批次转换为
// model.ToolCall;不带 id 的批次(旧式 JSON 信封
// 约定)返回 nil,使调用方保持纯文本回灌形态。
func nativeModelToolCalls(calls []agent.ToolCall) []model.ToolCall {
if len(calls) == 0 {
return nil