@danhachuel/thunderbolt 0.5.44 → 0.5.46
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.
|
@@ -160,9 +160,8 @@ def _vision_prompt(video: Mapping[str, Any]) -> str:
|
|
|
160
160
|
|
|
161
161
|
def analyse_thumbnail_with_paligemma(path: str, card: Mapping[str, Any]) -> dict[str, Any]:
|
|
162
162
|
key = str(card.get("api_key") or "").strip()
|
|
163
|
-
base = str(card.get("base_url") or "https://
|
|
164
|
-
if base.endswith("/
|
|
165
|
-
base = f"{base}/vlm/google/paligemma"
|
|
163
|
+
base = str(card.get("base_url") or "https://integrate.api.nvidia.com/v1").rstrip("/")
|
|
164
|
+
endpoint = base if base.endswith("/chat/completions") else f"{base}/chat/completions"
|
|
166
165
|
model = str(card.get("model") or "google/paligemma").strip()
|
|
167
166
|
if not key:
|
|
168
167
|
return {"score": 50, "diagnosis": "API key NVIDIA NIM Paligemma não configurada.", "status": "sem_dados"}
|
|
@@ -171,7 +170,7 @@ def analyse_thumbnail_with_paligemma(path: str, card: Mapping[str, Any]) -> dict
|
|
|
171
170
|
{"type": "text", "text": "Evaluate this thumbnail for YouTube Growth. Return JSON with score, diagnosis, contrast, mobile_readability, text_words, hierarchy, emotion, overlap_risk."},
|
|
172
171
|
{"type": "image_url", "image_url": {"url": f"data:image/jpeg;base64,{data}"}},
|
|
173
172
|
]}], "max_tokens": 500, "temperature": 0.1}
|
|
174
|
-
response = requests.post(
|
|
173
|
+
response = requests.post(endpoint, headers={"Authorization": f"Bearer {key}", "Accept": "application/json", "Content-Type": "application/json"}, json=payload, timeout=120)
|
|
175
174
|
response.raise_for_status()
|
|
176
175
|
content = response.json().get("choices", [{}])[0].get("message", {}).get("content", "")
|
|
177
176
|
match = re.search(r"\{.*\}", str(content), flags=re.S)
|
|
@@ -55,7 +55,7 @@ LLM_PROVIDER_CATALOG: tuple[LlmProviderDefinition, ...] = (
|
|
|
55
55
|
"nvidia_nim_paligemma",
|
|
56
56
|
"OpenAI / NVIDIA NIM (Paligemma)",
|
|
57
57
|
show_base_url=True,
|
|
58
|
-
default_base_url="https://
|
|
58
|
+
default_base_url="https://integrate.api.nvidia.com/v1",
|
|
59
59
|
supports_model_discovery=False,
|
|
60
60
|
excluded_from_normal_pool=True,
|
|
61
61
|
description="Provider exclusivo do Analista Growth YouTube para análise visual de thumbnails.",
|
package/package.json
CHANGED
package/scripts/install.mjs
CHANGED
|
@@ -433,13 +433,17 @@ function installRequirementIfNeeded(requirementsPath, stateKey, modules, label)
|
|
|
433
433
|
const state = readDependencyState();
|
|
434
434
|
const importsOk = importsAvailable(modules);
|
|
435
435
|
const hashMatches = state[stateKey] === currentHash;
|
|
436
|
-
|
|
436
|
+
const markerPath = join(venvPath, `.${stateKey}.sha256`);
|
|
437
|
+
const markerHash = existsSync(markerPath) ? readFileSync(markerPath, "utf8").trim() : "";
|
|
438
|
+
const persistedHashMatches = hashMatches || markerHash === currentHash;
|
|
439
|
+
if (!forceDeps && importsOk && persistedHashMatches) {
|
|
437
440
|
console.log(`${label}: dependências detectadas e reutilizadas; nenhuma reinstalação necessária.`);
|
|
438
441
|
writeDependencyState({ [stateKey]: currentHash });
|
|
439
442
|
return;
|
|
440
443
|
}
|
|
441
444
|
console.log(`${label}: dependências ausentes, incompletas ou alteradas; a instalar agora.`);
|
|
442
445
|
run(pythonBin, ["-m", "pip", "install", "-r", requirementsPath]);
|
|
446
|
+
writeFileSync(markerPath, `${currentHash}\n`, "utf8");
|
|
443
447
|
writeDependencyState({ [stateKey]: currentHash });
|
|
444
448
|
}
|
|
445
449
|
|
|
@@ -461,7 +465,7 @@ function writeSettings(moneyprinterPath) {
|
|
|
461
465
|
|
|
462
466
|
function installThunderboltDependencies(python) {
|
|
463
467
|
if (!existsSync(pythonBin)) run(python.command, [...python.args, "-m", "venv", venvPath]);
|
|
464
|
-
installRequirementIfNeeded(join(root, "requirements.txt"), "thunderbolt_requirements_sha256", ["streamlit", "requests", "pandas", "toml", "imageio_ffmpeg", "edge_tts", "google.auth", "google_auth_oauthlib", "googleapiclient"], "Thunderbolt");
|
|
468
|
+
installRequirementIfNeeded(join(root, "requirements.txt"), "thunderbolt_requirements_sha256", ["streamlit", "requests", "pandas", "toml", "imageio_ffmpeg", "edge_tts", "google.auth", "google_auth_oauthlib", "googleapiclient", "yt_dlp", "youtube_transcript_api"], "Thunderbolt");
|
|
465
469
|
}
|
|
466
470
|
|
|
467
471
|
function installMoneyPrinterDependencies(moneyprinterPath) {
|