Require destination evidence for ticket results
CI / test (push) Successful in 1m17s

This commit is contained in:
m
2026-08-26 04:17:12 +03:00
parent 4d1a579132
commit da5d06895b
4 changed files with 48 additions and 0 deletions
@@ -85,6 +85,15 @@ func TestLocalSearchClarification(t *testing.T) {
}
}
func TestTicketSearchDestinationUsesRequestDestination(t *testing.T) {
if got := TicketSearchDestination("найди билеты до Ялты сегодня"); got != "Ялты" {
t.Fatalf("ticket destination = %q", got)
}
if got := TicketSearchDestination("найди билеты"); got != "" {
t.Fatalf("destination invented without one: %q", got)
}
}
func TestContinueLocalSearch(t *testing.T) {
history := []interaction.HumanUtterance{{Content: "Найди ближайший ресторан"}}
if got := ContinueLocalSearch("в Сочи", history); got != "Найди ближайший ресторан в Сочи" {
+10
View File
@@ -236,6 +236,16 @@ func ContinueTravelDate(message string, history []interaction.HumanUtterance) st
return strings.TrimSpace(latest + " " + current)
}
// TicketSearchDestination extracts the destination from a ticket request
// without assigning any city or travel-provider meaning in core code.
func TicketSearchDestination(message string) string {
tokens := semanticTokens(StripAssistantVocative(message))
if !containsStemInTokens(tokens, "билет") {
return ""
}
return travelContextDestinationFromTokens(tokens)
}
// 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 {