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
@@ -126,6 +126,7 @@ func (s *sessionService) KnowledgeQA(
PipelineState: types.PipelineState{
RewriteQuery: req.Query,
ImageDescription: req.ImageDescription,
QuotedContext: req.QuotedContext,
},
PipelineContext: types.PipelineContext{
EventBus: eventBus.AsEventBusInterface(),
@@ -150,6 +151,9 @@ func (s *sessionService) KnowledgeQA(
if req.ImageDescription != "" && !chatModelSupportsVision {
userContent += "\n\n[用户上传图片内容]\n" + req.ImageDescription
}
if req.QuotedContext != "" {
userContent += "\n\n" + req.QuotedContext
}
chatManage.UserContent = userContent
pipeline = types.NewPipelineBuilder().
@@ -732,6 +736,9 @@ func (s *sessionService) renderFallbackPrompt(ctx context.Context, chatManage *t
if chatManage.ImageDescription != "" && !chatManage.ChatModelSupportsVision {
result += "\n\n[用户上传图片内容]\n" + chatManage.ImageDescription
}
if chatManage.QuotedContext != "" {
result += "\n\n" + chatManage.QuotedContext
}
return result, nil
}