Files
Athena-Deck/deploy/applio-web/frontend/js/pages/diagnose.js
T
Mikei386 06cacafbad Add native Applio RVC and preserve the custom studio UI
Pin Applio 3.6.5 and verified basis assets, migrate private voice provenance, and coordinate conversion/live/training with Deck GPU leases. Prepare an inactive voice profile and a restricted studio container. Move CUDA and Torch caches out of the small temporary filesystem to prevent OmniVoice reference failures. Package app updates from the explicit allowlist in one Docker layer.
2026-10-05 10:02:07 +02:00

143 lines
5.6 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/** Diagnose – passt exakt zur Backend-Antwort von /api/diagnostics */
import { api } from "../api.js";
import { escapeHtml } from "../app.js";
export async function renderDiagnose(content) {
let diags;
try {
diags = await api.diagnostics();
} catch (err) {
content.innerHTML = `
<div class="alert alert--error">
<span class="alert__icon">⚠️</span>
<div class="alert__content">
<div class="alert__title">Diagnose nicht verfügbar</div>
<div class="alert__text">${escapeHtml(err.message)}</div>
</div>
</div>`;
return;
}
const report = buildReport(diags);
const noIndex = diags.models_without_index_names || [];
content.innerHTML = `
<div class="page">
<div class="page__header">
<div>
<h2 class="section-title">Diagnose</h2>
<p class="page__description">
Systemzustand und Konfiguration. Der Diagnosebericht enthält keine
Passwörter, Tokens oder privaten Schlüssel.
</p>
</div>
<button class="btn" id="copy-report">📋 Bericht kopieren</button>
</div>
<div class="grid grid--2">
<div class="card">
<div class="card__title mb-3">Anwendung</div>
<table class="table">
<tr><td>Version</td><td class="text-mono">${escapeHtml(diags.version)}</td></tr>
<tr><td>Verarbeitung</td><td>🚀 Echt</td></tr>
<tr><td>Runner</td><td>${escapeHtml(diags.runner)} ${diags.runner_available ? "✓" : "✗"}</td></tr>
<tr><td>Applio-Commit</td><td class="text-mono" style="font-size:var(--text-xs)">${escapeHtml(diags.applio_commit)}</td></tr>
<tr><td>Python</td><td class="text-mono">${escapeHtml(diags.python_version.split(" ")[0])}</td></tr>
<tr><td>FFmpeg</td><td>${diags.ffmpeg_available ? "✓ verfügbar" : "✗ fehlt"}</td></tr>
</table>
</div>
<div class="card">
<div class="card__title mb-3">Modelle &amp; Indizes</div>
<table class="table">
<tr><td>Modelle gefunden</td><td>${diags.models_found}</td></tr>
<tr><td>Modelle ohne Index</td><td>${noIndex.length ? noIndex.length : "keine"}</td></tr>
</table>
${noIndex.length ? `
<div class="alert alert--warning mt-3" style="padding:var(--space-2) var(--space-3)">
<div class="alert__content">
<div class="alert__text">${noIndex.map(escapeHtml).join(", ")}</div>
</div>
</div>` : ""}
</div>
<div class="card">
<div class="card__title mb-3">Speicher</div>
<table class="table">
<tr><td>Frei</td><td>${(diags.disk?.free_gb ?? 0).toFixed(1)} GB</td></tr>
<tr><td>Belegt</td><td>${(diags.disk?.used_gb ?? 0).toFixed(1)} GB</td></tr>
<tr><td>Gesamt</td><td>${(diags.disk?.total_gb ?? 0).toFixed(1)} GB</td></tr>
</table>
</div>
<div class="card">
<div class="card__title mb-3">Aufträge</div>
<table class="table">
<tr><td>Laufend</td><td>${diags.running_jobs}</td></tr>
<tr><td>Letzter Fehler</td><td>${diags.last_error ? escapeHtml(diags.last_error.error || diags.last_error.type) : "–"}</td></tr>
<tr><td>Letzter Erfolg</td><td>${diags.last_success ? escapeHtml(diags.last_success.type) : "–"}</td></tr>
</table>
</div>
</div>
<div class="card">
<div class="card__title mb-3">Konfigurierte Verzeichnisse</div>
<table class="table">
${Object.entries(diags.configured_dirs || {}).map(([k, v]) => `
<tr><td>${escapeHtml(k)}</td><td class="text-mono" style="font-size:var(--text-xs)">${escapeHtml(v)}</td></tr>`).join("")}
</table>
</div>
<div class="card">
<div class="flex-between mb-3">
<div class="card__title">Diagnosebericht</div>
<button class="btn btn--sm" id="copy-report-2">Kopieren</button>
</div>
<div class="code-block" id="report-block">${escapeHtml(report)}</div>
</div>
</div>`;
const copy = async () => {
try {
await navigator.clipboard.writeText(report);
const btn = document.getElementById("copy-report");
if (btn) { btn.textContent = "✓ Kopiert"; setTimeout(() => { btn.textContent = "📋 Bericht kopieren"; }, 2000); }
} catch { /* clipboard not available */ }
};
document.getElementById("copy-report")?.addEventListener("click", copy);
document.getElementById("copy-report-2")?.addEventListener("click", copy);
}
function buildReport(d) {
const noIndex = d.models_without_index_names || [];
const lines = [
"Mikes-Applio-UI Diagnosebericht",
"================================",
`Version: ${d.version}`,
"Verarbeitung: ausschließlich echtes Applio",
`Runner: ${d.runner} (verfügbar: ${d.runner_available ? "ja" : "nein"})`,
`Applio-Commit: ${d.applio_commit}`,
`Python: ${d.python_version}`,
`Plattform: ${d.platform}`,
`FFmpeg: ${d.ffmpeg_available ? "verfügbar" : "fehlt"}`,
"",
"Modelle:",
` Gefunden: ${d.models_found}`,
` Ohne Index: ${noIndex.length ? noIndex.join(", ") : "keine"}`,
"",
"Speicher:",
` Frei: ${d.disk?.free_gb?.toFixed(1)} GB`,
` Belegt: ${d.disk?.used_gb?.toFixed(1)} GB`,
"",
"Aufträge:",
` Laufend: ${d.running_jobs}`,
` Letzter Fehler: ${d.last_error ? d.last_error.error : "–"}`,
` Letzter Erfolg: ${d.last_success ? d.last_success.type : "–"}`,
"",
"Verzeichnisse:",
...Object.entries(d.configured_dirs || {}).map(([k, v]) => ` ${k}: ${v}`),
];
return lines.join("\n");
}