Fengsuid commited on
Commit ·
90fd59c
1
Parent(s): a4f38c8
fix: improve error message when image generation returns no data
Browse files- Replace generic "image task returned no image data" with actionable
message about checking account pool quota and rate-limit status
- Add fallback error text when all accounts silently fail to generate
services/image_task_service.py
CHANGED
|
@@ -230,7 +230,11 @@ class ImageTaskService:
|
|
| 230 |
raise RuntimeError("image task returned streaming result unexpectedly")
|
| 231 |
data = result.get("data")
|
| 232 |
if not isinstance(data, list) or not data:
|
| 233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
raise RuntimeError(message)
|
| 235 |
self._update_task(key, status=TASK_STATUS_SUCCESS, data=data, error="")
|
| 236 |
self._log_call(
|
|
|
|
| 230 |
raise RuntimeError("image task returned streaming result unexpectedly")
|
| 231 |
data = result.get("data")
|
| 232 |
if not isinstance(data, list) or not data:
|
| 233 |
+
upstream = _clean(result.get("message"))
|
| 234 |
+
if upstream:
|
| 235 |
+
message = upstream
|
| 236 |
+
else:
|
| 237 |
+
message = "号池中没有可用账号或所有账号均被限流,请检查号池状态(账号额度、是否被封禁、是否到达生图上限)"
|
| 238 |
raise RuntimeError(message)
|
| 239 |
self._update_task(key, status=TASK_STATUS_SUCCESS, data=data, error="")
|
| 240 |
self._log_call(
|
services/protocol/conversation.py
CHANGED
|
@@ -637,6 +637,8 @@ def stream_image_outputs_with_pool(request: ConversationRequest) -> Iterator[Ima
|
|
| 637 |
raise ImageGenerationError(image_stream_error_message(last_error)) from exc
|
| 638 |
|
| 639 |
if not emitted:
|
|
|
|
|
|
|
| 640 |
raise ImageGenerationError(image_stream_error_message(last_error))
|
| 641 |
|
| 642 |
|
|
|
|
| 637 |
raise ImageGenerationError(image_stream_error_message(last_error)) from exc
|
| 638 |
|
| 639 |
if not emitted:
|
| 640 |
+
if not last_error:
|
| 641 |
+
last_error = "no account in the pool could generate images — check account quota and rate-limit status"
|
| 642 |
raise ImageGenerationError(image_stream_error_message(last_error))
|
| 643 |
|
| 644 |
|