This commit is contained in:
Slipstream 2025-05-13 10:47:27 -06:00
parent 9168da2537
commit 4827fdd450
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD

View File

@ -70,8 +70,12 @@ async def _owoify_text_ai(text: str) -> str:
}
async with aiohttp.ClientSession() as session:
async with session.post(url, headers=headers, json=payload) as resp:
data = await resp.json()
return data["choices"][0]["message"]["content"]
if resp.content_type == "application/json":
data = await resp.json()
return data["choices"][0]["message"]["content"]
else:
text = await resp.text()
raise RuntimeError(f"OpenRouter API returned non-JSON response (status {resp.status}): {text[:500]}")
class OwoifyCog(commands.Cog):
def __init__(self, bot: commands.Bot):