Support authenticated Hugging Face model and component downloads

This commit is contained in:
Mikei386
2026-09-29 11:47:50 +02:00
parent dad67acad8
commit 7f38286f72
13 changed files with 151 additions and 21 deletions
+8
View File
@@ -289,6 +289,7 @@ class Handler(BaseHTTPRequestHandler):
data=self.server.profiles.status()
for p in data['profiles']:p['execution']=self.execution_setup(p.get('model') or {},p)
return self.respond(data)
if self.path == '/api/v1/huggingface':return self.respond(self.server.catalog.hub_auth.status())
if self.path == '/api/v1/hardware':
return self.respond(self.server.hardware.snapshot())
if self.path.startswith('/api/v1/runtime'):
@@ -343,6 +344,13 @@ class Handler(BaseHTTPRequestHandler):
return self.login()
if not self.authenticated():
return self.respond({'error':'Anmeldung oder gültiger API-Token erforderlich.'},401)
if self.path == '/api/v1/huggingface':
try:
data=self.read_json()
if set(data)!={'token'}:raise ValueError('Ungültige Hugging-Face-Einstellung.')
return self.respond(self.server.catalog.hub_credentials(data['token']))
except ValueError as exc:return self.respond({'error':str(exc)},400)
except Exception:return self.respond({'error':'Hugging-Face-Zugang konnte nicht gespeichert werden.'},503)
if self.path in ('/api/v1/auth/password','/api/v1/auth/token'):
return self.change_credentials('password' if self.path.endswith('/password') else 'token')
if self.path == '/api/v1/logout':