@danhachuel/thunderbolt 0.6.95 → 0.6.97

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 CHANGED
@@ -35,6 +35,7 @@ from typing import Any
35
35
 
36
36
  import requests
37
37
  import streamlit as st
38
+ import streamlit.components.v1 as components
38
39
 
39
40
  ROOT = Path(__file__).resolve().parents[1]
40
41
  if str(ROOT) not in sys.path:
@@ -267,34 +268,57 @@ ensure_storage()
267
268
  st.set_page_config(page_title="Thunderbolt", page_icon="T", layout="wide", initial_sidebar_state="expanded")
268
269
 
269
270
  theme_base = (st.get_option("theme.base") or "dark").lower()
270
-
271
- if theme_base == "light":
272
- st.markdown(
273
- """
274
- <style>
275
- :root {
276
- --primary-bg-color: #7A6FE4;
277
- }
278
-
279
- html,
280
- body,
281
- .stApp,
282
- [data-testid="stAppViewContainer"],
283
- [data-testid="stAppViewContainer"] > .main {
284
- min-height: 100vh;
285
- margin: 0;
286
- background: var(--primary-bg-color) !important;
271
+ components.html(
272
+ """
273
+ <script>
274
+ (() => {
275
+ const STYLE_ID = "thunderbolt-light-theme-style";
276
+ const COLOR = "#7A6FE4";
277
+ const getStoredTheme = () => {
278
+ try {
279
+ return JSON.parse(window.parent.localStorage.getItem("stActiveTheme-/-v2") || '"System"');
280
+ } catch (_error) {
281
+ return "System";
282
+ }
283
+ };
284
+ const isLightTheme = () => {
285
+ const selected = getStoredTheme();
286
+ if (selected === "Light") return true;
287
+ if (selected === "Dark") return false;
288
+ return window.parent.matchMedia("(prefers-color-scheme: light)").matches;
289
+ };
290
+ const applyTheme = () => {
291
+ const document = window.parent.document;
292
+ const existing = document.getElementById(STYLE_ID);
293
+ if (!isLightTheme()) {
294
+ if (existing) existing.remove();
295
+ return;
296
+ }
297
+ const style = existing || document.createElement("style");
298
+ style.id = STYLE_ID;
299
+ style.textContent = `
300
+ :root { --primary-bg-color: ${COLOR}; }
301
+ html, body, .stApp, [data-testid="stAppViewContainer"], [data-testid="stAppViewContainer"] > .main {
302
+ min-height: 100vh !important;
303
+ margin: 0 !important;
304
+ background: ${COLOR} !important;
287
305
  background-image: none !important;
288
306
  }
289
-
290
307
  [data-testid="stSidebar"] {
291
- background: var(--primary-bg-color) !important;
308
+ background: ${COLOR} !important;
292
309
  background-image: none !important;
293
310
  }
294
- </style>
295
- """,
296
- unsafe_allow_html=True,
297
- )
311
+ `;
312
+ if (!existing) document.head.appendChild(style);
313
+ };
314
+ applyTheme();
315
+ window.setInterval(applyTheme, 500);
316
+ })();
317
+ </script>
318
+ """,
319
+ height=0,
320
+ width=0,
321
+ )
298
322
 
299
323
  st.markdown("""
300
324
  <style>
@@ -41,6 +41,8 @@ PIPELINE_LOG_FILENAME = "pipeline_worker.json"
41
41
  VIDEO_TIMEOUT_SECONDS = 20 * 60
42
42
  LONG_STOCK_VIDEO_TIMEOUT_SECONDS = 90 * 60
43
43
  VIDEO_IDLE_TIMEOUT_SECONDS = 10 * 60
44
+ # O helper do MoneyPrinterTurbo pode ficar silencioso durante downloads/API.
45
+ # Mantemos uma janela de inactividade maior para Pixabay, sem remover o watchdog.
44
46
  STOCK_VIDEO_IDLE_TIMEOUT_SECONDS = 30 * 60
45
47
  STALE_TASK_SECONDS = VIDEO_TIMEOUT_SECONDS + 5 * 60
46
48
  WORKER_HEARTBEAT_TIMEOUT_SECONDS = 15
@@ -718,23 +720,25 @@ def _material_video_routes(task: dict[str, Any], settings: dict[str, Any]) -> li
718
720
 
719
721
 
720
722
  def _video_timeout_seconds(task: dict[str, Any], settings: dict[str, Any] | None = None) -> int:
721
- """Reserve extra bounded time only for long stock-video downloads and assembly."""
723
+ """Reserve extra bounded time for long stock-video downloads and assembly."""
722
724
  effective_settings = settings if isinstance(settings, dict) else _settings()
723
725
  route = _normalise_video_route(task, effective_settings)
724
726
  script = str(task.get("video_script") or "").strip()
725
- if route in {"pexels", "pixabay"} and len(script) >= 1_200:
727
+ if route == "pixabay" or (route == "pexels" and len(script) >= 1_200):
726
728
  return max(VIDEO_TIMEOUT_SECONDS, LONG_STOCK_VIDEO_TIMEOUT_SECONDS)
727
729
  return VIDEO_TIMEOUT_SECONDS
728
730
 
729
731
 
730
732
  def _video_idle_timeout_seconds(task: dict[str, Any], settings: dict[str, Any] | None = None) -> int:
731
- """Allow slow stock downloads to stay quiet without treating them as hung."""
733
+ """Allow Pixabay downloads to stay quiet without treating them as hung."""
732
734
  configured = VIDEO_IDLE_TIMEOUT_SECONDS
733
735
  if configured <= 0:
734
736
  return configured
735
737
  effective_settings = settings if isinstance(settings, dict) else _settings()
736
738
  route = _normalise_video_route(task, effective_settings)
737
- if route in {"pexels", "pixabay"}:
739
+ if route == "pixabay":
740
+ return max(configured, STOCK_VIDEO_IDLE_TIMEOUT_SECONDS)
741
+ if route == "pexels":
738
742
  return max(configured, STOCK_VIDEO_IDLE_TIMEOUT_SECONDS)
739
743
  return configured
740
744
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.6.95",
3
+ "version": "0.6.97",
4
4
  "description": "Thunderbolt — interface local para operação de canais faceless e motor MoneyPrinterTurbo",
5
5
  "license": "MIT",
6
6
  "main": "scripts/cli.mjs",