window.VideoUI=(()=>{ const e=v=>String(v??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c])); async function api(path,data){const r=await fetch('/api/v1/'+path,data?{method:'POST',headers:{'Content-Type':'application/json','X-Athena-Deck':'1'},body:JSON.stringify(data)}:{});const s=await r.json();if(!r.ok)throw Error(s.error||'Anfrage fehlgeschlagen');return s;} function mode(root,s,profiles=[],port=null){ if(root.dataset.busy==='1')return; root.innerHTML=`

GPU-Modus

Gemeinsamer API-Port: ${e(port||"siehe Endpunkt")} · LLM-Modus: OpenAI-API · Video-Modus: ${s.runtime_kind==='original'?'originale LTX-API':'ComfyUI-API'}

${e(s.service?.name||'Kein Videodienst eingerichtet')}

${s.state==='switching'?`
${e(s.switch_phase)}
`:`

${s.mode==='llm'?'LLM-Betrieb · Videodienst gestoppt':s.service?.ready?'Video-API bereit':s.service?.running?'Videodienst läuft · API noch nicht bereit':'Dienststatus nicht prüfbar · GPU-Aufträge gesperrt'}

`}${s.service?.api_url?`

Backend: ${e(s.service.api_url)}

${e(s.service.message)}

${s.service.ready&&port?`${s.runtime_kind==='original'?'LTX DeskWEB öffnen':'ComfyUI öffnen'} →`:""}`:''}${s.error?``:''}

Modelle, Auflösung, Dauer und Generierung werden in der jeweiligen Video-Anwendung verwaltet. Video beendet Deck-GPU-Aufträge; fremde Dienste werden nicht beendet.

Aktiven Videodienst im Bereich Video wählen
`; root.querySelectorAll('[data-mode]').forEach(b=>b.onclick=async()=>{root.dataset.busy='1';root.querySelectorAll('button').forEach(x=>x.disabled=true);root.querySelector('.video-message').textContent='Moduswechsel wird angefordert …';try{const next=await api('video/mode',{mode:b.dataset.mode});root.dataset.busy='0';mode(root,next,profiles,port);}catch(x){root.querySelector('.video-message').textContent=x.message;root.dataset.busy='0';}}); } function services(root){ if(!root||root.dataset.bound)return;root.dataset.bound='1'; async function poll(){if(!root.isConnected)return;try{const s=await api('video');if(root.dataset.busy!=='1'){ root.innerHTML=`

Video-Laufzeit

${s.runtime?.installed?'Vorhanden · bereit':s.runtime_kind==='original'?'Nicht installiert · unter Einstellungen → LTX Original einrichten':'Nicht installiert · unter Einstellungen → Bildgenerierung einrichten'}

5080: Diffusionsmodell und VAE. 3060: Textencoder. Große BF16-Dateien nutzen zusätzlich CPU-Auslagerung. Gewichte laden erst bei einer Anfrage.

LTX Original installieren / Status →
${(s.models||[]).map(x=>`

${e(x.model.file)}

${e(x.label)}${x.blockers.map(b=>`

${e(b)}

`).join('')}

${Object.keys(x.components).length} Komponenten geprüft · gleiche Quellversion

${x.model.id===s.selected&&s.mode==='llm'?'':''}
`).join('')||'

Kein unterstütztes LTX-Modell in der Bibliothek. Unter Entdecken herunterladen.

'}

`; root.querySelector('#video-runtime-choice').onchange=async event=>{root.dataset.busy='1';try{await api('video/runtime',{runtime:event.target.value});}catch(x){root.querySelector('.video-message').textContent=x.message;}finally{root.dataset.busy='0';poll();}}; root.querySelectorAll('[data-components-model]').forEach(b=>b.onclick=async()=>{root.dataset.busy='1';try{const data=await api('profiles/components?'+new URLSearchParams({model_id:b.dataset.componentsModel}));root.innerHTML=`

LTX-Komponenten

${e(data.message)}

${data.requirements.map((r,i)=>`

${e(r.label)} · ${r.available.length?'Bereits heruntergeladen':r.candidates.length?'Fehlt':'In dieser Quellversion nicht gefunden'}

${!r.available.length?r.candidates.map((c,j)=>``).join(''):''}`).join('')}

`;root.querySelector('[data-close-components]').onclick=()=>{root.dataset.busy='0';poll();};root.querySelectorAll('[data-download-component]').forEach(d=>d.onclick=async()=>{const [i,j]=d.dataset.downloadComponent.split(':');const f=data.requirements[i].candidates[j];d.disabled=true;try{await api('catalog/download',{repo:f.repo,filename:f.name,revision:f.revision,kind:'video'});root.querySelector('.video-message').textContent='Download eingeplant. Fortschritt unter Downloads. Nach Abschluss werden die Komponenten automatisch erkannt.';}catch(x){root.querySelector('.video-message').textContent=x.message;d.disabled=false;}});}catch(x){root.dataset.busy='0';root.querySelector('.video-message').textContent=x.message;}}); root.querySelectorAll('[data-select]').forEach(b=>b.onclick=async()=>{root.dataset.busy='1';try{await api('video/service',{id:b.dataset.select});root.querySelector('.video-message').textContent='Videomodell ausgewählt. Start über die Übersicht.';}catch(x){root.querySelector('.video-message').textContent=x.message;}finally{root.dataset.busy='0';}}); }}catch(x){root.textContent=x.message;}if(root.isConnected)setTimeout(poll,5000);}poll(); } function runtime(){ const view=document.querySelector('#view');if(view.querySelector('#video-service-page'))return; view.innerHTML='

Video

LTX Original mit LTX DeskWEB oder die vorhandene ComfyUI-Laufzeit auswählen. Deck verwaltet Modelle, Komponenten und den GPU-Modus; Generierungsparameter gehören in die jeweilige Video-Oberfläche.

'; function show(tab){const root=view.querySelector('#video-content');if(tab==='runtime'){root.innerHTML='
';services(root.firstChild);}else{root.innerHTML=CatalogUI.html(tab==='library',tab==='downloads');CatalogUI.bind('video',tab==='library',tab==='downloads');}} view.querySelectorAll('[data-video-tab]').forEach(b=>b.onclick=()=>show(b.dataset.videoTab));show('runtime'); } return {mode,services,runtime}; })();