Route independent chat actions separately
CI / test (push) Successful in 1m6s
CI / test (pull_request) Successful in 1m1s

This commit is contained in:
m
2026-08-25 05:39:31 +03:00
parent e9eb529d6e
commit aece914fb8
3 changed files with 48 additions and 7 deletions
@@ -69,6 +69,13 @@ func TestStripAssistantVocative(t *testing.T) {
}
}
func TestIndependentRequestParts(t *testing.T) {
parts := IndependentRequestParts("Дед, узнай погоду в Сочи и найди ресторан")
if len(parts) != 2 || parts[0] != "узнай погоду в Сочи" || parts[1] != "найди ресторан" {
t.Fatalf("unexpected request parts: %#v", parts)
}
}
func TestTravelSearchClarification(t *testing.T) {
if got := TravelSearchClarification("Найди билеты", nil); got == "" {
t.Fatal("underspecified travel request must ask for missing route and date")
+22
View File
@@ -25,6 +25,28 @@ func StripAssistantVocative(message string) string {
return trimmed
}
// IndependentRequestParts keeps separate user actions visible to the
// orchestrator. It is intentionally limited to the ordinary coordinating
// conjunction; the cognitive route remains responsible for ambiguous prose.
func IndependentRequestParts(message string) []string {
cleaned := StripAssistantVocative(message)
parts := strings.Split(cleaned, " и ")
if len(parts) < 2 {
return []string{cleaned}
}
result := make([]string, 0, len(parts))
for _, part := range parts {
part = strings.TrimSpace(part)
if part != "" {
result = append(result, part)
}
}
if len(result) < 2 {
return []string{cleaned}
}
return result
}
// TravelSearchClarification keeps an incomplete travel request in dialogue
// instead of reducing it to an unrelated generic web search.
func TravelSearchClarification(message string, history []interaction.HumanUtterance) string {