mirror of
https://git.squeakyrat.moe/faggot-chan/
synced 2026-11-04 18:35:45 +01:00
i like to test on prod
This commit is contained in:
1 parent
8c7523f9d2
commit
aa3bfc9a76
2 files changed
+16
-4
No files matched your search
@@ -212,8 +212,14 @@ async def geminichat(websocket):
|
|||||||
if current_user_lines:
|
if current_user_lines:
|
||||||
messages.append({"role": "user", "content": "\n".join(current_user_lines)})
|
messages.append({"role": "user", "content": "\n".join(current_user_lines)})
|
||||||
|
|
||||||
# final isolated turn — the specific message she needs to reply to
|
# final isolated turn — the specific message she needs to reply to, with the speaker named
|
||||||
messages.append({"role": "user", "content": f"[responding to]: {nots(user_input)}"})
|
# 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)
|
# make sure we start with a user turn (gemini rejects empty parts so no empty string here)
|
||||||
if messages and messages[0]["role"] != "user":
|
if messages and messages[0]["role"] != "user":
|
||||||
|
|||||||
@@ -172,8 +172,14 @@ async def ollamachat(websocket):
|
|||||||
if current_user_lines:
|
if current_user_lines:
|
||||||
messages.append({"role": "user", "content": "\n".join(current_user_lines)})
|
messages.append({"role": "user", "content": "\n".join(current_user_lines)})
|
||||||
|
|
||||||
# final isolated turn — the specific message she needs to reply to
|
# final isolated turn — the specific message she needs to reply to, with the speaker named
|
||||||
messages.append({"role": "user", "content": f"[responding to]: {nots(user_input)}"})
|
# 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
|
# 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/")]
|
images = [base64.b64decode(m["data"]) for m in media if m["mime_type"].startswith("image/")]
|
||||||
|
|||||||
Reference in new issue
Block a user