Files
ai-agent/internal/ai/runtime/graphs/analyze_conversation_graph_test.go
T

32 lines
936 B
Go
Raw Normal View History

package graphs
import (
"testing"
"code.tczkiot.com/wlw/ai-agent/internal/models"
"code.tczkiot.com/wlw/ai-agent/internal/pkg/enums"
)
func TestBuildAnalyzeConversationResult_RecommendsHandoffForComplaint(t *testing.T) {
conversation := models.Conversation{
LastMessageSummary: "用户反馈被重复扣费,并要求人工处理",
}
messages := []models.Message{
{SenderType: enums.IMSenderTypeCustomer, Content: "你们重复扣费了,我要投诉并转人工"},
}
got := buildAnalyzeConversationResult(conversation, messages, AnalyzeConversationInput{
NeedHumanHandoff: true,
})
if got.UserIntent != "handoff_request" {
t.Fatalf("expected handoff_request, got %q", got.UserIntent)
}
if got.RiskLevel != "high" {
t.Fatalf("expected high risk, got %q", got.RiskLevel)
}
if got.RecommendedNextAction != "handoff_to_human" {
t.Fatalf("expected handoff_to_human, got %q", got.RecommendedNextAction)
}
}