fix: add LOAD_HISTORY to rag_stream pipeline for independent history

Previously, rag_stream relied entirely on the rewrite plugin's
internal loadHistory() to load conversation history. This meant that
when rewrite was disabled (enable_rewrite=false), RAG mode had NO
conversation history at all — multi-turn conversations silently
degraded to single-turn.

Changes:
1. Add LOAD_HISTORY as the first step in rag_stream pipeline,
   ensuring history is always available regardless of rewrite config.

2. Make rewrite plugin reuse chatManage.History if already populated
   by the upstream LOAD_HISTORY step, avoiding duplicate DB queries.

This brings rag_stream in line with chat_history_stream which already
has LOAD_HISTORY as an independent step.
This commit is contained in:
lyingbug
2026-03-20 22:55:26 +00:00
committed by lyingbug
parent 03fda55261
commit 00ac14aabb
2 changed files with 14 additions and 1 deletions
+1
View File
@@ -193,6 +193,7 @@ var Pipline = map[string][]EventType{
CHAT_COMPLETION,
},
"rag_stream": { // Streaming Retrieval Augmented Generation
LOAD_HISTORY, // Load conversation history independently (works even when rewrite is disabled)
REWRITE_QUERY,
CHUNK_SEARCH_PARALLEL, // Parallel: CHUNK_SEARCH + ENTITY_SEARCH
CHUNK_RERANK,