package intent_test import ( "context" "testing" "chat-agent-system/internal/maturity" "chat-agent-system/internal/intent" ) func TestExpectationPlusNewPlan_AffirmAndQueryReg(t *testing.T) { intent.SetFeatureFlagsForTest(intent.FeatureFlags{MultiIntentEnabled: true}) defer intent.ResetFeatureFlagsForTest() rec := intent.NewRecognizer() ctx := &intent.ContextSnapshot{ CurrentStage: string(maturity.StageV01_Triage), PendingExpectation: &intent.PendingExpectation{ ExpectedIntent: intent.IntentAdvanceStage, AllowAffirmative: true, DefaultOption: &intent.ExpectationOption{ OptionID: "1", Title: "推进到 V0.5", Intent: intent.IntentAdvanceStage, Slots: map[string]string{intent.SlotTargetStage: "V0.5_feasibility"}, }, }, } res, err := rec.Recognize(context.Background(), "好,请先查法规", ctx) if err != nil { t.Fatalf("recognize: %v", err) } if res.TopIntent.Intent != intent.IntentQueryRegulations { t.Fatalf("expected QUERY_REGULATIONS top, got %s", res.TopIntent.Intent) } if res.IntentPlan == nil { t.Fatal("expected intent_plan for expectation_plus_new") } if len(res.IntentPlan.Steps) != 2 { t.Fatalf("expected 2 steps, got %d", len(res.IntentPlan.Steps)) } if res.IntentFrameV2 == nil || res.IntentFrameV2.Relation != intent.RelationExpectationPlusNew { t.Errorf("expected relation expectation_plus_new, got %+v", res.IntentFrameV2) } if res.IntentPlan.Steps[0].Frame.LegacyIntent != intent.IntentAdvanceStage { t.Errorf("step1 want ADVANCE_STAGE got %s", res.IntentPlan.Steps[0].Frame.LegacyIntent) } if res.IntentPlan.Steps[1].Frame.LegacyIntent != intent.IntentQueryRegulations { t.Errorf("step2 want QUERY_REGULATIONS got %s", res.IntentPlan.Steps[1].Frame.LegacyIntent) } }