merge acknowledgement routing fix
CI / test (push) Failing after 33s

This commit is contained in:
m
2026-08-30 00:34:34 +03:00
2 changed files with 25 additions and 0 deletions
+13
View File
@@ -278,6 +278,7 @@ func semanticScores(tokens []string, hasQuestionMark bool, explicitCorrection bo
}
questionWords := map[string]struct{}{"кто": {}, "что": {}, "как": {}, "почему": {}, "зачем": {}, "где": {}, "когда": {}, "сколько": {}, "какой": {}, "какая": {}, "какие": {}, "чей": {}}
conversationWords := []string{"привет", "здравствуйте", "спасибо", "ку", "здравствуй"}
confirmationWords := []string{"хорошо", "ладно", "окей", "ок", "понял", "понятно"}
investigateStems := []string{"разбер", "проверь", "проанализ", "исслед", "выясн", "уточн", "подум", "понят", "посмотри", "попроб", "повтор", "снов"}
directiveStems := []string{"сдел", "запуст", "созд", "настро", "добав", "измени", "помен", "использ", "удал", "напом", "подключ", "исправ", "обрати", "спрос", "найд", "посчитай", "рассчитай", "ответь", "вывед"}
explanatoryRequestStems := []string{"расска", "раска", "объяс", "опиш", "покаж", "подскаж", "сообщ"}
@@ -292,6 +293,9 @@ func semanticScores(tokens []string, hasQuestionMark bool, explicitCorrection bo
if containsStem(token, conversationWords...) {
scores[interaction.SpeechActConversational] += 3
}
if containsExactToken(token, confirmationWords...) {
scores[interaction.SpeechActConfirmation] += 3
}
if containsStem(token, investigateStems...) {
scores[interaction.SpeechActRequestToInvestigate] += 3
scores[interaction.SpeechActQuestion]++
@@ -810,6 +814,15 @@ func containsStem(token string, stems ...string) bool {
return false
}
func containsExactToken(token string, words ...string) bool {
for _, word := range words {
if token == word {
return true
}
}
return false
}
func containsStemInTokens(tokens []string, stems ...string) bool {
for _, token := range tokens {
if containsStem(token, stems...) {
+12
View File
@@ -314,6 +314,18 @@ func TestRememberedPreferenceIsNotRenderedAsIdentity(t *testing.T) {
}
}
func TestStableAcknowledgementsDoNotBecomeTravelRequests(t *testing.T) {
for _, message := range []string{"Хорошо", "Ладно", "Понял"} {
candidate := BuildDeterministicCandidate(message, "", time.Unix(10, 0).UnixMilli())
if candidate.PrimarySpeechAct != interaction.SpeechActConfirmation {
t.Fatalf("%q: expected confirmation, got %s", message, candidate.PrimarySpeechAct)
}
if reply, stable := StableConversationalReply(message, candidate.PrimarySpeechAct); !stable || reply != "Хорошо." {
t.Fatalf("%q: stable reply = %q, %t", message, reply, stable)
}
}
}
func TestCreativeRequestsDoNotRouteToWebResearch(t *testing.T) {
for _, message := range []string{"нарисуй круг", "расскажи сказку о колобке"} {
candidate := BuildDeterministicCandidate(message, "", time.Now().UnixMilli())