MCPcopy Create free account
hub / github.com/astercloud/aster / ContextWindowManager

Struct ContextWindowManager

pkg/context/window_manager.go:14–35  ·  view source on GitHub ↗

ContextWindowManager 管理对话上下文窗口 实现自动 Token 计数、滑动窗口和智能压缩

Source from the content-addressed store, hash-verified

12// ContextWindowManager 管理对话上下文窗口
13// 实现自动 Token 计数、滑动窗口和智能压缩
14type ContextWindowManager struct {
15 mu sync.RWMutex
16
17 // 配置
18 config WindowManagerConfig
19
20 // Token 计数器
21 tokenCounter TokenCounter
22
23 // 压缩策略
24 compressionStrategy CompressionStrategy
25
26 // 消息历史
27 messages []Message
28
29 // Token 使用跟踪
30 currentTokens int
31 totalMessages int
32
33 // 压缩历史
34 compressionHistory []CompressionEvent
35}
36
37// WindowManagerConfig 窗口管理器配置
38type WindowManagerConfig struct {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected