MCPcopy Create free account
hub / github.com/diillson/chatcli / newKnowledgeManager

Function newKnowledgeManager

cli/ctxmgr/knowledge_query_test.go:18–33  ·  view source on GitHub ↗

newKnowledgeManager builds a manager with one knowledge base attached to session "sess" plus one non-knowledge context that must stay invisible.

(t *testing.T)

Source from the content-addressed store, hash-verified

16// newKnowledgeManager builds a manager with one knowledge base attached to
17// session "sess" plus one non-knowledge context that must stay invisible.
18func newKnowledgeManager(t *testing.T) (*Manager, *FileContext) {
19 t.Helper()
20 m := newTestManager(t)
21 m.AttachEmbeddingProvider(embedding.NewNull())
22
23 kb := knowledgeTestContext()
24 m.contexts[kb.ID] = kb
25 if err := m.AttachContext("sess", kb.ID, 1); err != nil {
26 t.Fatal(err)
27 }
28 full := addTestContext(t, m, "plain-ctx", sampleFiles(), ModeFull, nil)
29 if err := m.AttachContext("sess", full.ID, 2); err != nil {
30 t.Fatal(err)
31 }
32 return m, kb
33}
34
35func TestAttachedKnowledge_FiltersByMode(t *testing.T) {
36 m, kb := newKnowledgeManager(t)

Calls 7

NewNullFunction · 0.92
knowledgeTestContextFunction · 0.85
addTestContextFunction · 0.85
sampleFilesFunction · 0.85
AttachContextMethod · 0.80
newTestManagerFunction · 0.70

Tested by

no test coverage detected