diff --git a/modules/interaction/domain/semantics_test.go b/modules/interaction/domain/semantics_test.go index 0abeaa5..d88f309 100644 --- a/modules/interaction/domain/semantics_test.go +++ b/modules/interaction/domain/semantics_test.go @@ -217,6 +217,15 @@ func TestNearestPlaneUsesTravelContextAndCurrentDay(t *testing.T) { } } +func TestIndependentRequestPartsKeepsCoordinatedEntitiesTogether(t *testing.T) { + if got := IndependentRequestParts("какая разница во времени между Москвой и Шанхаем?"); len(got) != 1 { + t.Fatalf("coordinated entities became independent requests: %#v", got) + } + if got := IndependentRequestParts("проверь погоду в Казани и найди кафе рядом"); len(got) != 2 { + t.Fatalf("independent actions were not decomposed: %#v", got) + } +} + func TestInterpretUtteranceDirectiveRecordsOutcomeWithoutExecution(t *testing.T) { result := interpretForTest(t, "Поменяй базу на УПО1.", activeFocus("upo", "УПО"), "") if result.Interpretation.SpeechAct != interaction.SpeechActDirective { diff --git a/modules/interaction/domain/travel.go b/modules/interaction/domain/travel.go index 7dd0011..bd35504 100644 --- a/modules/interaction/domain/travel.go +++ b/modules/interaction/domain/travel.go @@ -97,6 +97,9 @@ func StripAssistantVocative(message string) string { // conjunction; the cognitive route remains responsible for ambiguous prose. func IndependentRequestParts(message string) []string { cleaned := StripAssistantVocative(message) + if containsToken(semanticTokens(cleaned), "между") { + return []string{cleaned} + } parts := strings.Split(cleaned, " и ") if len(parts) < 2 { return []string{cleaned}