Preserve explicit memory confirmations
CI / test (push) Successful in 1m14s
CI / test (pull_request) Successful in 1m26s

This commit is contained in:
m
2026-08-25 21:13:26 +03:00
parent 113c5ab965
commit 5d4c3877b1
3 changed files with 35 additions and 2 deletions
+9
View File
@@ -170,6 +170,15 @@ func IsIdentityInquiry(message string) bool {
return containsToken(tokens, "зовут") || containsToken(tokens, "имя")
}
// IsExplicitMemoryInstruction recognizes a direct request to retain the
// following human-provided context. It deliberately does not interpret the
// content as a verified fact: the conversation owner keeps the original
// utterance and its provenance.
func IsExplicitMemoryInstruction(message string) bool {
tokens := semanticTokens(message)
return len(tokens) > 0 && containsStem(tokens[0], "запомни", "помни")
}
func BuildDeterministicCandidate(message string, corrects interaction.HumanUtteranceID, millis int64) interaction.SemanticCandidate {
id, _ := ids.New()
tokens := semanticTokens(message)
+6
View File
@@ -255,6 +255,12 @@ func TestNamingPreferenceIsSemanticAndProducesNaturalAcceptance(t *testing.T) {
if !IsIdentityInquiry("ты кто?") || !IsIdentityInquiry("как тебя зовут") {
t.Fatal("identity variants should be recognized")
}
if !IsExplicitMemoryInstruction("запомни: сокращение — это источник для поиска") {
t.Fatal("explicit memory instruction was not recognized")
}
if IsExplicitMemoryInstruction("что ты помнишь обо мне?") {
t.Fatal("memory inventory question must not be treated as an instruction")
}
}
func TestMemoryInventoryRequestIsSemantic(t *testing.T) {