Restore stable replies after cognitive routing
This commit is contained in:
@@ -358,6 +358,29 @@ func semanticReply(message string, result SemanticResult, previousFocus *situati
|
||||
return FallbackText(result.Interpretation.SpeechAct)
|
||||
}
|
||||
|
||||
// StableConversationalReply returns the small set of low-risk conversational
|
||||
// replies whose meaning must remain owned by interaction even after a sampled
|
||||
// cognitive audit or a capability fast path.
|
||||
func StableConversationalReply(message string, act interaction.SpeechAct) (string, bool) {
|
||||
switch act {
|
||||
case interaction.SpeechActConversational:
|
||||
lower := strings.ToLower(message)
|
||||
if strings.Contains(lower, "спасибо") || strings.Contains(lower, "благодар") {
|
||||
return "Пожалуйста.", true
|
||||
}
|
||||
if strings.Contains(lower, "привет") || strings.Contains(lower, "здравств") {
|
||||
return "Здравствуйте.", true
|
||||
}
|
||||
return "Я рядом.", true
|
||||
case interaction.SpeechActConfirmation:
|
||||
return "Хорошо.", true
|
||||
case interaction.SpeechActRejection:
|
||||
return "Понял.", true
|
||||
default:
|
||||
return "", false
|
||||
}
|
||||
}
|
||||
|
||||
func isCurrentFocusQuestion(message string, act interaction.SpeechAct) bool {
|
||||
if act != interaction.SpeechActQuestion {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user