Reuse shared ComfyUI runtime for Deck-owned LTX video

This commit is contained in:
Mikei386
2026-09-30 12:30:08 +02:00
parent ef80b2a0ca
commit fe296cebb1
16 changed files with 350 additions and 34 deletions
+17 -2
View File
@@ -113,8 +113,10 @@ class Server(ThreadingHTTPServer):
self.auto_tests=AutoTests(self.catalog.root.parent/'auto-tests.json',self.profiles,self.worker,self.scheduler)
def stop_gpu_work():
self.auto_tests.stop();self.chat_tests.stop();self.image_tests.stop();self.prompt_enhancer.stop_preview();self.tts_tests.stop();self.worker.stop()
self.video=Video(self.scheduler,stop_gpu_work,self.docker,self.catalog.root.parent/'video')
from video_comfy import VideoComfy
self.video=VideoComfy(self.scheduler,stop_gpu_work,self.docker,self.catalog.root.parent/'video',self.catalog,self.profiles,self.image_runtime)
self.endpoint.video=self.video
self.profiles.video_runtime_ready=lambda:self.image_runtime.status().get("installed",False)
from dashboard_data import Dashboard
self.dashboard=Dashboard(self,self.catalog.root.parent)
if self.endpoint.config['autostart']:
@@ -124,6 +126,16 @@ class Server(ThreadingHTTPServer):
self.sessions = {}
self.login_attempts = []
self.auth_lock = threading.Lock()
def video_browser_auth(headers):
from http.cookies import SimpleCookie
try:
cookies=SimpleCookie();cookies.load(headers.get('Cookie',''));token=cookies['deck_session'].value
except (KeyError,ValueError):return False
record=self.credentials.read()
with self.auth_lock:
session=self.sessions.get(token)
return bool(record and session and session['expires']>time.monotonic() and secrets.compare_digest(session['revision'],record['password']['hash']))
self.endpoint.video_browser_auth=video_browser_auth
class Handler(BaseHTTPRequestHandler):
def log_message(self, *args):
@@ -262,7 +274,7 @@ class Handler(BaseHTTPRequestHandler):
return self.headers.get('Host') in allowed
def execution_setup(self, model, profile=None):
installed={'stt':bool(self.server.runtime.status().get('active')),'chat':bool(self.server.runtime.status().get('active')),'image':self.server.image_runtime.status().get('installed',False),'audio':self.server.tts_runtime.status().get('installed',False),'video':False}
installed={'stt':bool(self.server.runtime.status().get('active')),'chat':bool(self.server.runtime.status().get('active')),'image':self.server.image_runtime.status().get('installed',False),'audio':self.server.tts_runtime.status().get('installed',False),'video':self.server.image_runtime.status().get('installed',False)}
return execution_assess(model,installed,profile)
def do_GET(self):
@@ -545,6 +557,9 @@ class Handler(BaseHTTPRequestHandler):
if set(data)!={'id'}:raise ValueError('Modelldatei-ID erwartet.')
with self.server.worker.lock:
active=self.server.worker.profile['model_id'] if self.server.worker.profile else None
video_rows=self.server.video.models()
selected=next((x for x in video_rows if x['model']['id']==self.server.video.selection.get('model_id')),None)
if selected and data['id'] in [selected['model']['id'],*selected['components'].values()]:raise ValueError('Datei wird vom aktiven Videomodell verwendet. Zuerst eine andere Video-Auswahl treffen.')
return self.respond(self.server.catalog.delete(data['id'],self.server.profiles,active))
if self.path.endswith('/dismiss') and set(data)=={'id'}:return self.respond(self.server.catalog.dismiss(data['id']))
if self.path.endswith('/cancel') and not data:return self.respond(self.server.catalog.stop())