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

Method deduplicate

pkg/knowledge/rag.go:670–682  ·  view source on GitHub ↗

deduplicate 去重

(items []*RetrievalItem)

Source from the content-addressed store, hash-verified

668
669// deduplicate 去重
670func (r *RAG) deduplicate(items []*RetrievalItem) []*RetrievalItem {
671 seen := make(map[string]bool)
672 var result []*RetrievalItem
673
674 for _, item := range items {
675 if !seen[item.Item.ID] {
676 seen[item.Item.ID] = true
677 result = append(result, item)
678 }
679 }
680
681 return result
682}
683
684func containsItem(items []*KnowledgeItem, target *KnowledgeItem) bool {
685 for _, item := range items {

Callers 1

RetrieveMultiHopMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected