diff --git a/modules/interaction/domain/semantics.go b/modules/interaction/domain/semantics.go index e711893..c320ac4 100644 --- a/modules/interaction/domain/semantics.go +++ b/modules/interaction/domain/semantics.go @@ -71,6 +71,9 @@ func InterpretUtterance(utterance interaction.HumanUtterance, projects []situati result.Relations = append(result.Relations, relations...) } result.Reply = semanticReply(utterance.Content, result, previousFocus) + if isCurrentFocusQuestion(utterance.Content, act) && previousFocus != nil { + result.NeedsCognition = false + } return result, nil } @@ -229,3 +232,11 @@ func semanticReply(message string, result SemanticResult, previousFocus *situati } return FallbackText(result.Interpretation.SpeechAct) } + +func isCurrentFocusQuestion(message string, act interaction.SpeechAct) bool { + if act != interaction.SpeechActQuestion { + return false + } + lower := strings.ToLower(message) + return strings.Contains(lower, "сейчас") || strings.Contains(lower, "что мы") || strings.Contains(lower, "делаем") +} diff --git a/modules/interaction/domain/semantics_test.go b/modules/interaction/domain/semantics_test.go index 90d2288..dee6790 100644 --- a/modules/interaction/domain/semantics_test.go +++ b/modules/interaction/domain/semantics_test.go @@ -61,6 +61,9 @@ func TestInterpretUtteranceQuestionAboutCurrentWorkUsesFocus(t *testing.T) { if !strings.Contains(result.Reply, "Assistant") { t.Fatalf("expected focus-aware reply, got %q", result.Reply) } + if result.NeedsCognition { + t.Fatalf("focus question should be answered from canonical focus without cognition") + } } func TestInterpretUtteranceInheritedFocusForThere(t *testing.T) {