From d37d4a899b426666057b40a6d1891109ff1b3470 Mon Sep 17 00:00:00 2001 From: AskaEth Date: Sun, 4 Oct 2026 18:57:58 +0800 Subject: [PATCH] =?UTF-8?q?docs(gateway):=20=E4=BD=99=E4=B8=8B=203=20?= =?UTF-8?q?=E5=A4=84=E8=A1=8C=E5=B0=BE=E6=B3=A8=E9=87=8A=E4=B8=AD=E6=96=87?= =?UTF-8?q?=E5=8C=96=EF=BC=88=E5=AD=98=E9=87=8F=E6=B3=A8=E9=87=8A=E5=80=BA?= =?UTF-8?q?=E7=BB=93=E9=A1=B9=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 事实订正:任务书说「gateway 全包中文注释 ≈ 0」是 2026-10-03 的旧状态;该债早已分批还清(074ffc4 / 355f81d / fe1ff33)。本次清点:70 个非测试文件 / 3493 行 // 注释,仅 6 行无中文。 - 翻 3 行(都是行尾枚举提示,代码前缀逐字节不变):admin_write_iot_automations.go:107 (cron|event)、history.go:20 (main|sub)、history.go:47 (user|assistant);另 3 行是中文多行句子的纯标识符/帧名续行,按规则不翻。 - 机械校验:除这 3 组行尾注释外零输出(即整包 diff 无任何非注释行、非空行改动);gofmt -l 干净(改动前也干净);go build/vet 全树绿;gateway 包测试绿。 - 主会话独立复核:机械校验输出恰为 3 对(代码部分逐字相同)、gofmt 干净、go test ./internal/services/gateway/... 绿。 - 文档订正:开发习惯与约定.md 的「gateway ≈ 0 中文注释」已改写成结项事实(测试文件里的存量注释仍未清点,另记)。 --- internal/services/gateway/admin_write_iot_automations.go | 2 +- internal/services/gateway/history.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/services/gateway/admin_write_iot_automations.go b/internal/services/gateway/admin_write_iot_automations.go index fb96732..0ac79fe 100644 --- a/internal/services/gateway/admin_write_iot_automations.go +++ b/internal/services/gateway/admin_write_iot_automations.go @@ -104,7 +104,7 @@ func mapIotError(err error) *apperr.AppError { // automationCreateRequest 是 POST /api/v1/admin/automations 的请求体。 type automationCreateRequest struct { Name string `json:"name"` - Kind string `json:"kind"` // cron | event + Kind string `json:"kind"` // 取值:cron | event Expression string `json:"expression"` } diff --git a/internal/services/gateway/history.go b/internal/services/gateway/history.go index cbbdcae..56a8b65 100644 --- a/internal/services/gateway/history.go +++ b/internal/services/gateway/history.go @@ -17,7 +17,7 @@ import ( // (main 或 sub)的线上结构。 type historySessionSummary struct { ID string `json:"id"` - Type string `json:"type"` // "main" | "sub" + Type string `json:"type"` // 取值:"main" | "sub" Title string `json:"title,omitempty"` CreatedAt int64 `json:"createdAt"` // Pinned 把会话浮到列表顶部(D5)。它只是排序元数据, @@ -44,7 +44,7 @@ type historySessionSummary struct { // historyLastMessage 是会话摘要中最后消息预览的线上结构。 type historyLastMessage struct { - Role string `json:"role"` // "user" | "assistant" + Role string `json:"role"` // 取值:"user" | "assistant" Content string `json:"content"` CreatedAt int64 `json:"createdAt"` }