fix: recover completed image generations
This commit is contained in:
parent
ece8cea2e2
commit
b8e6f94ca1
1 changed files with 6 additions and 0 deletions
|
|
@ -842,6 +842,12 @@ def active_article_image_generation(article_id: int, request: Request, session:
|
||||||
if not session.get(Article, article_id):
|
if not session.get(Article, article_id):
|
||||||
raise HTTPException(status_code=404, detail="Article not found")
|
raise HTTPException(status_code=404, detail="Article not found")
|
||||||
batch = active_image_batch(session, article_id)
|
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)
|
return Response(status_code=204) if not batch else image_batch_payload(batch)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue