feat: add semantic chat route orchestration
This commit is contained in:
@@ -512,6 +512,7 @@ func main() {
|
||||
http.Error(w, "interpret chat message", http.StatusServiceUnavailable)
|
||||
return
|
||||
}
|
||||
routePlan := buildChatRoutePlan(semantic)
|
||||
cognitiveAttempted := false
|
||||
cognitiveAvailable := true
|
||||
semanticInterpretationRequested := shouldRequestSemanticInterpretation(semantic)
|
||||
@@ -625,13 +626,17 @@ func main() {
|
||||
needsCognition = false
|
||||
}
|
||||
researchBacked := false
|
||||
if hasCapabilityHint(semantic.CapabilityHints, "WEB_RESEARCH") && semantic.Interpretation.Clarification != interaction.ClarificationRequired {
|
||||
if hasChatRoute(routePlan, chatRouteResearch) && semantic.Interpretation.Clarification != interaction.ClarificationRequired {
|
||||
if planID, idErr := ids.New(); idErr == nil {
|
||||
result, researchErr := researchClient.SearchWeb(r.Context(), epistemics.WebSearchRequest{
|
||||
researchCtx, cancelResearch := context.WithTimeout(r.Context(), 8*time.Second)
|
||||
result, researchErr := researchClient.SearchWeb(researchCtx, epistemics.WebSearchRequest{
|
||||
Plan: epistemics.ResearchPlan{ID: epistemics.ResearchPlanID("plan:" + planID), Question: utterance.Content, SourceClasses: []string{"web-search"}, FreshnessPolicy: "current"},
|
||||
PropositionKey: "question:" + string(utterance.ID), Query: utterance.Content,
|
||||
})
|
||||
cancelResearch()
|
||||
planningReply, researchBacked = renderResearchReply(result, researchErr)
|
||||
// A failed source must not turn the complete conversation into a
|
||||
// runtime failure or invite an unsupported local guess for a fact.
|
||||
needsCognition = false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user