Agent-Mode mit Aufgabenteilung und automatischer Recherche
This commit is contained in:
@@ -145,13 +145,27 @@ func (e *Engine) collectAdaptiveInitialResearch(ctx context.Context, trigger str
|
||||
out := make([]model.ResearchResult, 0)
|
||||
report := articleResearchReport{Rounds: 1}
|
||||
for i, query := range queries {
|
||||
report.Queries++
|
||||
freshnessSensitive := containsFreshnessLanguage(query)
|
||||
inbox := e.sourceInboxResearch(ctx, query, fetchCap, freshnessSensitive)
|
||||
if len(inbox) > 0 {
|
||||
report.InboxResults += len(inbox)
|
||||
report.Accepted += len(inbox)
|
||||
out = uniqueResearchEvidence(append(out, inbox...))
|
||||
}
|
||||
if len(inbox) >= e.Cfg.SourceInboxMinResults || !e.ResearchEnabledForRuntime() {
|
||||
continue
|
||||
}
|
||||
remaining := fetchCap - len(inbox)
|
||||
if remaining < 1 {
|
||||
remaining = 1
|
||||
}
|
||||
language := "en-US"
|
||||
if looksGermanResearchQuery(query) {
|
||||
language = "de-DE"
|
||||
}
|
||||
question := model.ResearchQuestion{GapID: fmt.Sprintf("ADAPTIVE-%d", i+1), Question: query, Critical: true, ExpectActionable: containsActionableLanguage(query)}
|
||||
report.Queries++
|
||||
items, stats := e.executeArticleResearchQueryForSynthesis(ctx, trigger, nodeIDs, question, query, language, 1, attemptedURLs, fetchCap)
|
||||
items, stats := e.executeArticleResearchQueryForSynthesis(ctx, trigger, nodeIDs, question, query, language, 1, attemptedURLs, remaining)
|
||||
report.SearchResults += stats.SearchResults
|
||||
report.Fetched += stats.Fetched
|
||||
report.Accepted += stats.Accepted
|
||||
@@ -307,7 +321,9 @@ func (e *Engine) materializeGroundedResearchEvidence(articleID string, sources [
|
||||
}
|
||||
categories := categoriesFromArticleSources(sources)
|
||||
ids := make([]string, 0, len(results))
|
||||
usedURLs := make([]string, 0, len(results))
|
||||
for _, result := range results {
|
||||
usedURLs = append(usedURLs, result.URL)
|
||||
id := graph.ID("external", result.URL)
|
||||
path, contentHash, err := e.queueResearchEvidence(result)
|
||||
if err != nil {
|
||||
@@ -322,5 +338,8 @@ func (e *Engine) materializeGroundedResearchEvidence(articleID string, sources [
|
||||
e.Graph.UpsertNode(node)
|
||||
ids = append(ids, id)
|
||||
}
|
||||
if e.SourceInbox != nil && len(usedURLs) > 0 {
|
||||
_ = e.SourceInbox.MarkUsed(context.Background(), usedURLs)
|
||||
}
|
||||
return unique(ids)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user