38 lines
1.5 KiB
Go
38 lines
1.5 KiB
Go
package main
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
"git.cin.su/m/Assistant/contracts/capability"
|
|
interactiondomain "git.cin.su/m/Assistant/modules/interaction/domain"
|
|
)
|
|
|
|
func TestHouseholdResearchAndActionRoutesRemainIndependent(t *testing.T) {
|
|
candidate := interactiondomain.BuildDeterministicCandidate("проверь погоду в Казани, найди кафе рядом и напомни вечером позвонить", "", time.Unix(10, 0).UnixMilli())
|
|
planned := buildChatRoutePlan(interactiondomain.SemanticResult{NeedsCognition: candidate.NeedsCognition, CapabilityHints: candidate.CapabilityHints})
|
|
want := map[chatRouteKind]bool{chatRouteResearch: false, chatRouteConversation: false, chatRouteAction: false}
|
|
for _, route := range planned {
|
|
if _, ok := want[route.Kind]; ok {
|
|
want[route.Kind] = true
|
|
}
|
|
}
|
|
for kind, present := range want {
|
|
if !present {
|
|
t.Fatalf("route %s missing for mixed household request: candidate=%+v routes=%+v", kind, candidate, planned)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestHouseholdCreativeRouteDoesNotUseResearch(t *testing.T) {
|
|
candidate := interactiondomain.BuildDeterministicCandidate("расскажи сказку о Колобке", "", time.Unix(10, 0).UnixMilli())
|
|
for _, hint := range candidate.CapabilityHints {
|
|
if capability.CapabilityKind(hint) == capability.CapabilityKindWebResearch {
|
|
t.Fatalf("creative request selected web research: %+v", candidate)
|
|
}
|
|
}
|
|
if !interactiondomain.IsCreativeRequest("расскажи сказку о Колобке") {
|
|
t.Fatal("creative request was not recognized")
|
|
}
|
|
}
|