aboutsummaryrefslogtreecommitdiff
path: root/main.py
diff options
context:
space:
mode:
authordavid <[email protected]>2026-03-31 15:10:02 -0300
committerdavid <[email protected]>2026-03-31 15:10:02 -0300
commit6004eadd61c4f53c041b683e684449e3f910d4bf (patch)
tree97ed15182b0bfae893ea74ce1db2fc5e049de80b /main.py
parent6271325fdee9e0ec234582469ac52f84922fecb6 (diff)
downloadfaggot-chan-6004eadd61c4f53c041b683e684449e3f910d4bf.tar.gz
faggot-chan-6004eadd61c4f53c041b683e684449e3f910d4bf.zip
made it so it reads the system prompt and parameters from a file (this was vibecoded but it works so it's okay)
Diffstat (limited to 'main.py')
-rw-r--r--main.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/main.py b/main.py
index 74533f5..ad5dc4f 100644
--- a/main.py
+++ b/main.py
@@ -4,13 +4,13 @@ import json
import re # thank you claude
import ollama
import websockets
+from pathlib import Path
from websockets.server import serve
from datetime import datetime
chatmodel = "hf.co/Stetsoncody/Llama-3.2-3B-Instruct-abliterated-GGUF:Q4_K_M"
embedmodel = 'hf.co/CompendiumLabs/bge-base-en-v1.5-gguf'
-NUM_THREADS = 6 # hardcoded since threads.txt is gone, change if needed
def times() -> str:
return datetime.now().strftime("%Y-%m-%d %H:%M:%S")
@@ -151,17 +151,12 @@ async def ollamachat(websocket):
messages.insert(0, {"role": "system", "content": system_prompt + rag_block})
+ params = json.loads(Path("config/params.json").read_text())
+
response = ollama.chat(
model=chatmodel,
messages=messages,
- options={
- "temperature": 0.83,
- "top_p": 0.9,
- "top_k": 40,
- "repeat_penalty": 1.1,
- "num_predict": 1024,
- "num_thread": NUM_THREADS,
- }
+ options=params,
)
# strip <think> blocks in case the model ignores think=False, thank you claude