|
|
@ -66,7 +66,7 @@ public class ChatPipeline { |
|
|
* <li>未启用 RAG(普通对话 / 严格隔离下 KB 拒绝)→ 用原始 message、基础 system</li> |
|
|
* <li>未启用 RAG(普通对话 / 严格隔离下 KB 拒绝)→ 用原始 message、基础 system</li> |
|
|
* <li>寒暄/闲聊(IntentRouter 或寒暄词命中)→ 同上,跳过 KB 检索</li> |
|
|
* <li>寒暄/闲聊(IntentRouter 或寒暄词命中)→ 同上,跳过 KB 检索</li> |
|
|
* <li>FAQ 命中 → 直接返回标准答案,不调用 ChatClient</li> |
|
|
* <li>FAQ 命中 → 直接返回标准答案,不调用 ChatClient</li> |
|
|
* <li>RAG 生成 → 资料块注入 system,重写后查询作为 user 消息</li> |
|
|
|
|
|
|
|
|
* <li>RAG 生成 → 资料块注入 system,原始 message 作为 user 消息(重写查询仅用于检索)</li> |
|
|
* </ul> |
|
|
* </ul> |
|
|
* |
|
|
* |
|
|
* @param ctx 对话上下文 |
|
|
* @param ctx 对话上下文 |
|
|
@ -128,9 +128,9 @@ public class ChatPipeline { |
|
|
globalPrompt, null, null, "FAQ", null, null, rag.faqMatchResult()); |
|
|
globalPrompt, null, null, "FAQ", null, null, rag.faqMatchResult()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// RAG 生成:资料块注入 system,重写后查询作为 user 消息 |
|
|
|
|
|
|
|
|
// RAG 生成:资料块注入 system,原始 message 作为 user 消息(重写查询仅用于检索) |
|
|
String finalSystem = baseSystem + ragPipeline.buildRagContextBlock(rag.contextText()); |
|
|
String finalSystem = baseSystem + ragPipeline.buildRagContextBlock(rag.contextText()); |
|
|
return new ChatRequest(ctx, rag.rewrittenQuery(), finalSystem, Optional.empty(), |
|
|
|
|
|
|
|
|
return new ChatRequest(ctx, ctx.message(), finalSystem, Optional.empty(), |
|
|
globalPrompt, rag.contextText(), rag.documents() != null ? rag.documents().size() : 0, "RAG", |
|
|
globalPrompt, rag.contextText(), rag.documents() != null ? rag.documents().size() : 0, "RAG", |
|
|
rag.searchMode(), rag.documents(), null); |
|
|
rag.searchMode(), rag.documents(), null); |
|
|
} |
|
|
} |
|
|
|