diff --git a/dzen-assistant/app/routes.py b/dzen-assistant/app/routes.py index 4e6b772..8998256 100644 --- a/dzen-assistant/app/routes.py +++ b/dzen-assistant/app/routes.py @@ -842,6 +842,12 @@ def active_article_image_generation(article_id: int, request: Request, session: if not session.get(Article, article_id): raise HTTPException(status_code=404, detail="Article not found") batch = active_image_batch(session, article_id) + if not batch: + batch = session.scalar( + select(ImageGenerationBatch) + .where(ImageGenerationBatch.article_id == article_id) + .order_by(ImageGenerationBatch.created_at.desc()) + ) return Response(status_code=204) if not batch else image_batch_payload(batch)