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:
1 parent
355f81d04a
commit
91e8d7a029
44 files changed
+1315
-1315
No files matched your search
@@ -14,9 +14,9 @@ import (
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/model"
|
||||
)
|
||||
|
||||
// anthropicToolRoundSSE is a native Anthropic stream that thinks, then emits a
|
||||
// tool_use block with an empty text part — the exact shape that starved the old
|
||||
// loop (which only looked for a JSON envelope in Content).
|
||||
// anthropicToolRoundSSE 是一个原生 Anthropic 流:它先思考,然后发出
|
||||
// 一个带空文本部件的 tool_use 块 —— 正是拖垮旧循环(它只在
|
||||
// Content 中寻找 JSON 信封)的那种形态。
|
||||
const anthropicToolRoundSSE = `data: {"type":"message_start","message":{"model":"m","usage":{"input_tokens":10}}}
|
||||
|
||||
data: {"type":"content_block_start","index":0,"content_block":{"type":"thinking","thinking":""}}
|
||||
@@ -37,8 +37,8 @@ data: {"type":"message_stop"}
|
||||
|
||||
`
|
||||
|
||||
// anthropicTextRoundSSE is the follow-up stream: a plain text answer after the
|
||||
// tool result was fed back.
|
||||
// anthropicTextRoundSSE 是后续流:工具结果回灌后的一段
|
||||
// 纯文本答案。
|
||||
const anthropicTextRoundSSE = `data: {"type":"message_start","message":{"model":"m","usage":{"input_tokens":30}}}
|
||||
|
||||
data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}
|
||||
@@ -53,11 +53,11 @@ data: {"type":"message_stop"}
|
||||
|
||||
`
|
||||
|
||||
// TestRun_NativeToolCall_AnthropicAdapter_HTTP exercises the real loop path end
|
||||
// to end through the real AnthropicChatAdapter against a stub /v1/messages
|
||||
// server: round 1 streams a thinking + tool_use block with no text, the loop
|
||||
// must execute it and re-ask, and round 2 must carry the assistant tool_use turn
|
||||
// plus a correlated tool_result and return the model's text (not an empty reply).
|
||||
// TestRun_NativeToolCall_AnthropicAdapter_HTTP 端到端演练真实循环路径:
|
||||
// 经由真实的 AnthropicChatAdapter 打向一个桩 /v1/messages
|
||||
// 服务器:第 1 轮流式输出不带文本的 thinking + tool_use 块,
|
||||
// 循环必须执行它并重新提问,第 2 轮必须携带 assistant tool_use 轮
|
||||
// 以及关联的 tool_result,并返回模型的文本(而非空回复)。
|
||||
func TestRun_NativeToolCall_AnthropicAdapter_HTTP(t *testing.T) {
|
||||
t.Parallel()
|
||||
var mu sync.Mutex
|
||||
|
||||
Reference in new issue
Block a user