fix(api): handle reasoning and generating polling statuses

BFL's get_result reference documents two intermediate statuses the
Status enum was missing: Reasoning and Generating (returned by FLUX 3
tasks). Status(status) raised ValueError on them, which landed in the
JSON-parsing error handler with a misleading log line. Both now retry
like Pending, and the retry log prints the actual status.
This commit is contained in:
Çağan Kiraz
2026-08-06 12:45:52 +03:00
parent f00bdcc8e2
commit ee9e187899
2 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -107,8 +107,8 @@ class BaseFlux:
if Status(status) == Status.READY:
print(f"[BFL] Task {task_id} ready after {elapsed:.1f}s — downloading image")
return self.process_result(result, output_format=output_format)
elif Status(status) == Status.PENDING:
print(f"[BFL] Attempt {attempt}/{max_attempts}: pending — retrying in 5s")
elif Status(status) in [Status.PENDING, Status.REASONING, Status.GENERATING]:
print(f"[BFL] Attempt {attempt}/{max_attempts}: {status} — retrying in 5s")
attempt += 1
if attempt <= max_attempts:
time.sleep(5)
+4 -1
View File
@@ -1,9 +1,12 @@
from enum import Enum
class Status(Enum):
TASK_NOT_FOUND = "Task not found"
PENDING = "Pending"
REASONING = "Reasoning"
GENERATING = "Generating"
REQUEST_MODERATED = "Request Moderated"
CONTENT_MODERATED = "Content Moderated"
READY = "Ready"
ERROR = "Error"
ERROR = "Error"