This commit is contained in:
@@ -246,7 +246,8 @@ func TestSynthesisResearchesUnclearKnowledgeThenLearnsAndLinksArticle(t *testing
|
||||
t.Fatal(err)
|
||||
}
|
||||
cfg := config.Config{DataDir: data, KnowledgeDirs: []string{knowledge}, StagingDirs: []string{staging}, OllamaURL: ollama.URL, ChatModel: "qwen3:8b", EmbeddingModel: "embeddinggemma", SearXNGURL: searx.URL, ResearchEnabled: true, SimilarityThreshold: .5, RelationThreshold: .7, ArticleSynthesisEnabled: true, ArticleMinSources: 3, ArticleMaxSources: 6, ArticleMinProductionRatio: .7, ArticleMaxGenerationDepth: 2, ArticleMinConfidence: .7, ArticleMinTextChars: 80, ArticleMinAnswerChars: 180, ArticleMaxResearchQueries: 3, ArticleResearchResults: 4, MaxContextChars: 16000}
|
||||
e := New(cfg, g, activity.New(100))
|
||||
broker := activity.New(100)
|
||||
e := New(cfg, g, broker)
|
||||
if err := e.Scan(context.Background()); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
@@ -287,6 +288,29 @@ func TestSynthesisResearchesUnclearKnowledgeThenLearnsAndLinksArticle(t *testing
|
||||
if chatCalls != 6 {
|
||||
t.Fatalf("expected relation, plan, two consolidations, article and quality calls, got %d", chatCalls)
|
||||
}
|
||||
var resultEvent, ingestEvent *model.Activity
|
||||
for _, event := range broker.Recent() {
|
||||
event := event
|
||||
switch event.Type {
|
||||
case "article.research.results":
|
||||
resultEvent = &event
|
||||
case "article.research.ingested":
|
||||
ingestEvent = &event
|
||||
}
|
||||
}
|
||||
if resultEvent == nil || ingestEvent == nil {
|
||||
t.Fatalf("expected visible SearXNG result and ingest events, results=%v ingest=%v", resultEvent != nil, ingestEvent != nil)
|
||||
}
|
||||
if count, _ := resultEvent.Metadata["result_count"].(int); count != 1 {
|
||||
t.Fatalf("unexpected result count metadata: %#v", resultEvent.Metadata["result_count"])
|
||||
}
|
||||
resultNodeIDs, _ := ingestEvent.Metadata["result_node_ids"].([]string)
|
||||
if len(resultNodeIDs) != 1 || resultNodeIDs[0] != researchID {
|
||||
t.Fatalf("unexpected ingested research nodes: %#v", ingestEvent.Metadata["result_node_ids"])
|
||||
}
|
||||
if ingestEvent.Metadata["animation_min_ms"] != 2000 {
|
||||
t.Fatalf("research animation minimum missing: %#v", ingestEvent.Metadata["animation_min_ms"])
|
||||
}
|
||||
}
|
||||
|
||||
func TestRequestEnrichDoesNotQueueDuplicateCycle(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user