4928ffc0f7
会话历史(Redis,易失,与长期画像分开)经 MCP 工具进出 Eino 图:
recall 召回历史填 MessagesPlaceholder,写回把本轮 user/assistant 落历史。
- mcp-go: internal/history(go-redis, sundynix:history:<session>, LPUSH+LTRIM 保留近20条,
24h TTL) + 工具 history_get(返回JSON turns)/history_append; main 开 Redis(降级)
- dispatcher Eino: 模板加 MessagesPlaceholder('history'); recall 调 history_get→转 schema.Message;
Handle 累积 answer; memorize 异步 history_append(user+assistant)
- shared: contract.MetaSessionID; gateway: SubmitTask 注入 Meta[session_id](X-Session-ID 头,缺省 default)
- demo.sh: 同会话两轮提交,验证第2轮召回第1轮历史
- 验证: 4 模块 build✓ + 3 e2e PASS; live 跑通——轮1=0轮历史→落库, 轮2 history_get 命中→注入
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
32 lines
1.0 KiB
Modula-2
32 lines
1.0 KiB
Modula-2
module github.com/sundynix/sundynix-mcp-go
|
|
|
|
go 1.24
|
|
|
|
require (
|
|
github.com/redis/go-redis/v9 v9.20.0
|
|
github.com/sundynix/sundynix-shared v0.0.0
|
|
gorm.io/driver/postgres v1.6.0
|
|
gorm.io/gorm v1.31.1
|
|
)
|
|
|
|
require (
|
|
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
|
github.com/jackc/pgpassfile v1.0.0 // indirect
|
|
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
|
|
github.com/jackc/pgx/v5 v5.6.0 // indirect
|
|
github.com/jackc/puddle/v2 v2.2.2 // indirect
|
|
github.com/jinzhu/inflection v1.0.0 // indirect
|
|
github.com/jinzhu/now v1.1.5 // indirect
|
|
github.com/klauspost/compress v1.17.9 // indirect
|
|
github.com/nats-io/nats.go v1.37.0 // indirect
|
|
github.com/nats-io/nkeys v0.4.7 // indirect
|
|
github.com/nats-io/nuid v1.0.1 // indirect
|
|
go.uber.org/atomic v1.11.0 // indirect
|
|
golang.org/x/crypto v0.31.0 // indirect
|
|
golang.org/x/sync v0.10.0 // indirect
|
|
golang.org/x/sys v0.30.0 // indirect
|
|
golang.org/x/text v0.21.0 // indirect
|
|
)
|
|
|
|
replace github.com/sundynix/sundynix-shared => ../sundynix-shared
|