@danhachuel/thunderbolt 0.7.26 → 0.7.27
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 +16 -5
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -733,7 +733,17 @@ def _resolve_saved_script_blueprint(record: dict[str, Any], channel: dict[str, A
|
|
|
733
733
|
str(data.get("title") or "").strip(),
|
|
734
734
|
display_name,
|
|
735
735
|
}
|
|
736
|
-
|
|
736
|
+
normalized_identifiers = {value.casefold() for value in identifiers if value}
|
|
737
|
+
# Legacy records may contain a friendly alias such as MILITAR,
|
|
738
|
+
# while the catalog identifier is the filename stem.
|
|
739
|
+
matches_alias = any(
|
|
740
|
+
wanted_value == identifier
|
|
741
|
+
or wanted_value.endswith(identifier)
|
|
742
|
+
or identifier.endswith(wanted_value)
|
|
743
|
+
for wanted_value in wanted
|
|
744
|
+
for identifier in normalized_identifiers
|
|
745
|
+
)
|
|
746
|
+
if matches_alias:
|
|
737
747
|
return str(data.get("id") or path.stem).strip(), display_name
|
|
738
748
|
return blueprint_id, blueprint_name or (blueprint_id if blueprint_id else "SEM BLUEPRINT CONFIGURADO")
|
|
739
749
|
|
|
@@ -756,15 +766,13 @@ def _script_channel(record: dict[str, Any], channels: list[dict[str, Any]]) -> d
|
|
|
756
766
|
|
|
757
767
|
|
|
758
768
|
def _backfill_saved_script_blueprints(records: list[dict[str, Any]] | None = None) -> list[dict[str, Any]]:
|
|
759
|
-
"""Attach every saved video script to
|
|
769
|
+
"""Attach every saved video script to its channel or stored Blueprint."""
|
|
760
770
|
channels = [item for item in read_json("channels.json", []) if isinstance(item, dict)]
|
|
761
771
|
updated_records: list[dict[str, Any]] = []
|
|
762
772
|
for record in records if records is not None else list_script_documents():
|
|
763
773
|
if str(record.get("document_type") or "video_script").strip() != "video_script":
|
|
764
774
|
continue
|
|
765
775
|
channel = _script_channel(record, channels)
|
|
766
|
-
if not channel:
|
|
767
|
-
continue
|
|
768
776
|
blueprint_id, blueprint_name = _resolve_saved_script_blueprint(record, channel)
|
|
769
777
|
current_id = str(record.get("blueprint_id") or "").strip()
|
|
770
778
|
current_name = str(record.get("blueprint_name") or record.get("blueprint") or "").strip()
|
|
@@ -4281,7 +4289,10 @@ def render_scripts():
|
|
|
4281
4289
|
for record in records[:50]:
|
|
4282
4290
|
label = f"{record.get('title', 'Documento')} · {record.get('document_type', 'documento')}"
|
|
4283
4291
|
with st.expander(label, expanded=False):
|
|
4284
|
-
st.caption(
|
|
4292
|
+
st.caption(
|
|
4293
|
+
f"{record.get('created_at', '—')} · {record.get('channel_name', 'Documento independente')} · "
|
|
4294
|
+
f"Blueprint: {record.get('blueprint_name', '—')} · ID: {record.get('blueprint_id', '—')}"
|
|
4295
|
+
)
|
|
4285
4296
|
stored_path = Path(str(record.get("path") or ""))
|
|
4286
4297
|
content = read_script_document(record)
|
|
4287
4298
|
if content:
|
package/package.json
CHANGED