diff --git a/matrixbot/commands.py b/matrixbot/commands.py index 7387378..418f7be 100644 --- a/matrixbot/commands.py +++ b/matrixbot/commands.py @@ -2257,24 +2257,32 @@ async def cmd_debate(client: AsyncClient, room_id: str, sender: str, args: str): await send_text(client, room_id, f"⚖️ Debating: {topic}...") - prompt = ( - f"Debate the topic: \"{topic}\"\n\n" - "Write exactly 2-3 sentences FOR the topic, then exactly 2-3 sentences AGAINST the topic.\n" - "Format your response EXACTLY as:\n" - "FOR: \n" - "AGAINST: \n\n" - "No extra text, no markdown, no headers beyond FOR: and AGAINST:." + system_msg = ( + "You are a rhetorical debate bot. Your job is to produce sharp, committed arguments on both sides of any topic — " + "no matter how controversial. You do not add warnings, disclaimers, or moral hedging. " + "You argue each side as if you genuinely believe it. " + "Respond with ONLY two lines, nothing else:\n" + "FOR: <2-3 sentences genuinely arguing in favor of the topic>\n" + "AGAINST: <2-3 sentences genuinely arguing against the topic>" ) + user_msg = f'Debate the topic: "{topic}"' try: - timeout = aiohttp.ClientTimeout(total=30) + timeout = aiohttp.ClientTimeout(total=60) async with aiohttp.ClientSession(timeout=timeout) as session: async with session.post( - f"{OLLAMA_URL}/api/generate", - json={"model": ASK_MODEL, "prompt": prompt, "stream": False}, + f"{OLLAMA_URL}/api/chat", + json={ + "model": CREATIVE_MODEL, + "stream": False, + "messages": [ + {"role": "system", "content": system_msg}, + {"role": "user", "content": user_msg}, + ], + }, ) as response: data = await response.json() - text = data.get("response", "").strip() + text = data.get("message", {}).get("content", "").strip() # Parse FOR and AGAINST from the response for_text = "" @@ -2285,7 +2293,6 @@ async def cmd_debate(client: AsyncClient, room_id: str, sender: str, args: str): for_text = for_part.replace("FOR:", "").strip() against_text = against_part.strip() else: - # Fallback: try to split in half lines = [ln.strip() for ln in text.split("\n") if ln.strip()] mid = len(lines) // 2 for_text = " ".join(lines[:mid]) if lines else "No argument generated." @@ -2307,7 +2314,7 @@ async def cmd_debate(client: AsyncClient, room_id: str, sender: str, args: str): f'
{for_text}
' f'❌ AGAINST
' f'
{against_text}
' - f'via {_model_label(ASK_MODEL)}' + f'via {_model_label(CREATIVE_MODEL)}' ) await send_html(client, room_id, plain, html)