Adding debug stuff

This commit is contained in:
AllfatherHatt 2025-03-16 13:48:36 +01:00
parent 341a68c045
commit b843a4ef58
2 changed files with 8 additions and 6 deletions

View File

@ -229,9 +229,14 @@ class ReginaldCog(PermissionsMixin, BlacklistMixin, MemoryMixin, commands.Cog):
# chat message.
response = await client.chat.completions.create(**completion_args)
response_text = response.choices[0].message.content.strip()
if response_text.startswith("Reginald:"):
response_text = response_text[len("Reginald:"):].strip()
if response.choices and response.choices[0].message and response.choices[0].message.content:
response_text = response.choices[0].message.content.strip()
if response_text.startswith("Reginald:"):
response_text = response_text[len("Reginald:"):].strip()
else:
print("DEBUG: OpenAI response was empty or malformed:", response)
response_text = "⚠️ No response received from AI."
return response_text
except OpenAIError as e:

View File

@ -18,9 +18,6 @@ def get_current_weather(location: str) -> str:
def get_weather_forecast(location: str, days: int = 14, dt: str = '2025-03-24') -> str:
weather = Weather(location=location)
response = weather.forecast(days=days, dt=dt)
print(f"DEBUG: Forecast API Response: {response}")
return json.dumps(weather.forecast(days=days, dt=dt))