fix: simplify fallback reply handling in knowledge guard
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"cs-agent/internal/pkg/enums"
|
||||
|
||||
"github.com/cloudwego/eino/schema"
|
||||
"github.com/mlogclub/simple/common/strs"
|
||||
)
|
||||
|
||||
type knowledgeGuardDecision struct {
|
||||
@@ -53,14 +54,10 @@ func resolveKnowledgeFallbackReply(aiAgent models.AIAgent) string {
|
||||
|
||||
func resolveKnowledgeHumanSupportFallback(aiAgent models.AIAgent) string {
|
||||
base := strings.TrimSpace(resolveKnowledgeFallbackReply(aiAgent))
|
||||
if base == "" {
|
||||
if strs.IsBlank(base) {
|
||||
base = "当前知识库暂无明确信息。"
|
||||
}
|
||||
suggestion := "建议你联系人工客服进一步确认。"
|
||||
if strings.Contains(base, suggestion) {
|
||||
return base
|
||||
}
|
||||
return strings.TrimSpace(base + " " + suggestion)
|
||||
return base
|
||||
}
|
||||
|
||||
func buildKnowledgeRuntimeInstruction(answerMode enums.KnowledgeAnswerMode, fallbackReply string) string {
|
||||
|
||||
Reference in New Issue
Block a user