docs(gateway): gateway 剩余文件注释改中文(逐行 1:1,代码零字节改动)
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

主人 2026-10-03 拍板「注释一律中文」;gateway 至此整包注释中文化完成(本会话共 3 批:
已推库 16 个文件 + 本批剩余文件)。
校验:机械校验(非注释改动行)= 空;剥注释后代码文本逐行比对全等(不一致文件数 0);
全树 go test ./... 58 包 ok / 0 FAIL;交叉编译绿。
This commit is contained in:
AskaEth committed 2026-10-03 22:28:25 +08:00
1 parent 91e8d7a029
commit 074ffc4ebf
73 files changed
+2529 -2529

No files matched your search

+12 -12
View File
@@ -2,15 +2,15 @@ package gateway
import "git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/model"
// This file owns the conversation-tail helpers of the session orchestrator
// (design/15 §2.2/§4): the bounded window that continuation resumes from and the
// emptiness check that keeps a vacuous turn from marking a session busy. They are
// pure functions over []model.Message, kept apart from the state machine so the
// orchestrator file stays small.
// 本文件拥有会话编排器的对话尾部辅助件
// (design/15 §2.2/§4):续跑所依据的有界窗口,以及
// 防止空洞回合把会话标记为忙碌的空判定。它们是
// 作用于 []model.Message 的纯函数,与状态机分开
// 放置,使编排器文件保持小。
// boundedTail returns a fresh copy of the last maxTail messages, so continuation
// stays incremental and bounded (design/15 §2.2, §4) and never aliases the input
// slice or another state's tail.
// boundedTail 返回最后 maxTail 条消息的全新副本,使续跑
// 保持增量且有界(design/15 §2.2、§4),且绝不与输入
// 切片或另一个状态的尾部共享底层数组。
func (o *Orchestrator) boundedTail(msgs []model.Message) []model.Message {
if len(msgs) <= o.maxTail {
return append([]model.Message(nil), msgs...)
@@ -20,8 +20,8 @@ func (o *Orchestrator) boundedTail(msgs []model.Message) []model.Message {
return out
}
// messagesEmpty reports whether a turn carries no usable text or image, so the
// orchestrator does not mark a session busy on a vacuous message.
// messagesEmpty 报告回合是否不携带可用文本或图片,使
// 编排器不会因空洞消息把会话标记为忙碌。
func (o *Orchestrator) messagesEmpty(msgs []model.Message) bool {
for _, m := range msgs {
for _, c := range m.Content {
@@ -36,8 +36,8 @@ func (o *Orchestrator) messagesEmpty(msgs []model.Message) bool {
return true
}
// concatMessages returns a new slice combining a and b (never reusing a or b
// backing arrays) so the continuation tail is safe to hand to a concurrent run.
// concatMessages 返回合并 a 与 b 的新切片(绝不复用 a 或 b
// 的底层数组),因此续跑尾部可以安全地交给并发运行。
func concatMessages(a []model.Message, b ...model.Message) []model.Message {
out := make([]model.Message, 0, len(a)+len(b))
out = append(out, a...)