@danhachuel/thunderbolt 0.5.36 → 0.5.38
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 -18
- package/hermes_ui/media_providers.py +3 -6
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -7344,22 +7344,6 @@ def render_media_provider_cards(settings: dict[str, Any], *, embedded: bool = Fa
|
|
|
7344
7344
|
with st.expander("Imagem e Video IA", expanded=False):
|
|
7345
7345
|
full_ia_labels = ", ".join(media_provider_definition(code).label for code in FULL_IA_VIDEO_PROVIDER_CODES)
|
|
7346
7346
|
st.caption(f"Configure providers de imagem e vídeo em cartões independentes. O router usa apenas o pool correspondente e faz failover entre providers activos. Pool Full IA: {full_ia_labels}.")
|
|
7347
|
-
image_cards = [card for card in cards if card.get("supports_image")]
|
|
7348
|
-
video_cards = [card for card in cards if card.get("supports_video")]
|
|
7349
|
-
selector_cols = st.columns(3)
|
|
7350
|
-
image_options = [""] + [str(card.get("id")) for card in image_cards]
|
|
7351
|
-
video_options = [""] + [str(card.get("id")) for card in video_cards]
|
|
7352
|
-
with selector_cols[0]:
|
|
7353
|
-
image_active_id = st.selectbox("Provider principal de imagem", image_options, index=image_options.index(str(settings.get(MEDIA_IMAGE_ACTIVE_CARD_KEY) or "")) if str(settings.get(MEDIA_IMAGE_ACTIVE_CARD_KEY) or "") in image_options else 0, format_func=lambda value: "Automático / primeiro activo" if not value else next((media_provider_definition(card.get("provider")).label for card in image_cards if str(card.get("id")) == value), value), key="media_image_active_selector")
|
|
7354
|
-
with selector_cols[1]:
|
|
7355
|
-
video_active_id = st.selectbox("Provider principal de vídeo", video_options, index=video_options.index(str(settings.get(MEDIA_VIDEO_ACTIVE_CARD_KEY) or "")) if str(settings.get(MEDIA_VIDEO_ACTIVE_CARD_KEY) or "") in video_options else 0, format_func=lambda value: "Não usar pool externo" if not value else next((media_provider_definition(card.get("provider")).label for card in video_cards if str(card.get("id")) == value), value), key="media_video_active_selector")
|
|
7356
|
-
with selector_cols[2]:
|
|
7357
|
-
video_pool_enabled = st.checkbox("Usar pool de vídeo externo", value=bool(settings.get("media_video_pool_enabled", False)), key="media_video_pool_enabled_ui")
|
|
7358
|
-
if st.button("Salvar selecção dos pools", use_container_width=True, key="save_media_pool_selection") if not embedded else st.form_submit_button("Salvar selecção dos pools", use_container_width=True, key="save_media_pool_selection"):
|
|
7359
|
-
settings["media_video_pool_enabled"] = bool(video_pool_enabled)
|
|
7360
|
-
_persist_media_cards(settings, cards, image_active_id, video_active_id)
|
|
7361
|
-
st.success("Selecção dos pools guardada.")
|
|
7362
|
-
st.rerun()
|
|
7363
7347
|
for index in range(len(cards)):
|
|
7364
7348
|
_render_media_provider_card(settings, cards, index, embedded=embedded)
|
|
7365
7349
|
st.divider()
|
|
@@ -7369,7 +7353,7 @@ def render_media_provider_cards(settings: dict[str, Any], *, embedded: bool = Fa
|
|
|
7369
7353
|
add_clicked = st.form_submit_button("Adicionar provider de imagem/vídeo", use_container_width=True, key="add_media_provider_card") if embedded else st.button("Adicionar provider de imagem/vídeo", use_container_width=True, key="add_media_provider_card")
|
|
7370
7354
|
if add_clicked:
|
|
7371
7355
|
cards.append(new_media_card(provider_to_add, card_id=f"media-{provider_to_add}-{uuid.uuid4().hex[:8]}"))
|
|
7372
|
-
_persist_media_cards(settings, cards
|
|
7356
|
+
_persist_media_cards(settings, cards)
|
|
7373
7357
|
st.success("Novo provider de imagem/vídeo adicionado.")
|
|
7374
7358
|
st.rerun()
|
|
7375
7359
|
|
|
@@ -8644,7 +8628,7 @@ def main():
|
|
|
8644
8628
|
"Início": render_dashboard,
|
|
8645
8629
|
"Pipeline Vídeos": render_pipeline,
|
|
8646
8630
|
"Criação de Vídeos": render_new_video,
|
|
8647
|
-
"Criação de Shorts": lambda: render_new_video("Criação de Shorts", "new_shorts", channel_platform="
|
|
8631
|
+
"Criação de Shorts": lambda: render_new_video("Criação de Shorts", "new_shorts", channel_platform="tiktok", fixed_aspect_ratio="Portrait 9:16"),
|
|
8648
8632
|
"Backlog Vídeos": render_videos,
|
|
8649
8633
|
"Criação de Músicas": render_music_creation,
|
|
8650
8634
|
"Music Backlog": render_music_backlog,
|
|
@@ -382,13 +382,10 @@ def apply_media_provider_cards_to_settings(settings: Mapping[str, Any], cards: l
|
|
|
382
382
|
def media_cards_for_pool(settings: Mapping[str, Any], pool: str, *, thumbnail_only: bool = False) -> list[dict[str, Any]]:
|
|
383
383
|
migrated, _ = ensure_media_provider_cards(settings)
|
|
384
384
|
capability = "supports_image" if pool == "image" else "supports_video" if pool == "video" else "supports_text"
|
|
385
|
-
active_key = MEDIA_IMAGE_ACTIVE_CARD_KEY if pool == "image" else MEDIA_VIDEO_ACTIVE_CARD_KEY if pool == "video" else ""
|
|
386
|
-
active_id = str(migrated.get(active_key) or "")
|
|
387
385
|
cards = [dict(item) for item in migrated.get(MEDIA_CARDS_KEY, []) if item.get("enabled", True) and item.get(capability)]
|
|
388
386
|
if pool == "image" and not thumbnail_only:
|
|
389
387
|
cards = [card for card in cards if not card.get("thumbnail_only")]
|
|
390
|
-
# A prioridade é
|
|
391
|
-
#
|
|
392
|
-
|
|
393
|
-
cards.sort(key=lambda card: (int(card.get("priority", 0)), 0 if str(card.get("id")) == active_id else 1))
|
|
388
|
+
# A prioridade definida no próprio cartão é a única regra do failover.
|
|
389
|
+
# O estado activo legado não pode alterar a ordem escolhida pelo utilizador.
|
|
390
|
+
cards.sort(key=lambda card: int(card.get("priority", 0)))
|
|
394
391
|
return cards
|
package/package.json
CHANGED