This commit is contained in:
Slipstream 2025-04-28 22:38:45 -06:00
parent 786b8c5e97
commit 9edc7d7629
Signed by: slipstream
GPG Key ID: 13E498CE010AC6FD
2 changed files with 1 additions and 13 deletions

View File

@ -752,13 +752,3 @@ async def get_internal_ai_json_response(
logger.error(f"Error in get_internal_ai_json_response ({task_description}): {type(e).__name__}: {e}", exc_info=True)
error_occurred = e # Capture the exception object
final_parsed_data = None
finally:
# Log the call using the utility function
elapsed_time = time.monotonic() - start_time
try:
# Pass the simplified payload for logging
await log_internal_api_call(cog, task_description, request_payload_for_logging, final_parsed_data, error_occurred, elapsed_time)
except Exception as log_e:
logger.error(f"Error logging internal API call: {log_e}", exc_info=True)
return final_parsed_data

View File

@ -714,12 +714,10 @@ def calculate(cog: commands.Cog, expression: str) -> Dict[str, Any]:
else: result_str = repr(result) # Fallback
print(f"Calculation result: {result_str}")
# Return only the result string on success, as expected by some agent frameworks
return result_str
return {"expression": expression, "result": result_str, "status": "success"}
except Exception as e:
error_message = f"Unexpected error during calculation: {str(e)}"
print(error_message); traceback.print_exc()
# Return error message as string on failure
return {"error": error_message, "expression": expression}
async def run_python_code(cog: commands.Cog, code: str) -> Dict[str, Any]: