fix: add proper error handling for AI generation and log failures
Made-with: Cursor
This commit is contained in:
Binary file not shown.
@@ -347,7 +347,8 @@ class AIController(http.Controller):
|
|||||||
]
|
]
|
||||||
return _json_response(ai.chat_json(messages, action=f"exam_generate_{module}"))
|
return _json_response(ai.chat_json(messages, action=f"exam_generate_{module}"))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return _json_response({"questions": [], "error": str(e)})
|
_logger.exception("exam_generate %s failed: %s", module, e)
|
||||||
|
return _json_response({"questions": [], "error": str(e)}, 500)
|
||||||
|
|
||||||
def _generate_passage(self, ai, body):
|
def _generate_passage(self, ai, body):
|
||||||
topic = body.get("topic", "general knowledge")
|
topic = body.get("topic", "general knowledge")
|
||||||
|
|||||||
Reference in New Issue
Block a user