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