mirror of
https://gitcode.com/JianFeeeee/HomeAgent.git
synced 2026-09-21 17:38:10 +00:00
feat(ctx): ContextPolicy tool 上下文策略(§13.8)
- SDK ToolDef 加 ContextPolicy string(默认 none / 可设 prune) - StageAfterToolcall 后检查工具 ContextPolicy=prune → RelevanceContext.Prune - 所有现有测试通过
This commit is contained in:
@ -305,6 +305,12 @@ func (a *Agent) process(input string, stageCtx *sdk.StageContext) (response stri
|
||||
result = r
|
||||
}
|
||||
}
|
||||
// ContextPolicy: prune 工具调用后执行上下文裁剪(§13.8)
|
||||
if def := a.stageHost.ToolDef(tc.Name); def != nil && def.ContextPolicy == "prune" {
|
||||
if a.context != nil {
|
||||
a.context.Prune(result, 20, a.docStore)
|
||||
}
|
||||
}
|
||||
|
||||
msgContent := ""
|
||||
if contentOnce {
|
||||
|
||||
Reference in New Issue
Block a user