feat(pipeline): inject QuotedContext at LLM prompt stage

This commit is contained in:
nullkey
2026-04-01 21:27:32 +08:00
committed by lyingbug
parent 4e7922c8a1
commit dc5046ad2a
5 changed files with 60 additions and 1 deletions
+7 -1
View File
@@ -193,6 +193,12 @@ func buildIMQARequest(
// frontend toggle; for IM channels the user has no per-message toggle,
// so we derive it from the agent config (the single source of truth).
webSearchEnabled := customAgent != nil && customAgent.Config.WebSearchEnabled
quotedContext := formatQuotedContext(quote)
if quotedContext != "" {
// Note: using context.Background() because buildIMQARequest is a pure function without ctx.
// This debug log won't carry trace/span IDs — acceptable for a debug-level log.
logger.Debugf(context.Background(), "[IM] QuotedContext set: length=%d", len(quotedContext))
}
return &types.QARequest{
Session: session,
Query: query,
@@ -201,7 +207,7 @@ func buildIMQARequest(
KnowledgeBaseIDs: kbIDs,
UserMessageID: userMessageID,
WebSearchEnabled: webSearchEnabled,
QuotedContext: formatQuotedContext(quote),
QuotedContext: quotedContext,
}
}