Files
ai-agent/internal/ai/runtime/graphs/analyze_conversation_graph_test.go
T
mlogclub 5d7c10aeab refactor: rename agent widget references to AI agent for consistency
- Updated runtime configuration to use __CS_AI_AGENT_WIDGET_CONFIG__ instead of __CS_AGENT_WIDGET_CONFIG__.
- Changed message types in support host bridge from "cs-agent" to "cs-ai-agent".
- Minified SDK script updated to reflect new AI agent naming conventions.
- Adjusted scrollbar styles in main.scss to use .cs-ai-agent-scrollbar instead of .cs-agent-scrollbar.
2026-05-30 21:19:36 +08:00

52 lines
1.5 KiB
Go

package graphs
import (
"testing"
"cs-ai-agent/internal/models"
"cs-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)
}
}
func TestBuildAnalyzeConversationResult_RecommendsPrepareTicket(t *testing.T) {
conversation := models.Conversation{
LastMessageSummary: "用户要求登记问题并尽快处理",
}
messages := []models.Message{
{SenderType: enums.IMSenderTypeCustomer, Content: "麻烦帮我建个工单,订单一直支付失败"},
}
got := buildAnalyzeConversationResult(conversation, messages, AnalyzeConversationInput{
NeedTicket: true,
})
if got.UserIntent != "ticket_request" {
t.Fatalf("expected ticket_request, got %q", got.UserIntent)
}
if got.RecommendedNextAction != "prepare_ticket" {
t.Fatalf("expected prepare_ticket, got %q", got.RecommendedNextAction)
}
}