Preserve compression headers in Seed-VC studio proxy
This commit is contained in:
1 parent
70e3561aa3
commit
00bf7edb4c
4 files changed
+10
-5
No files matched your search
@@ -62,8 +62,9 @@ def validate(c):
|
||||
if c.get('unsupported'):raise ValueError('GPU-/privilegierter Container benötigt manuelle Einrichtung.')
|
||||
if c.get('network') not in ('bridge','default','host'):raise ValueError('Benutzerdefiniertes Docker-Netzwerk benötigt manuelle Einrichtung.')
|
||||
if c.get('network')=='host' and c['name'] not in ('athena-swarm-ui','ltx-deskweb','athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web','athena-acestep-web','athena-applio-web','athena-xvc-web','athena-seed-vc-web'):raise ValueError('Host-Netzwerk nur für bekannte Deck-Oberflächen erlaubt.')
|
||||
recipes={'seed-vc-web':('athena-seed-vc-web','athena-seed-vc-web:0.1.0-deck1'),'xvc-web':('athena-xvc-web','athena-xvc-web:0.1.0-deck1'),'applio-web':('athena-applio-web','athena-applio-web:3.6.5-deck1'),'acestep-web':('athena-acestep-web','athena-acestep-web:1.0.0'),'separator-web':('athena-separator-web','athena-separator-web:0.1.0'),'swarm-ui':('athena-swarm-ui','athena-swarm-ui:de7b834'),'ladypoly':('athena-ladypoly','athena-ladypoly:3960afc-deck1')}
|
||||
if c.get('build_recipe')=='voice-web' and c['name'] in ('athena-voxcpm2-web','athena-omnivoice-web') and c.get('image') in ('athena-voice-web:0.2.1-deck1','athena-voice-web:0.2.1-deck2'):pass
|
||||
recipes={'seed-vc-web':('athena-seed-vc-web','athena-seed-vc-web:0.1.0-deck2'),'xvc-web':('athena-xvc-web','athena-xvc-web:0.1.0-deck1'),'applio-web':('athena-applio-web','athena-applio-web:3.6.5-deck1'),'acestep-web':('athena-acestep-web','athena-acestep-web:1.0.0'),'separator-web':('athena-separator-web','athena-separator-web:0.1.0'),'swarm-ui':('athena-swarm-ui','athena-swarm-ui:de7b834'),'ladypoly':('athena-ladypoly','athena-ladypoly:3960afc-deck1')}
|
||||
if c.get('build_recipe')=='seed-vc-web' and c['name']=='athena-seed-vc-web' and c.get('image') in ('athena-seed-vc-web:0.1.0-deck1','athena-seed-vc-web:0.1.0-deck2'):pass
|
||||
elif c.get('build_recipe')=='voice-web' and c['name'] in ('athena-voxcpm2-web','athena-omnivoice-web') and c.get('image') in ('athena-voice-web:0.2.1-deck1','athena-voice-web:0.2.1-deck2'):pass
|
||||
elif c.get('build_recipe') is not None and recipes.get(c['build_recipe'])!=(c['name'],c.get('image')):raise ValueError('Unbekanntes Build-Rezept.')
|
||||
ref=c.get('registry') or c.get('image','')
|
||||
if not isinstance(ref,str) or not re.fullmatch(r'[A-Za-z0-9][A-Za-z0-9._/@:-]{0,300}',ref):raise ValueError('Ungültige Image-Referenz.')
|
||||
|
||||
@@ -31,7 +31,7 @@ def prepare(state,create_container=True):
|
||||
if labels.get('io.athena-deck.managed')!='true' or labels.get('io.athena-deck.application')!='seed-vc-web':raise ValueError('Containername anderweitig belegt.')
|
||||
if row['State']['Running']:raise ValueError('Vorhandene Seed-VC-UI läuft bereits; Vorbereitung verändert sie nicht.')
|
||||
else:
|
||||
subprocess.run(['docker','create','--name',name,'--network','host','--restart','unless-stopped','--label','io.athena-deck.managed=true','--label','io.athena-deck.role=application','--label','io.athena-deck.application=seed-vc-web','--read-only','--cap-drop','ALL','--security-opt','no-new-privileges:true','--pids-limit','128','--memory','512m','--cpus','1','--tmpfs','/tmp:rw,noexec,nosuid,size=128m,uid=65534,gid=65534','--mount','type=bind,src='+str(key)+',dst=/run/secrets/seed-vc-bridge,readonly','athena-seed-vc-web:0.1.0-deck1'],check=True,stdout=subprocess.DEVNULL)
|
||||
subprocess.run(['docker','create','--name',name,'--network','host','--restart','unless-stopped','--label','io.athena-deck.managed=true','--label','io.athena-deck.role=application','--label','io.athena-deck.application=seed-vc-web','--read-only','--cap-drop','ALL','--security-opt','no-new-privileges:true','--pids-limit','128','--memory','512m','--cpus','1','--tmpfs','/tmp:rw,noexec,nosuid,size=128m,uid=65534,gid=65534','--mount','type=bind,src='+str(key)+',dst=/run/secrets/seed-vc-bridge,readonly','athena-seed-vc-web:0.1.0-deck2'],check=True,stdout=subprocess.DEVNULL)
|
||||
print('Seed-VC: inaktives Profil vorbereitet, UI-Container gestoppt. Keine Endpunktfreigabe geändert.')
|
||||
|
||||
def apply_profile(state,deck='athena-deck-dev'):
|
||||
|
||||
@@ -48,7 +48,7 @@ in Abschnitten verarbeitet. Wie im Original werden nur die ersten 25 Sekunden
|
||||
der Referenz verwendet; die Oberfläche erklärt das ausdrücklich.
|
||||
|
||||
Optionaler, CPU-only UI-Proxy als registrierter Container unter Weitere Dienste:
|
||||
`athena-seed-vc-web`, Port 8136, Image `athena-seed-vc-web:0.1.0-deck1`.
|
||||
`athena-seed-vc-web`, Port 8136, Image `athena-seed-vc-web:0.1.0-deck2`.
|
||||
Native interne Oberfläche Port 8137; per Brückenschlüssel geschützt. Container
|
||||
enthält keine Gewichte und erhält keinen GPU-Zugriff. Falls die bestehende
|
||||
Containerinstallation noch läuft, bereitet `deploy/prepare_seed_vc.py` nur ein
|
||||
@@ -75,3 +75,7 @@ Profil-, Lease-, Quellprüfsummen- und Restore-Tests in `test_seed_vc.py` und
|
||||
alle Zusatzmodelle. GPU- und Hörtest stehen bis zur bewussten Freigabe auf Athena
|
||||
noch aus. Ein vorbereitetes App-Image darf den laufenden Deck-Dienst nicht
|
||||
ungefragt ersetzen.
|
||||
|
||||
UI-Proxy deck2 erhält den Content-Encoding-Header bei komprimierten Gradio-Assets.
|
||||
Ohne ihn blieb der Browser trotz HTTP 200 leer. Deck und Modellworker benötigen
|
||||
für dieses Proxy-Update keinen Neustart; alte deck1-Sicherungen bleiben lesbar.
|
||||
@@ -18,7 +18,7 @@ async def proxy(path:str,request:Request):
|
||||
req=client.build_request(request.method,'http://127.0.0.1:8137/'+path,params=request.query_params,headers=headers,content=request.stream())
|
||||
response=await client.send(req,stream=True)
|
||||
async def close():await response.aclose();await client.aclose()
|
||||
safe={k:v for k,v in response.headers.items() if k in ('content-type','content-length','location','content-disposition')};safe['Cache-Control']='no-store'
|
||||
safe={k:v for k,v in response.headers.items() if k in ('content-type','content-length','content-encoding','location','content-disposition')};safe['Cache-Control']='no-store'
|
||||
return StreamingResponse(response.aiter_raw(),status_code=response.status_code,headers=safe,background=BackgroundTask(close))
|
||||
except (OSError,httpx.HTTPError):
|
||||
await client.aclose();return JSONResponse({'detail':'Seed-VC ist vorbereitet, aber noch nicht gestartet. In Deck ein Seed-VC-Profil aktivieren und Stimmwerkzeuge starten.'},status_code=503)
|
||||
Reference in new issue
Block a user