mirror of
https://git.squeakyrat.moe/faggot-chan/
synced 2026-11-04 18:35:45 +01:00
made it so it reads the system prompt and parameters from a file (this was vibecoded but it works so it's okay)
This commit is contained in:
1 parent
6271325fde
commit
6004eadd61
2 files changed
+10
-16
No files matched your search
@@ -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
|
||||
|
||||
Reference in new issue
Block a user