Keep conversational replies semantically grounded
This commit is contained in:
@@ -329,6 +329,19 @@ func semanticReply(message string, result SemanticResult, previousFocus *situati
|
||||
return "Исправление записано отдельно, и я вижу здесь ещё новую рабочую просьбу; история сохранена без переписывания."
|
||||
}
|
||||
return "Исправление записано новым сообщением; прежняя история сохранена."
|
||||
case interaction.SpeechActConversational:
|
||||
lower := strings.ToLower(message)
|
||||
if strings.Contains(lower, "спасибо") || strings.Contains(lower, "благодар") {
|
||||
return "Пожалуйста."
|
||||
}
|
||||
if strings.Contains(lower, "привет") || strings.Contains(lower, "здравств") {
|
||||
return "Здравствуйте."
|
||||
}
|
||||
return "Я рядом."
|
||||
case interaction.SpeechActConfirmation:
|
||||
return "Хорошо."
|
||||
case interaction.SpeechActRejection:
|
||||
return "Понял."
|
||||
case interaction.SpeechActQuestion:
|
||||
lower := strings.ToLower(message)
|
||||
if previousFocus != nil && (strings.Contains(lower, "сейчас") || strings.Contains(lower, "что мы") || strings.Contains(lower, "делаем")) {
|
||||
|
||||
@@ -43,6 +43,16 @@ func TestInterpretUtteranceNamingPreferenceIsAccepted(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestInterpretUtteranceThanksHasNaturalConversationalReply(t *testing.T) {
|
||||
result := interpretForTest(t, "спасибо", nil, "")
|
||||
if result.Interpretation.SpeechAct != interaction.SpeechActConversational {
|
||||
t.Fatalf("expected conversational act, got %s", result.Interpretation.SpeechAct)
|
||||
}
|
||||
if result.Reply != "Пожалуйста." {
|
||||
t.Fatalf("unexpected thanks reply: %q", result.Reply)
|
||||
}
|
||||
}
|
||||
|
||||
func TestInterpretUtteranceDirectiveRecordsOutcomeWithoutExecution(t *testing.T) {
|
||||
result := interpretForTest(t, "Поменяй базу на УПО1.", activeFocus("upo", "УПО"), "")
|
||||
if result.Interpretation.SpeechAct != interaction.SpeechActDirective {
|
||||
|
||||
Reference in New Issue
Block a user