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
@@ -7,9 +7,9 @@ import (
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/model"
|
||||
)
|
||||
|
||||
// thinkingAdapter emits one full thinking segment followed by one text segment,
|
||||
// and records every request it is handed so a test can assert the loop's
|
||||
// reasoning knobs actually reached the model call.
|
||||
// thinkingAdapter 发出一个完整的思考分段,后接一个文本分段,
|
||||
// 并记录它收到的每个请求,使测试能断言循环的
|
||||
// 推理旋钮确实到达了模型调用。
|
||||
type thinkingAdapter struct {
|
||||
reqs []model.Request
|
||||
}
|
||||
@@ -39,7 +39,7 @@ func (a *thinkingAdapter) ChatStream(_ context.Context, req model.Request, on fu
|
||||
return model.Response{Content: "Hello"}, nil
|
||||
}
|
||||
|
||||
// kindsOf returns the event kinds as a set for compact assertions.
|
||||
// kindsOf 把事件 kind 作为集合返回,便于紧凑断言。
|
||||
func kindsOf(events []model.StreamEvent) map[model.StreamKind]int {
|
||||
out := make(map[model.StreamKind]int, len(events))
|
||||
for _, ev := range events {
|
||||
@@ -48,8 +48,8 @@ func kindsOf(events []model.StreamEvent) map[model.StreamKind]int {
|
||||
return out
|
||||
}
|
||||
|
||||
// runThinkingTurn drives one streaming turn through a loop configured with the
|
||||
// given broadcast switch and returns the events OnStream saw.
|
||||
// runThinkingTurn 用给定广播开关配置的循环驱动一个流式 turn,
|
||||
// 并返回 OnStream 见过的事件。
|
||||
func runThinkingTurn(t *testing.T, show *bool) ([]model.StreamEvent, *thinkingAdapter) {
|
||||
t.Helper()
|
||||
ad := &thinkingAdapter{}
|
||||
@@ -66,9 +66,9 @@ func runThinkingTurn(t *testing.T, show *bool) ([]model.StreamEvent, *thinkingAd
|
||||
return streams(), ad
|
||||
}
|
||||
|
||||
// TestRun_ThinkingShowToUserFalseWithholdsThinkingFrames is the showToUser=false
|
||||
// contract: thinking frames never reach the client callback while the body text
|
||||
// segment is delivered untouched (display is gated, the answer is not).
|
||||
// TestRun_ThinkingShowToUserFalseWithholdsThinkingFrames 是 showToUser=false
|
||||
// 的契约:思考帧绝不抵达客户端回调,而正文本
|
||||
// 分段原样投递(展示被门控,答案不受影响)。
|
||||
func TestRun_ThinkingShowToUserFalseWithholdsThinkingFrames(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -90,8 +90,8 @@ func TestRun_ThinkingShowToUserFalseWithholdsThinkingFrames(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestRun_ThinkingShowToUserDefaultBroadcastsThinking keeps the pre-existing
|
||||
// behavior when the option is unset (nil): thinking frames are pushed.
|
||||
// TestRun_ThinkingShowToUserDefaultBroadcastsThinking 在选项未设置
|
||||
// (nil)时保持既有行为:思考帧被推送。
|
||||
func TestRun_ThinkingShowToUserDefaultBroadcastsThinking(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -105,8 +105,8 @@ func TestRun_ThinkingShowToUserDefaultBroadcastsThinking(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestRun_ThinkingShowToUserTrueBroadcastsThinking asserts an explicit true
|
||||
// behaves like the default.
|
||||
// TestRun_ThinkingShowToUserTrueBroadcastsThinking 断言显式 true
|
||||
// 的行为与默认值一致。
|
||||
func TestRun_ThinkingShowToUserTrueBroadcastsThinking(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -117,9 +117,9 @@ func TestRun_ThinkingShowToUserTrueBroadcastsThinking(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestRun_RequestCarriesThinkingKnobs asserts the loop injects its reasoning
|
||||
// options into every model request it builds, so a persona's thinking config is
|
||||
// actually applied rather than validated-and-ignored.
|
||||
// TestRun_RequestCarriesThinkingKnobs 断言循环把它配置的推理
|
||||
// 选项注入它构建的每个模型请求,使某人格的思考配置
|
||||
// 真正被应用,而不是校验后被忽略。
|
||||
func TestRun_RequestCarriesThinkingKnobs(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in new issue
Block a user