@danhachuel/thunderbolt 0.4.32 → 0.4.33
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.
- package/app/main.py +1 -0
- package/hermes_ui/thumbnails.py +26 -1
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -4205,6 +4205,7 @@ def render_thumbnails():
|
|
|
4205
4205
|
settings,
|
|
4206
4206
|
lettering_prompt=record.get("lettering_prompt") or "",
|
|
4207
4207
|
language=str(record.get("language") or channel.get("language") or current_ui_language()),
|
|
4208
|
+
channel=channel,
|
|
4208
4209
|
)
|
|
4209
4210
|
record_notification(
|
|
4210
4211
|
"thumbnail_generation_completed",
|
package/hermes_ui/thumbnails.py
CHANGED
|
@@ -350,6 +350,7 @@ def regenerate_thumbnail_lettering(
|
|
|
350
350
|
settings: dict[str, Any],
|
|
351
351
|
lettering_prompt: str = "",
|
|
352
352
|
language: str = "",
|
|
353
|
+
channel: dict[str, Any] | None = None,
|
|
353
354
|
) -> tuple[dict[str, Any], Path]:
|
|
354
355
|
"""Edit only the lettering while sending the existing image as a Nano Banana reference."""
|
|
355
356
|
tasks = read_json("tasks.json", [])
|
|
@@ -362,10 +363,31 @@ def regenerate_thumbnail_lettering(
|
|
|
362
363
|
requested_language = str(language or record.get("language") or "Português").strip()
|
|
363
364
|
language_instruction = _language_instruction(requested_language)
|
|
364
365
|
base_prompt = record["prompt"] or "Cria uma thumbnail de YouTube cinematográfica e de alto contraste."
|
|
366
|
+
resolved_channel = dict(channel or {})
|
|
367
|
+
if not resolved_channel:
|
|
368
|
+
channels = read_json("channels.json", [])
|
|
369
|
+
channel_id = str(task.get("channel_id") or "").strip()
|
|
370
|
+
resolved_channel = next(
|
|
371
|
+
(item for item in channels if isinstance(item, dict) and str(item.get("id") or "") == channel_id),
|
|
372
|
+
{},
|
|
373
|
+
) if isinstance(channels, list) else {}
|
|
374
|
+
try:
|
|
375
|
+
localized_variant = generate_thumbnail_prompt(
|
|
376
|
+
settings,
|
|
377
|
+
resolved_channel,
|
|
378
|
+
record["title"] or record["topic"],
|
|
379
|
+
current_prompt=base_prompt,
|
|
380
|
+
language=requested_language,
|
|
381
|
+
)
|
|
382
|
+
exact_headline = str(localized_variant.get("overlay_text") or "").strip()
|
|
383
|
+
except Exception:
|
|
384
|
+
exact_headline = str(record.get("thumbnail_text") or (record.get("variant") or {}).get("overlay_text") or "").strip()
|
|
385
|
+
if not exact_headline:
|
|
386
|
+
raise ThumbnailGenerationError("Não foi possível gerar o texto do lettering no idioma do canal.")
|
|
365
387
|
edit_prompt = str(lettering_prompt or "").strip() or (
|
|
366
388
|
f"Refaz apenas o lettering da thumbnail para o vídeo {record['title']!r}. "
|
|
367
389
|
f"Escreve obrigatoriamente em {language_instruction}. "
|
|
368
|
-
"
|
|
390
|
+
f"Usa exactamente este texto, sem alterar palavras, idioma ou acentuação: {exact_headline!r}."
|
|
369
391
|
)
|
|
370
392
|
combined_prompt = (
|
|
371
393
|
"BASE IMAGE LAYER — preserva exactamente a composição, enquadramento, sujeitos, fundo, iluminação, "
|
|
@@ -375,6 +397,7 @@ def regenerate_thumbnail_lettering(
|
|
|
375
397
|
"Mantém tudo o que pertence à BASE IMAGE LAYER pixelmente tão próximo quanto possível, sem mudar a imagem.\n"
|
|
376
398
|
f"LANGUAGE LOCK — todo o texto visível novo deve estar obrigatoriamente em {language_instruction}. "
|
|
377
399
|
"Não uses inglês nem traduzas para outro idioma.\n"
|
|
400
|
+
f"EXACT HEADLINE — renderiza somente este texto: <<<{exact_headline}>>>\n"
|
|
378
401
|
f"{edit_prompt}\n"
|
|
379
402
|
"Não adicionar logótipos, marcas de água ou outros elementos."
|
|
380
403
|
)
|
|
@@ -385,10 +408,12 @@ def regenerate_thumbnail_lettering(
|
|
|
385
408
|
topic=record["title"] or record["topic"],
|
|
386
409
|
variant_index=record["variant_index"],
|
|
387
410
|
reference_image=previous_image,
|
|
411
|
+
lettering_text=exact_headline,
|
|
388
412
|
lettering_prompt=edit_prompt,
|
|
389
413
|
)
|
|
390
414
|
variant = _variant_for_record(record)
|
|
391
415
|
variant["image_prompt"] = base_prompt
|
|
416
|
+
variant["overlay_text"] = exact_headline
|
|
392
417
|
variant["lettering_prompt"] = edit_prompt
|
|
393
418
|
updated = _update_thumbnail_task(
|
|
394
419
|
task_id,
|
package/package.json
CHANGED