aboutsummaryrefslogtreecommitdiff
path: root/gemini.py
diff options
context:
space:
mode:
authordavid <[email protected]>2026-10-16 05:11:09 -0300
committerdavid <[email protected]>2026-10-16 05:11:09 -0300
commitbc17bc956a4a8f741f828eab1ab8331f9a027217 (patch)
tree62f1e142690be4623a6da7b1bdb371119987e539 /gemini.py
parent387331d1af8796de62ab65d9470cd5fd0f69ae08 (diff)
downloadfaggot-chan-bc17bc956a4a8f741f828eab1ab8331f9a027217.tar.gz
faggot-chan-bc17bc956a4a8f741f828eab1ab8331f9a027217.zip
trying a couple fixes without claude's help
Diffstat (limited to 'gemini.py')
-rw-r--r--gemini.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/gemini.py b/gemini.py
index e73f9d4..2c0501e 100644
--- a/gemini.py
+++ b/gemini.py
@@ -213,7 +213,7 @@ async def geminichat(websocket):
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)}\n(that is the newest message and the only one you answer, the lines above are just context. only the name that starts it is speaking to you, everyone else is someone else)"})
+ messages.append({"role": "user", "content": f"[responding to]: {nots(user_input)}})
# make sure we start with a user turn (gemini rejects empty parts so no empty string here)
if messages and messages[0]["role"] != "user":
@@ -268,6 +268,9 @@ async def geminichat(websocket):
reason = response.prompt_feedback.block_reason if response.prompt_feedback else None
if not reason and response.candidates:
reason = response.candidates[0].finish_reason
+ if "PROHIBITED_CONTENT" in str(reason):
+ await websocket.send(json.dumps({"ok": "google doesn't want me to reply to this :stocking:"}))
+ continue
raise RuntimeError(f"gemini returned no text ({reason})")
# strip <think> blocks just in case, thank you claude