From 6004eadd61c4f53c041b683e684449e3f910d4bf Mon Sep 17 00:00:00 2001 From: david Date: Tue, 31 Mar 2026 15:10:02 -0300 Subject: made it so it reads the system prompt and parameters from a file (this was vibecoded but it works so it's okay) --- main.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'main.py') 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 blocks in case the model ignores think=False, thank you claude -- cgit v1.3-2-g0d8e