Reject identity boilerplate over creative fallback
CI / test (push) Successful in 1m31s
CI / test (pull_request) Successful in 1m31s

This commit is contained in:
m
2026-08-25 14:02:42 +03:00
parent beddb78469
commit 906d71b35f
2 changed files with 4 additions and 3 deletions
+3 -2
View File
@@ -517,11 +517,12 @@ func (g *gateway) handleChatMessage(w http.ResponseWriter, r *http.Request) {
}
func isBoilerplateAdvisory(value string) bool {
switch strings.ToLower(strings.TrimSpace(value)) {
normalized := strings.ToLower(strings.TrimSpace(value))
switch normalized {
case "я рядом.", "я рядом", "понял.", "понял", "принял.", "принял":
return true
default:
return false
return strings.Contains(normalized, "я — домов") || strings.Contains(normalized, "я - домов") || strings.Contains(normalized, "меня зовут домов")
}
}
+1 -1
View File
@@ -24,7 +24,7 @@ func TestLocalChatContextIncludesDomovoyIdentityAndOptionalActiveProject(t *test
}
func TestBoilerplateAdvisoryDoesNotReplaceUsefulFallback(t *testing.T) {
for _, value := range []string{"Я рядом", "Понял.", "Принял."} {
for _, value := range []string{"Я рядом", "Понял.", "Принял.", "Я — Домовой, ваш помощник."} {
if !isBoilerplateAdvisory(value) {
t.Fatalf("%q was not recognized as boilerplate", value)
}