Silently log LLM failures instead of replying to user
When the LLM is offline, post to #bcs-log instead of sending the "brain offline" message in chat. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
12
cogs/chat.py
12
cogs/chat.py
@@ -119,7 +119,17 @@ class ChatCog(commands.Cog):
|
|||||||
await typing_ctx.__aexit__(None, None, None)
|
await typing_ctx.__aexit__(None, None, None)
|
||||||
|
|
||||||
if response is None:
|
if response is None:
|
||||||
response = "I'd roast you but my brain is offline. Try again later."
|
log_channel = discord.utils.get(message.guild.text_channels, name="bcs-log")
|
||||||
|
if log_channel:
|
||||||
|
try:
|
||||||
|
await log_channel.send(
|
||||||
|
f"**LLM OFFLINE** | Failed to generate reply to "
|
||||||
|
f"{message.author.mention} in #{message.channel.name}"
|
||||||
|
)
|
||||||
|
except discord.HTTPException:
|
||||||
|
pass
|
||||||
|
logger.warning("LLM returned no response for %s in #%s", message.author, message.channel.name)
|
||||||
|
return
|
||||||
|
|
||||||
if not image_attachment:
|
if not image_attachment:
|
||||||
self._chat_history[ch_id].append(
|
self._chat_history[ch_id].append(
|
||||||
|
|||||||
Reference in New Issue
Block a user