error handling

This commit is contained in:
Jai Suphavadeeprasit 2025-12-29 20:23:58 -05:00
parent ff8eaf9e3c
commit 5640d7de25
4 changed files with 38 additions and 1 deletions

View file

@ -352,6 +352,14 @@ async def info():
@app.get("/batch")
async def get_batch():
# Check if trainer has registered first
if not hasattr(app.state, "started"):
return {
"status": "error",
"message": "Trainer not registered. Call /register first.",
"batch": [],
}
if not app.state.started:
app.state.started = True