Files
Mikei386 c0bc5d3a1b Integrate Basalt telemetry and shared GPU speech runtimes
Publish the reviewed accumulated runtime, scheduler, profile, UI, native recipes and historical maintenance evidence. Includes Qwen GPU ASR correction and shared Anna/atelier ownership. Validated with 784 local tests, Python/JSON parsing and eight JavaScript syntax checks. Live GPU acceptance and full fresh-host restore limits remain documented.
2026-11-03 21:16:41 +01:00

34 lines
2.8 KiB
Python

#!/usr/bin/env python3
"""NAS-only loopback UI fixture. No production API, models or credentials."""
import argparse,json
from http.server import BaseHTTPRequestHandler,ThreadingHTTPServer
from pathlib import Path
ROOT=Path(__file__).resolve().parents[3]
rows=[dict(id='clone',name='Qwen1.7B Stimmklonen',kind='voice',runnable=True,model={'repo':'Qwen/Qwen3-TTS-12Hz-1.7B-Base'}),dict(id='omni',name='OmniVoice Studio',kind='voice',runnable=True,model={'repo':'k2-fsa/OmniVoice'}),dict(id='cpu',name='Qwen CPU',kind='audio',runnable=True,model={'repo':'Serveurperso/Qwen3-TTS-GGUF'}),dict(id='stt',name='Synthetic STT',kind='stt',runnable=True,model={'repo':'test/stt'})]
rows.append(dict(id='seed',name='Existing Seed-VC',kind='voice',runnable=True,model={'repo':'Plachta/Seed-VC'}))
requests=[]
class Handler(BaseHTTPRequestHandler):
def log_message(self,*args):pass
def send(self,data,mime='application/json',status=200):
if not isinstance(data,bytes):data=json.dumps(data).encode()
self.send_response(status);self.send_header('Content-Type',mime);self.send_header('Content-Length',str(len(data)));self.end_headers();self.wfile.write(data)
def do_POST(self):
requests.append(['POST',self.path])
if self.path=='/api/v1/voice/select':return self.send({'shared_tts':True,'loaded':True})
self.send({'error':'Writes forbidden in isolated fixture'},status=405)
def do_GET(self):
requests.append(['GET',self.path])
if self.path=='/api/v1/profiles':return self.send({'profiles':rows})
if self.path=='/api/v1/audio-policy':return self.send({'settings':{'stt':{'profile_id':'stt'}}})
if self.path=='/api/v1/voice':return self.send({'mode':'llm','job':None,'shared_tts':{'loaded':True,'gpu_uuid':'synthetic','warming':False,'profile_id':'anna'}})
if self.path=='/audit':return self.send({'requests':requests})
if self.path=='/voice':return self.send(b'<!doctype html><html><meta charset="utf-8"><title>Isolated shared Qwen UI</title><body><main></main><script>window.DeckLinks={url:(p,s)=>s};</script><script src="/voice-ui.js"></script><script>document.querySelector("main").innerHTML=VoiceUI.html();VoiceUI.bind();</script></body></html>','text/html')
files={'/voice-ui.js':ROOT/'voice-ui.js','/atelier/':ROOT/'deploy/stimmatelier/index.html','/atelier/app.js':ROOT/'deploy/stimmatelier/app.js','/atelier/style.css':ROOT/'deploy/stimmatelier/style.css'}
if self.path in files:
path=files[self.path];return self.send(path.read_bytes(),'text/html' if path.suffix=='.html' else 'text/css' if path.suffix=='.css' else 'application/javascript')
self.send({'error':'not found'},status=404)
if __name__=='__main__':
p=argparse.ArgumentParser();p.add_argument('--port',type=int,default=18764);args=p.parse_args();server=ThreadingHTTPServer(('127.0.0.1',args.port),Handler);print('Isolated UI fixture ready',flush=True)
try:server.serve_forever()
finally:server.server_close()