Debug: show raw API response when empty
This commit is contained in:
@@ -172,7 +172,10 @@ class Assistant(commands.Cog):
|
|||||||
try:
|
try:
|
||||||
reply = data["choices"][0]["message"]["content"]
|
reply = data["choices"][0]["message"]["content"]
|
||||||
except (KeyError, IndexError):
|
except (KeyError, IndexError):
|
||||||
return "Unexpected API response."
|
return f"Unexpected API response: {str(data)[:300]}"
|
||||||
|
|
||||||
|
if not reply:
|
||||||
|
return f"Empty response. Raw: {str(data)[:300]}"
|
||||||
|
|
||||||
self.history[key].append({"role": "assistant", "content": reply})
|
self.history[key].append({"role": "assistant", "content": reply})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user