diff --git a/matrixbot/commands.py b/matrixbot/commands.py index db46e7c..3c989f5 100644 --- a/matrixbot/commands.py +++ b/matrixbot/commands.py @@ -15,7 +15,7 @@ from utils import send_text, send_html, send_reaction, edit_html, sanitize_input from wordle import handle_wordle from config import ( MAX_DICE_SIDES, MAX_DICE_COUNT, BOT_PREFIX, ADMIN_USERS, - OLLAMA_URL, OLLAMA_MODEL, BALL_MODEL, ASK_MODEL, COOLDOWN_SECONDS, + OLLAMA_URL, OLLAMA_MODEL, CREATIVE_MODEL, ASK_MODEL, COOLDOWN_SECONDS, MINECRAFT_RCON_HOST, MINECRAFT_RCON_PORT, MINECRAFT_RCON_PASSWORD, RCON_TIMEOUT, MIN_USERNAME_LENGTH, MAX_USERNAME_LENGTH, ) @@ -276,7 +276,7 @@ async def cmd_8ball(client: AsyncClient, room_id: str, sender: str, args: str): async with session.post( f"{OLLAMA_URL}/api/chat", json={ - "model": BALL_MODEL, + "model": CREATIVE_MODEL, "stream": False, "messages": [ {"role": "system", "content": system_msg}, @@ -299,7 +299,7 @@ async def cmd_8ball(client: AsyncClient, room_id: str, sender: str, args: str): html = ( f'🎱 {answer}
' f'{args}' - + (f'
via {_model_label(BALL_MODEL)}' if used_llm else "") + + (f'
via {_model_label(CREATIVE_MODEL)}' if used_llm else "") + (f'
[debug] prompt: {q_for_prompt}' if debug else "") ) await send_html(client, room_id, plain, html) @@ -489,7 +489,7 @@ async def cmd_8ball(client: AsyncClient, room_id: str, sender: str, args: str): async with aiohttp.ClientSession(timeout=timeout) as session: async with session.post( f"{OLLAMA_URL}/api/generate", - json={"model": BALL_MODEL, "prompt": prompt, "stream": False}, + json={"model": CREATIVE_MODEL, "prompt": prompt, "stream": False}, ) as response: data = await response.json() raw = _normalize_caps(data.get("response", "").strip()) @@ -513,7 +513,7 @@ async def cmd_8ball(client: AsyncClient, room_id: str, sender: str, args: str): html = ( f'🎱 {answer}
' f'{args}' - + (f'
via {_model_label(BALL_MODEL)}' if used_llm else "") + + (f'
via {_model_label(CREATIVE_MODEL)}' if used_llm else "") + (f'
[debug] prompt: {q_for_prompt}' if debug else "") ) await send_html(client, room_id, plain, html) @@ -543,7 +543,7 @@ async def cmd_8ball(client: AsyncClient, room_id: str, sender: str, args: str): async with session.post( f"{OLLAMA_URL}/api/generate", json={ - "model": BALL_MODEL, + "model": CREATIVE_MODEL, "prompt": ( "You are the magic 8-ball. Give a short, creative, one-sentence prediction in response to the question. " "Your answer should feel like a fortune — mysterious, slightly cryptic, or funny. " @@ -566,7 +566,7 @@ async def cmd_8ball(client: AsyncClient, room_id: str, sender: str, args: str): html = ( f'🎱 {answer}
' f'{args}' - + (f'
via {_model_label(BALL_MODEL)}' if used_llm else "") + + (f'
via {_model_label(CREATIVE_MODEL)}' if used_llm else "") + (f'
[debug] prompt: {question}' if debug else "") ) await send_html(client, room_id, plain, html) @@ -1680,7 +1680,7 @@ async def _generate_wyr() -> dict | None: async with aiohttp.ClientSession(timeout=timeout) as session: async with session.post( f"{OLLAMA_URL}/api/chat", - json={"model": BALL_MODEL, "stream": False, "messages": messages}, + json={"model": CREATIVE_MODEL, "stream": False, "messages": messages}, ) as response: data = await response.json() text = data.get("message", {}).get("content", "").strip() @@ -1728,7 +1728,7 @@ async def cmd_wyr(client: AsyncClient, room_id: str, sender: str, args: str): f'🅰️ {wyr["option_a"]}
' f'🅱️ {wyr["option_b"]}

' f'React with 🅰️ or 🅱️ — results in 30 seconds!
' - f'via {_model_label(BALL_MODEL)}' + f'via {_model_label(CREATIVE_MODEL)}' ) resp = await send_html(client, room_id, plain, html) @@ -1817,7 +1817,7 @@ async def _generate_riddle() -> dict | None: async with session.post( f"{OLLAMA_URL}/api/chat", json={ - "model": BALL_MODEL, + "model": CREATIVE_MODEL, "stream": False, "messages": [ {"role": "system", "content": system_msg}, @@ -1876,7 +1876,7 @@ async def cmd_riddle(client: AsyncClient, room_id: str, sender: str, args: str): f'🧩 Riddle!
' f'
{riddle}
' f'Type your answer in chat — 60 seconds on the clock!
' - f'via {_model_label(BALL_MODEL)}' + f'via {_model_label(CREATIVE_MODEL)}' ) await send_html(client, room_id, plain, html) @@ -2012,7 +2012,7 @@ async def cmd_roast(client: AsyncClient, room_id: str, sender: str, args: str): async with session.post( f"{OLLAMA_URL}/api/chat", json={ - "model": BALL_MODEL, + "model": CREATIVE_MODEL, "stream": False, "messages": [ {"role": "system", "content": system_msg}, @@ -2033,7 +2033,7 @@ async def cmd_roast(client: AsyncClient, room_id: str, sender: str, args: str): html = ( f'🔥 Roasting {display_name}...
' f'
{roast}
' - f'via {_model_label(BALL_MODEL)}' + f'via {_model_label(CREATIVE_MODEL)}' ) await send_html(client, room_id, plain, html) diff --git a/matrixbot/config.py b/matrixbot/config.py index 551bd9b..01ed68a 100644 --- a/matrixbot/config.py +++ b/matrixbot/config.py @@ -19,7 +19,7 @@ LOG_LEVEL = os.getenv("LOG_LEVEL", "INFO") # Integrations OLLAMA_URL = os.getenv("OLLAMA_URL", "http://10.10.10.157:11434") OLLAMA_MODEL = os.getenv("OLLAMA_MODEL", "phi4-mini:latest") -BALL_MODEL = os.getenv("BALL_MODEL", "huihui_ai/llama3.2-abliterate:3b") +CREATIVE_MODEL = os.getenv("CREATIVE_MODEL", "huihui_ai/llama3.2-abliterate:3b") ASK_MODEL = os.getenv("ASK_MODEL", "phi4-mini:latest") MINECRAFT_RCON_HOST = os.getenv("MINECRAFT_RCON_HOST", "10.10.10.67") MINECRAFT_RCON_PORT = int(os.getenv("MINECRAFT_RCON_PORT", "25575"))