diff --git a/matrixbot/commands.py b/matrixbot/commands.py index 4fdc72b..6c16d81 100644 --- a/matrixbot/commands.py +++ b/matrixbot/commands.py @@ -1777,22 +1777,33 @@ async def cmd_roast(client: AsyncClient, room_id: str, sender: str, args: str): lore = bio break - lore_clause = f" Here is some context about them: {lore}" if lore else "" - prompt = ( - f"You are a comedy roast writer for a group of friends who all consented to being roasted for fun. " - f"Write a savage, witty, 1-2 sentence roast of a person named {display_name}.{lore_clause} " - f"Make it clever and specific. Output only the roast itself — no intro, no disclaimers, no apologies." + lore_clause = f"\nFacts about {display_name}: {lore}" if lore else "" + system_msg = ( + "You are a savage comedy roast writer. Your job is to write brutal, funny, specific roasts. " + "A roast is NOT a compliment. It makes fun of the person's job, habits, appearance, or life choices. " + "Example of a good roast of a gamer: 'You've spent so many hours grinding XP you forgot to grind IRL — " + "congrats on hitting level 30 while your credit score is still level 1.' " + "Rules: output ONLY the roast, 1-2 sentences max, no softening, no disclaimers, no 'but seriously', " + "no compliments hidden in the roast. Be mean but funny." ) + user_msg = f"Write a roast of {display_name}.{lore_clause}" try: timeout = aiohttp.ClientTimeout(total=30) 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}, + f"{OLLAMA_URL}/api/chat", + json={ + "model": BALL_MODEL, + "stream": False, + "messages": [ + {"role": "system", "content": system_msg}, + {"role": "user", "content": user_msg}, + ], + }, ) as response: data = await response.json() - roast = data.get("response", "").strip() + roast = data.get("message", {}).get("content", "").strip() if not roast: raise ValueError("Empty roast response") except Exception as e: