Unify component setup across categories and retain two installation backups

This commit is contained in:
Mikei386
2026-09-30 21:36:47 +02:00
parent b731811482
commit 94bfb1ac78
8 changed files with 90 additions and 16 deletions
+10 -1
View File
@@ -118,6 +118,8 @@ class Server(ThreadingHTTPServer):
from audio_cpp_runtime import AudioCppRuntime
self.audio_cpp_runtime=AudioCppRuntime(self.catalog.root.parent/'audio-cpp-runtime')
self.profiles.music_runtime_ready=lambda:self.audio_cpp_runtime.status()['installed']
from profiles import audio_package_recipe
self.profiles.runtime_recipe=lambda model:audio_package_recipe(model,self.audio_cpp_runtime.paths()[1])
self.ltx_original_runtime=LTXOriginalRuntime(self.catalog.root.parent/'ltx-original-runtime',self.image_runtime)
self.video=VideoRuntimes(self.scheduler,stop_gpu_work,self.docker,self.catalog.root.parent/'video',self.catalog,self.profiles,self.image_runtime,original_runtime=self.ltx_original_runtime)
self.endpoint.video=self.video
@@ -326,7 +328,7 @@ class Handler(BaseHTTPRequestHandler):
try:return self.respond(self.server.image_tests.image(parse_qs(urlsplit(self.path).query).get('id',[''])[0]),mime='image/png')
except (OSError,ValueError):return self.respond({'error':'Bild nicht verfügbar.'},404)
if urlsplit(self.path).path == '/api/v1/profiles/components':
try:return self.respond(self.server.profiles.components(parse_qs(urlsplit(self.path).query).get('model_id',[''])[0]))
try:return self.respond(self.server.profiles.components(parse_qs(urlsplit(self.path).query).get('model_id',[''])[0],parse_qs(urlsplit(self.path).query).get('repo',[None])[0]))
except ValueError as exc:return self.respond({'error':str(exc)},400)
except Exception:return self.respond({'error':'Komponentenquelle nicht erreichbar. Bitte erneut versuchen.'},503)
if self.path == '/api/v1/profiles':
@@ -372,6 +374,13 @@ class Handler(BaseHTTPRequestHandler):
if path.path=='/api/v1/catalog/files':
data=dict(self.server.catalog.files(q.get('repo',[''])[0]));hardware=self.server.hardware.snapshot()
data['files']=[dict(f,assessment=assess(f['size'],hardware,f['name']),execution=self.execution_setup(dict(repo=data['repo'],revision=data['revision'],file=f['name'],kind=q.get('kind',['chat'])[0],runtime_metadata=data.get('runtime_metadata',{})))) for f in data['files']]
from profiles import component_recipe
from catalog import file_role
for f in data['files']:
model=dict(repo=data['repo'],file=f['name'],kind=q.get('kind',['chat'])[0])
recipe=component_recipe(model) or self.server.profiles.runtime_recipe(model)
if recipe:f['execution']['components']=[r['label'] for r in recipe.values()]
elif f['execution']['state']!='component':f['execution']['suggested_components']=[x['name'] for x in data['files'] if file_role(x['name'])['role'] in ('text_encoder','vae','vision_projector','audio_projector')][:12]
return self.respond(data)
if path.path=='/api/v1/catalog':
data=self.server.catalog.status()