Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
48dfd364e4 | ||
|
|
e4021523b8 |
@@ -71,6 +71,9 @@ func InterpretUtterance(utterance interaction.HumanUtterance, projects []situati
|
|||||||
result.Relations = append(result.Relations, relations...)
|
result.Relations = append(result.Relations, relations...)
|
||||||
}
|
}
|
||||||
result.Reply = semanticReply(utterance.Content, result, previousFocus)
|
result.Reply = semanticReply(utterance.Content, result, previousFocus)
|
||||||
|
if isCurrentFocusQuestion(utterance.Content, act) && previousFocus != nil {
|
||||||
|
result.NeedsCognition = false
|
||||||
|
}
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -229,3 +232,11 @@ func semanticReply(message string, result SemanticResult, previousFocus *situati
|
|||||||
}
|
}
|
||||||
return FallbackText(result.Interpretation.SpeechAct)
|
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, "делаем")
|
||||||
|
}
|
||||||
|
|||||||
@@ -61,6 +61,9 @@ func TestInterpretUtteranceQuestionAboutCurrentWorkUsesFocus(t *testing.T) {
|
|||||||
if !strings.Contains(result.Reply, "Assistant") {
|
if !strings.Contains(result.Reply, "Assistant") {
|
||||||
t.Fatalf("expected focus-aware reply, got %q", result.Reply)
|
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) {
|
func TestInterpretUtteranceInheritedFocusForThere(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user