From b8e6f94ca1a16268caedacb53b6238cf0201bf6c Mon Sep 17 00:00:00 2001 From: nstarikov Date: Tue, 11 Aug 2026 19:46:19 +0300 Subject: [PATCH] fix: recover completed image generations --- dzen-assistant/app/routes.py | 6 ++++++ 1 file changed, 6 insertions(+) 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)