@danhachuel/thunderbolt 0.4.41 → 0.4.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -44,6 +44,10 @@ from .thumbnail_generation import _compose_thumbnail_prompt, generate_thumbnail_
|
|
|
44
44
|
class MediaGenerationError(RuntimeError):
|
|
45
45
|
"""Raised when an image/video adapter cannot produce a usable artifact."""
|
|
46
46
|
|
|
47
|
+
def __init__(self, message: str, *, provider_errors: list[str] | None = None) -> None:
|
|
48
|
+
super().__init__(message)
|
|
49
|
+
self.provider_errors = list(provider_errors or [])
|
|
50
|
+
|
|
47
51
|
|
|
48
52
|
AGNES_IMAGE_MODEL = "agnes-image-2.1-flash"
|
|
49
53
|
AGNES_IMAGE_TIMEOUT_SECONDS = 120
|
|
@@ -374,7 +378,11 @@ def generate_image_from_pool(
|
|
|
374
378
|
errors.append(f"{card.get('provider')}: {str(exc)[:180]}")
|
|
375
379
|
if not _is_retryable_media_error(exc):
|
|
376
380
|
raise
|
|
377
|
-
|
|
381
|
+
details = "\n".join(f"- {item}" for item in errors) if errors else "- Nenhum detalhe foi devolvido pelos providers."
|
|
382
|
+
raise MediaGenerationError(
|
|
383
|
+
"Todos os providers do pool de imagem falharam. Tentativas realizadas:\n" + details,
|
|
384
|
+
provider_errors=errors,
|
|
385
|
+
)
|
|
378
386
|
|
|
379
387
|
|
|
380
388
|
def _video_endpoint(card: Mapping[str, Any]) -> str:
|
package/package.json
CHANGED