@danhachuel/thunderbolt 0.4.34 → 0.4.35

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.
@@ -38,7 +38,7 @@ from .provider_routing import (
38
38
  route_json_request,
39
39
  )
40
40
  from .storage import STORAGE, ensure_storage
41
- from .thumbnail_generation import generate_thumbnail_image, normalize_thumbnail_bytes
41
+ from .thumbnail_generation import _compose_thumbnail_prompt, generate_thumbnail_image, normalize_thumbnail_bytes
42
42
 
43
43
 
44
44
  class MediaGenerationError(RuntimeError):
@@ -232,13 +232,19 @@ def _image_endpoint(card: Mapping[str, Any]) -> str:
232
232
  raise MediaGenerationError(f"O provider {card.get('provider')} não tem endpoint de imagem configurado.")
233
233
 
234
234
 
235
- def _image_request(card: dict[str, Any], prompt: str) -> Any:
235
+ def _image_request(card: dict[str, Any], prompt: str, *, topic: str = "", lettering_text: str = "", lettering_prompt: str = "") -> Any:
236
236
  provider = str(card.get("provider") or "").strip().lower()
237
237
  style = str(card.get("api_style") or media_provider_definition(provider).api_style)
238
238
  endpoint = _image_endpoint(card)
239
+ image_prompt, _headline = _compose_thumbnail_prompt(
240
+ prompt,
241
+ topic=topic,
242
+ lettering_text=lettering_text,
243
+ lettering_prompt=lettering_prompt,
244
+ )
239
245
  requested_size = "1792x1024" if provider == "pollinations" else "1280x720 minimum"
240
246
  constrained_prompt = _append_generation_constraints(
241
- prompt,
247
+ image_prompt,
242
248
  kind="image",
243
249
  aspect_ratio="16:9",
244
250
  size=requested_size,
@@ -301,7 +307,7 @@ def generate_image_for_card(
301
307
  destination = STORAGE / "thumbnails" / f"media-{provider}-{abs(hash((topic, prompt, variant_index))) & 0xffffffffffffffff:x}.jpg"
302
308
 
303
309
  def request(current: dict[str, Any]) -> Any:
304
- return _image_request(current, prompt)
310
+ return _image_request(current, prompt, topic=topic, lettering_text=lettering_text, lettering_prompt=lettering_prompt)
305
311
 
306
312
  try:
307
313
  routed = route_json_request(settings, pool=POOL_IMAGE, cards=[card], request=request)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.4.34",
3
+ "version": "0.4.35",
4
4
  "description": "Thunderbolt — interface local para operação de canais faceless e motor MoneyPrinterTurbo",
5
5
  "license": "MIT",
6
6
  "main": "scripts/cli.mjs",