@danhachuel/thunderbolt 0.4.31 → 0.4.32
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 +2 -0
- package/hermes_ui/thumbnails.py +8 -1
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -4199,10 +4199,12 @@ def render_thumbnails():
|
|
|
4199
4199
|
):
|
|
4200
4200
|
try:
|
|
4201
4201
|
with st.spinner("A refazer apenas o lettering…"):
|
|
4202
|
+
channel, _blueprint = _thumbnail_editor_context(record)
|
|
4202
4203
|
_task, generated_path = regenerate_thumbnail_lettering(
|
|
4203
4204
|
task_id,
|
|
4204
4205
|
settings,
|
|
4205
4206
|
lettering_prompt=record.get("lettering_prompt") or "",
|
|
4207
|
+
language=str(record.get("language") or channel.get("language") or current_ui_language()),
|
|
4206
4208
|
)
|
|
4207
4209
|
record_notification(
|
|
4208
4210
|
"thumbnail_generation_completed",
|
package/hermes_ui/thumbnails.py
CHANGED
|
@@ -7,7 +7,7 @@ import uuid
|
|
|
7
7
|
from pathlib import Path
|
|
8
8
|
from typing import Any
|
|
9
9
|
|
|
10
|
-
from .creative_generation import generate_thumbnail_prompt
|
|
10
|
+
from .creative_generation import _language_instruction, generate_thumbnail_prompt
|
|
11
11
|
from .media_generation import generate_image_from_pool
|
|
12
12
|
from .media_providers import media_cards_for_pool
|
|
13
13
|
from .storage import STORAGE, ensure_storage, now, read_json, update_json
|
|
@@ -96,6 +96,7 @@ def normalize_thumbnail_task(task: dict[str, Any]) -> dict[str, Any]:
|
|
|
96
96
|
"topic": str(task.get("topic") or "").strip(),
|
|
97
97
|
"channel_id": str(task.get("channel_id") or "").strip(),
|
|
98
98
|
"channel_name": str(task.get("channel_name") or "Canal sem nome").strip(),
|
|
99
|
+
"language": str(task.get("language") or "").strip(),
|
|
99
100
|
"blueprint_id": str(task.get("blueprint_id") or "").strip(),
|
|
100
101
|
"blueprint_name": str(task.get("blueprint_name") or "").strip(),
|
|
101
102
|
"thumbnail_blueprint_id": str(task.get("thumbnail_blueprint_id") or "").strip(),
|
|
@@ -348,6 +349,7 @@ def regenerate_thumbnail_lettering(
|
|
|
348
349
|
task_id: str,
|
|
349
350
|
settings: dict[str, Any],
|
|
350
351
|
lettering_prompt: str = "",
|
|
352
|
+
language: str = "",
|
|
351
353
|
) -> tuple[dict[str, Any], Path]:
|
|
352
354
|
"""Edit only the lettering while sending the existing image as a Nano Banana reference."""
|
|
353
355
|
tasks = read_json("tasks.json", [])
|
|
@@ -357,9 +359,12 @@ def regenerate_thumbnail_lettering(
|
|
|
357
359
|
previous_image = record.get("image_path")
|
|
358
360
|
if not previous_image or not previous_image.is_file():
|
|
359
361
|
raise ThumbnailGenerationError("A thumbnail precisa de uma imagem existente para refazer o lettering.")
|
|
362
|
+
requested_language = str(language or record.get("language") or "Português").strip()
|
|
363
|
+
language_instruction = _language_instruction(requested_language)
|
|
360
364
|
base_prompt = record["prompt"] or "Cria uma thumbnail de YouTube cinematográfica e de alto contraste."
|
|
361
365
|
edit_prompt = str(lettering_prompt or "").strip() or (
|
|
362
366
|
f"Refaz apenas o lettering da thumbnail para o vídeo {record['title']!r}. "
|
|
367
|
+
f"Escreve obrigatoriamente em {language_instruction}. "
|
|
363
368
|
"Escolhe uma frase curta e forte, com no máximo quatro palavras, relacionada com o título."
|
|
364
369
|
)
|
|
365
370
|
combined_prompt = (
|
|
@@ -368,6 +373,8 @@ def regenerate_thumbnail_lettering(
|
|
|
368
373
|
f"{base_prompt}\n\n"
|
|
369
374
|
"LETTERING EDIT LAYER — altera exclusivamente o texto/lettering visível da thumbnail. "
|
|
370
375
|
"Mantém tudo o que pertence à BASE IMAGE LAYER pixelmente tão próximo quanto possível, sem mudar a imagem.\n"
|
|
376
|
+
f"LANGUAGE LOCK — todo o texto visível novo deve estar obrigatoriamente em {language_instruction}. "
|
|
377
|
+
"Não uses inglês nem traduzas para outro idioma.\n"
|
|
371
378
|
f"{edit_prompt}\n"
|
|
372
379
|
"Não adicionar logótipos, marcas de água ou outros elementos."
|
|
373
380
|
)
|
package/package.json
CHANGED