@danhachuel/thunderbolt 0.4.18 → 0.4.19
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.
|
@@ -18,7 +18,7 @@ from integrations.upload_routing import upload_with_default_route
|
|
|
18
18
|
from hermes_ui.creative_generation import CreativeGenerationError, generate_creative_package, generate_title_and_keywords, generate_thumbnail_prompt, generate_topic_for_channel
|
|
19
19
|
from hermes_ui.script_documents import save_script_document
|
|
20
20
|
from hermes_ui.script_generation import generate_script_document
|
|
21
|
-
from hermes_ui.storage import STORAGE, atomic_write, ensure_storage, read_json, write_json
|
|
21
|
+
from hermes_ui.storage import STORAGE, atomic_write, ensure_storage, get_display_name, list_blueprint_files, load_blueprint_file, read_json, write_json
|
|
22
22
|
from hermes_ui.llm_providers import active_llm_card, provider_definition
|
|
23
23
|
from hermes_ui.media_generation import MediaGenerationError, _append_generation_constraints, generate_image_from_pool, generate_video_from_pool
|
|
24
24
|
from hermes_ui.media_providers import FULL_IA_VIDEO_PROVIDER_CODES, media_cards_for_pool, media_provider_definition
|
|
@@ -273,11 +273,29 @@ def _channel_for_task(task: dict[str, Any]) -> dict[str, Any]:
|
|
|
273
273
|
|
|
274
274
|
|
|
275
275
|
def _blueprint_for_channel(channel: dict[str, Any]) -> dict[str, Any]:
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
276
|
+
"""Resolve the Blueprint assigned to a channel from the persisted library files."""
|
|
277
|
+
blueprint_id = str(channel.get("default_blueprint_id") or channel.get("blueprint_id") or "").strip()
|
|
278
|
+
blueprint_name = ""
|
|
279
|
+
if not blueprint_id and not blueprint_name:
|
|
279
280
|
return {}
|
|
280
|
-
|
|
281
|
+
for path in list_blueprint_files():
|
|
282
|
+
try:
|
|
283
|
+
data = load_blueprint_file(path)
|
|
284
|
+
except (OSError, ValueError, json.JSONDecodeError):
|
|
285
|
+
continue
|
|
286
|
+
display_name = get_display_name("blueprints", path, str(data.get("name") or data.get("title") or path.stem))
|
|
287
|
+
identifiers = {
|
|
288
|
+
str(data.get("id") or "").strip(),
|
|
289
|
+
path.stem,
|
|
290
|
+
str(data.get("name") or "").strip(),
|
|
291
|
+
display_name,
|
|
292
|
+
}
|
|
293
|
+
if blueprint_id in identifiers or blueprint_name in identifiers:
|
|
294
|
+
resolved = dict(data)
|
|
295
|
+
resolved.setdefault("id", blueprint_id or path.stem)
|
|
296
|
+
resolved["name"] = display_name
|
|
297
|
+
return resolved
|
|
298
|
+
return {"id": blueprint_id, "name": blueprint_name or blueprint_id}
|
|
281
299
|
|
|
282
300
|
|
|
283
301
|
def _keywords(topic: str, title: str, niche: str = "") -> list[str]:
|
|
@@ -1209,6 +1227,8 @@ def _run_task(task: dict[str, Any]) -> dict[str, Any]:
|
|
|
1209
1227
|
channel = _channel_for_task(task)
|
|
1210
1228
|
settings = _settings()
|
|
1211
1229
|
blueprint = _blueprint_for_channel(channel)
|
|
1230
|
+
if not blueprint and (task.get("blueprint_id") or task.get("blueprint_name")):
|
|
1231
|
+
blueprint = {"id": str(task.get("blueprint_id") or ""), "name": str(task.get("blueprint_name") or task.get("blueprint_id") or "")}
|
|
1212
1232
|
route = _normalise_video_route(task, settings)
|
|
1213
1233
|
topic = str(task.get("topic") or "").strip()
|
|
1214
1234
|
if route != "music" and (not topic or str(task.get("topic_source") or "") in {"auto", "llm_pending"}):
|
|
@@ -43,7 +43,8 @@ def save_script_document(document: dict[str, Any]) -> dict[str, Any]:
|
|
|
43
43
|
f"title: {title}",
|
|
44
44
|
f"language: {str(document.get('language') or '')}",
|
|
45
45
|
f"channel: {str(document.get('channel_name') or '')}",
|
|
46
|
-
f"
|
|
46
|
+
f"blueprint_id: {str(document.get('blueprint_id') or '')}",
|
|
47
|
+
f"blueprint: {str(document.get('blueprint_name') or document.get('blueprint_id') or '')}",
|
|
47
48
|
f"created_at: {created_at}",
|
|
48
49
|
"---",
|
|
49
50
|
"",
|
package/package.json
CHANGED