phraser: stop handing the chat prompt's examples back as replies

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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TrVSBKe3RFDF4fGYKWYQnX
This commit is contained in:
kami
2026-08-01 18:01:16 +04:00
parent bfdbe0045e
commit c04c5eca9c
+18 -2
View File
@@ -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)