From aa3bfc9a76936d8f5a0a52e6a8fcf6e43551a3b9 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 18 Oct 2026 04:12:57 -0300 Subject: i like to test on prod --- gemini.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gemini.py') diff --git a/gemini.py b/gemini.py index cf1ee05..9f58e65 100644 --- a/gemini.py +++ b/gemini.py @@ -212,8 +212,14 @@ async def geminichat(websocket): if current_user_lines: messages.append({"role": "user", "content": "\n".join(current_user_lines)}) - # final isolated turn — the specific message she needs to reply to - messages.append({"role": "user", "content": f"[responding to]: {nots(user_input)}"}) + # final isolated turn — the specific message she needs to reply to, with the speaker named + # so she doesn't anchor on whoever talked last in the history above + speaker, text = parse_line(user_input) + if speaker and text: + final_turn = f"[responding to {speaker}]: {text}\n(reply only to {speaker}, the lines before this are other people's messages for context)" + else: + final_turn = f"[responding to]: {nots(user_input)}" # couldn't parse it, old format + messages.append({"role": "user", "content": final_turn}) # make sure we start with a user turn (gemini rejects empty parts so no empty string here) if messages and messages[0]["role"] != "user": -- cgit v1.3-2-g0d8e