docs(comments): 注释中文化 · internal/runtime/history(15 文件,纯替换)
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

- 只翻注释/文档字符串:剥离注释后代码行逐字节不变(机械校验只剩 4 条行尾注释的翻译,代码前缀全等)
- 交叉引用(design/16 §4.6、D4/B3、0010 迁移文件名)逐字保留
- 保留未译技术词:DDL/rowid/LIKE/LEFT JOIN/DTO/rune/WS/actor 及全部标识符与表名
- 顺带副作用:store.go、session_persona_test.go 由注释文字改变而变得 gofmt 干净(未运行 gofmt -w)
This commit is contained in:
AskaEth committed 2026-10-04 12:28:48 +08:00
1 parent b0fbb8bc0d
commit 09fba77f87
15 files changed
+430 -516

No files matched your search

+6 -9
View File
@@ -5,15 +5,12 @@ import (
"fmt"
)
// ListAfter returns up to limit messages for sessionID strictly newer than after
// (created_at > after) in oldest-first order, for forward incremental catch-up: a
// client that reconnected passes the newest createdAt it has already seen and pulls
// only what it missed, however many messages that is (the "before" cursor only walks
// backwards and cannot recover a gap larger than one page). When platform is non-empty
// the page is further restricted to messages carrying that source platform, exactly as
// in List. rowid breaks created_at ties so messages written in the same millisecond
// keep their insertion order. The returned slice is non-nil; limit is clamped to
// [1, maxPageLimit].
// ListAfter 按最旧优先返回 sessionID 中严格新于 after(created_at > after)的
// 至多 limit 条消息,用于前向增量追赶:重连的客户端传入自己已见过的最新
// createdAt,只拉取错过的部分,无论有多少条("before" 游标只能向后走,无法
// 恢复大于一页的空洞)。platform 非空时把该页进一步限制为携带该来源平台的
// 消息,与 List 完全一致。rowid 打破 created_at 的并列,使同一毫秒写入的
// 消息保持插入顺序。返回切片非 nil;limit 钳制到 [1, maxPageLimit]。
func (s *Store) ListAfter(ctx context.Context, sessionID string, after int64, limit int, platform string) ([]Message, error) {
limit = clampLimit(limit)
query := `SELECT id, session_id, role, content, mode, mood, image, thinking, platform, device_id, sender_name, adapter_id, persona_id, created_at