Restore Video workspace and route native video API through shared endpoint
This commit is contained in:
+13
@@ -1,3 +1,4 @@
|
||||
from video_proxy import relay
|
||||
"""Separate authenticated OpenAI-compatible API; only explicitly enabled Deck profiles."""
|
||||
import base64
|
||||
import hashlib
|
||||
@@ -155,6 +156,11 @@ class APIHandler(BaseHTTPRequestHandler):
|
||||
return False
|
||||
def do_GET(self):self.route()
|
||||
def do_POST(self):self.route()
|
||||
def do_PUT(self):self.route()
|
||||
def do_PATCH(self):self.route()
|
||||
def do_DELETE(self):self.route()
|
||||
def do_HEAD(self):self.route()
|
||||
def do_OPTIONS(self):self.route()
|
||||
def route(self):
|
||||
ep=self.server.endpoint;admitted=False
|
||||
try:
|
||||
@@ -163,6 +169,13 @@ class APIHandler(BaseHTTPRequestHandler):
|
||||
with ep.lock:
|
||||
if not ep.allowed():raise APIError('Endpunkt wird gestoppt.',503,'endpoint_stopping')
|
||||
ep.inflight+=1;admitted=True
|
||||
if ep.video and ep.scheduler.gpu_mode!='llm':
|
||||
if ep.scheduler.gpu_mode=='switching':raise APIError('Moduswechsel läuft.',503,'mode_switching')
|
||||
video=ep.video.status()
|
||||
if not video.get('service',{}).get('ready'):raise APIError('Video-API noch nicht bereit.',503,'video_not_ready')
|
||||
try:relay(self,video['selected'])
|
||||
except ValueError as exc:raise APIError(str(exc)) from None
|
||||
return
|
||||
model_routes={'/v1/models':'chat','/v1/images/models':'image','/v1/audio/speech/models':'audio','/v1/audio/transcriptions/models':'stt'}
|
||||
if self.command=='GET' and self.path in model_routes:return self.send(ep.model_list(model_routes[self.path]))
|
||||
if self.command=='GET' and self.path=='/health':return self.send({'status':'ok','service':'athena-deck-api'})
|
||||
|
||||
Reference in New Issue
Block a user