From b025bec777474bc3a32e9db97fec9d031ddb5ec1 Mon Sep 17 00:00:00 2001 From: Mikhail Date: Tue, 18 Aug 2026 16:50:19 +0300 Subject: [PATCH] Improve assistant status probes and cognition routing coverage --- modules/interaction/domain/chat.go | 7 +++++-- modules/interaction/domain/chat_test.go | 3 +++ modules/interaction/domain/semantics_test.go | 3 +++ 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/modules/interaction/domain/chat.go b/modules/interaction/domain/chat.go index 63fc2f7..8a81e9b 100644 --- a/modules/interaction/domain/chat.go +++ b/modules/interaction/domain/chat.go @@ -560,14 +560,17 @@ func containsModelReference(tokens []string) bool { } func isAssistantStatusProbe(primary, secondary interaction.SpeechAct, tokens []string) bool { - if primary != interaction.SpeechActAssertion && primary != interaction.SpeechActCorrection && primary != interaction.SpeechActQuestion && primary != interaction.SpeechActRequestToInvestigate { + if primary != interaction.SpeechActAssertion && primary != interaction.SpeechActCorrection && primary != interaction.SpeechActQuestion && primary != interaction.SpeechActRequestToInvestigate && primary != interaction.SpeechActUnknown { return false } if !(containsToken(tokens, "домовой") || containsToken(tokens, "ассистент") || containsToken(tokens, "бот") || containsToken(tokens, "ты") || containsToken(tokens, "ии") || containsToken(tokens, "ai") || containsToken(tokens, "gpt")) { return false } + if containsToken(tokens, "не") && containsStemInTokens(tokens, "вид", "виж", "понима", "ответ", "отвеч", "работа", "реагир", "слыш", "слуш", "ищ", "уведом", "чувств") { + return true + } for index := 0; index < len(tokens)-1; index++ { - if tokens[index] == "не" && (containsStem(tokens[index+1], "вид", "виж", "понима", "ответ", "работа", "реагир", "слыш", "ищ", "уведом", "чувств")) { + if tokens[index] == "не" && (containsStem(tokens[index+1], "вид", "виж", "понима", "ответ", "отвеч", "работа", "реагир", "слыш", "слуш", "ищ", "уведом", "чувств")) { return true } } diff --git a/modules/interaction/domain/chat_test.go b/modules/interaction/domain/chat_test.go index 5b8ac77..255ee32 100644 --- a/modules/interaction/domain/chat_test.go +++ b/modules/interaction/domain/chat_test.go @@ -87,6 +87,9 @@ func TestDeterministicCandidateTreatsModalExplanationRequestsAsCognitionWorthWit "РАССКАЖИ ПОХОЖЕ ЧТО ПРОИСХОДИТ", "можете обяснить почему база растет", "ты не видишь ии", + "домовой не отвечает", + "домовой не работает", + "домовой не реагирует", } { candidate := BuildDeterministicCandidate(message, "", time.Unix(10, 0).UnixMilli()) if !candidate.NeedsCognition { diff --git a/modules/interaction/domain/semantics_test.go b/modules/interaction/domain/semantics_test.go index 74298d1..a13dd27 100644 --- a/modules/interaction/domain/semantics_test.go +++ b/modules/interaction/domain/semantics_test.go @@ -148,6 +148,9 @@ func TestInterpretUtteranceNaturalRussianHelpflowUsesContextAwareCognitionInput( {message: "СЕЙЧАС ДОМОВОЙ НЕ ВИДИТ ИИ", wantSpeech: "", wantCognition: true, allowNoMatch: true}, {message: "не понимаю меня не понимает ии", wantSpeech: "", wantCognition: true, allowNoMatch: true}, {message: "домовой не вижит ии", wantSpeech: "", wantCognition: true, allowNoMatch: true}, + {message: "домовой не отвечает мне", wantSpeech: "", wantCognition: true, allowNoMatch: true}, + {message: "домовой не слушает меня", wantSpeech: "", wantCognition: true, allowNoMatch: true}, + {message: "домовой не отвечает на команды", wantSpeech: "", wantCognition: true, allowNoMatch: true}, } for _, tc := range cases { result := interpretForTest(t, tc.message, nil, "")