perf: 上下文分级裁剪与Agent完成性保障

This commit is contained in:
voocel
2026-03-15 22:52:17 +08:00
parent 568ef0b1d1
commit c913a49ffd
15 changed files with 358 additions and 112 deletions

View File

@@ -76,7 +76,6 @@ func (p *Progress) NextChapter() int {
type ContextProfile struct {
SummaryWindow int // 加载最近 N 章摘要
TimelineWindow int // 加载最近 N 章时间线
FullContext bool // true = 忽略窗口,全量加载
Layered bool // true = 启用分层摘要加载(卷摘要+弧摘要+章摘要)
}
@@ -84,11 +83,11 @@ type ContextProfile struct {
func NewContextProfile(totalChapters int) ContextProfile {
switch {
case totalChapters <= 15:
return ContextProfile{FullContext: true}
return ContextProfile{SummaryWindow: 10, TimelineWindow: 10}
case totalChapters <= 50:
return ContextProfile{SummaryWindow: 5, TimelineWindow: 10}
return ContextProfile{SummaryWindow: 5, TimelineWindow: 8}
default:
return ContextProfile{SummaryWindow: 3, TimelineWindow: 8, Layered: true}
return ContextProfile{SummaryWindow: 3, TimelineWindow: 5, Layered: true}
}
}