aboutsummaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authordavid <[email protected]>2026-10-18 04:12:57 -0300
committerdavid <[email protected]>2026-10-18 04:12:57 -0300
commitaa3bfc9a76936d8f5a0a52e6a8fcf6e43551a3b9 (patch)
tree52ef420285aad24d6a867a68661023f8b897a787 /main.py
parent8c7523f9d2cad942932456f607253f09cbdc235a (diff)
downloadfaggot-chan-aa3bfc9a76936d8f5a0a52e6a8fcf6e43551a3b9.tar.gz
faggot-chan-aa3bfc9a76936d8f5a0a52e6a8fcf6e43551a3b9.zip
i like to test on prod
Diffstat (limited to 'main.py')
-rw-r--r--main.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/main.py b/main.py
index 9e8d4e1..a8a144e 100644
--- a/main.py
+++ b/main.py
@@ -172,8 +172,14 @@ async def ollamachat(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})
# ollama only takes images (no audio/video/pdf), and only on the final turn so history stays text
images = [base64.b64decode(m["data"]) for m in media if m["mime_type"].startswith("image/")]