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

Method compressContext

pkg/knowledge/rag.go:601–609  ·  view source on GitHub ↗

compressContext 压缩上下文

(context string)

Source from the content-addressed store, hash-verified

599
600// compressContext 压缩上下文
601func (r *RAG) compressContext(context string) string {
602 // TODO: 实现更智能的上下文压缩
603 // 现在只是简单截断
604 if len(context) <= r.config.MaxContextLength {
605 return context
606 }
607
608 return context[:r.config.MaxContextLength-3] + "..."
609}
610
611// enhanceQuery 增强查询
612func (r *RAG) enhanceQuery(originalQuery string, items []*RetrievalItem) string {

Callers 1

generateContextMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected