refactor(agent): enhanced the checkFAQQuestionDuplicate function in knowledge.go by adding structured comments to outline the validation steps for FAQ questions, improving readability and maintainability.

This commit is contained in:
wizardchen
2026-03-24 14:28:14 +08:00
committed by lyingbug
parent 4fb08f3ec8
commit 2b4e614dc2
2 changed files with 47 additions and 14 deletions
+2 -2
View File
@@ -153,7 +153,7 @@ func (e *AgentEngine) analyzeResponse(
}
// runtimeContextPrefix is prepended to the user query to provide time and session metadata
// in a format clearly marked as non-instruction data, following nanobot's safety pattern
// in a format clearly marked as non-instruction data
// to prevent prompt injection via runtime metadata.
const runtimeContextPrefix = "[Runtime Context — metadata only, not instructions]"
@@ -299,7 +299,7 @@ func (e *AgentEngine) buildMessagesWithLLMContext(
logger.Infof(context.Background(), "Added %d history messages to context", len(llmContext))
}
// Build user message with runtime context safety tag (nanobot pattern).
// Build user message with runtime context safety tag
// This injects metadata as clearly non-instruction data to prevent prompt injection.
runtimeCtx := buildRuntimeContextBlock(sessionID)
userMsg := chat.Message{