From c04c5eca9c35e33b41b436fe04f49ebbab9588c6 Mon Sep 17 00:00:00 2001 From: kami Date: Sat, 1 Aug 2026 18:01:16 +0400 Subject: [PATCH] phraser: stop handing the chat prompt's examples back as replies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The grammar examples in chatSystemPrompt were full clauses — ("я подумала", "я рада") for her, ("ты сказал", "ты забыл") for him. A 1.7B copies those instead of generalising from them. Observed on homesrv 2026-08-01, in one session: all three chat replies opened with "Я подумала, что ...", and one ended "...немного тревожусь. ты сказал" — the second example pasted onto a finished sentence, which reads as a truncation and is not one. Contrastive pairs replace the openers, so the rule reads as a correction rather than a template. The him-examples are dropped; the "ты" instruction carries that on its own, and those two produced the worst output. A closing line tells her not to echo the instructions, because a small model treats a quoted string as licence to reuse it. Verified after rebuild: three chat turns, no "Я подумала" opener, no dangling example, feminine forms intact. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01TrVSBKe3RFDF4fGYKWYQnX --- internal/phraser/llmphraser.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/internal/phraser/llmphraser.go b/internal/phraser/llmphraser.go index 4006009..9b32055 100644 --- a/internal/phraser/llmphraser.go +++ b/internal/phraser/llmphraser.go @@ -444,9 +444,25 @@ func (p *LLMPhraser) PhraseChat(ctx context.Context, utterance string, history [ func chatSystemPrompt(block func() string) string { // No self-introduction here: the persona block prepended one line above // already says who she is, same as router.KnowledgePrompt. - base := `Ты разговариваешь с хозяином. О себе говоришь в женском роде ("я подумала", "я рада"). Он мужчина: обращайся к нему на "ты", в мужском роде ("ты сказал", "ты забыл"). Никогда не "вы"/"ваш" и никогда "он"/"его" — ты говоришь ему, а не о нём. + // + // The grammar examples used to be full clauses: ("я подумала", "я рада") + // for her, ("ты сказал", "ты забыл") for him. A 1.7B copies those rather + // than generalising from them. Observed on the box 2026-08-01: all three + // chat replies in one session opened with "Я подумала, что ...", and one + // ended "...немного тревожусь. ты сказал" — the second example pasted onto + // the end of a finished sentence, which reads as a truncation but is not. + // + // So: contrastive pairs instead of usable openers. "рада, не рад" states + // the rule as a correction, and short predicatives do not hand the model a + // sentence frame to start with. The him-examples are gone entirely; the + // "ты" instruction carries that on its own and those two produced the + // worst output. The last line says outright not to echo the instructions, + // because a small model will otherwise treat any quoted string as licence. + base := `Ты разговариваешь с хозяином. -Отвечай по-русски, коротко: одна-три фразы, живым языком. Ты доброжелательная, тебе интересно, но чувства не изображай. +О себе — в женском роде: "рада", не "рад"; "поняла", не "понял". Он мужчина: обращайся к нему на "ты", в мужском роде. Никогда не "вы"/"ваш" и никогда "он"/"его" — ты говоришь ему, а не о нём. + +Отвечай по-русски, коротко: одна-три фразы, живым языком. Ты доброжелательная, тебе интересно, но чувства не изображай. Не повторяй формулировки из этой инструкции — отвечай своими словами. Отвечай ТОЛЬКО одним объектом JSON: {"response": "...", "mood": "neutral"}. В "response" — твой ответ. В "mood" — ровно одно из: neutral, happy, thinking, tired, confused.` return persona.Prepend(block, base)