Add isolated Stimmatelier Qwen speech studio and restore recipe
This commit is contained in:
1 parent
182c8a1e8f
commit
2664ea8bd8
21 files changed
+397
-14
No files matched your search
@@ -53,16 +53,16 @@ def export(manager):
|
||||
try:relative=str(Path(source).relative_to(deck))
|
||||
except ValueError:pass
|
||||
mounts.append(dict(index=i,target=m['Destination'],read_only=not m['RW'],deck_path=relative,files=config_files(source,m['Destination']),was_file=Path(source).is_file()))
|
||||
result.append(dict(name=row['name'],image=c['Image'],registry=registry,application=c.get('Labels',{}).get(APP,''),labels={k:v for k,v in (c.get('Labels') or {}).items() if k.startswith('io.athena-deck.')},env=c.get('Env') or [],entrypoint=c.get('Entrypoint'),cmd=c.get('Cmd'),uid=app_uid(row['id'],c.get('User') or ''),user=c.get('User') or '',workdir=c.get('WorkingDir') or '',network=h['NetworkMode'],ports=h.get('PortBindings') or {},restart=h.get('RestartPolicy',{}).get('Name') or 'no',memory=h.get('Memory') or 0,nanocpus=h.get('NanoCpus') or 0,running=x['State']['Running'],mounts=mounts,build_recipe='swarm-ui' if row['name']=='athena-swarm-ui' else 'ladypoly' if row['name']=='athena-ladypoly' else 'separator-web' if row['name']=='athena-separator-web' else 'soulx-singer-web' if row['name']=='athena-soulx-singer-web' else 'xvc-web' if row['name']=='athena-xvc-web' else 'applio-web' if row['name']=='athena-applio-web' else 'acestep-web' if row['name']=='athena-acestep-web' else 'voice-web' if row['name'] in ('athena-voxcpm2-web','athena-omnivoice-web') else None,unsupported=bool(h.get('Privileged') or h.get('DeviceRequests') or h.get('Devices') or h.get('CapAdd'))))
|
||||
result.append(dict(name=row['name'],image=c['Image'],registry=registry,application=c.get('Labels',{}).get(APP,''),labels={k:v for k,v in (c.get('Labels') or {}).items() if k.startswith('io.athena-deck.')},env=c.get('Env') or [],entrypoint=c.get('Entrypoint'),cmd=c.get('Cmd'),uid=app_uid(row['id'],c.get('User') or ''),user=c.get('User') or '',workdir=c.get('WorkingDir') or '',network=h['NetworkMode'],ports=h.get('PortBindings') or {},restart=h.get('RestartPolicy',{}).get('Name') or 'no',memory=h.get('Memory') or 0,nanocpus=h.get('NanoCpus') or 0,running=x['State']['Running'],mounts=mounts,build_recipe='swarm-ui' if row['name']=='athena-swarm-ui' else 'ladypoly' if row['name']=='athena-ladypoly' else 'separator-web' if row['name']=='athena-separator-web' else 'soulx-singer-web' if row['name']=='athena-soulx-singer-web' else 'xvc-web' if row['name']=='athena-xvc-web' else 'applio-web' if row['name']=='athena-applio-web' else 'acestep-web' if row['name']=='athena-acestep-web' else 'stimmatelier' if row['name']=='athena-stimmatelier' else 'voice-web' if row['name'] in ('athena-voxcpm2-web','athena-omnivoice-web') else None,unsupported=bool(h.get('Privileged') or h.get('DeviceRequests') or h.get('Devices') or h.get('CapAdd'))))
|
||||
return {'services':result,'configured':bool(deck)}
|
||||
|
||||
def validate(c):
|
||||
if not isinstance(c,dict) or not re.fullmatch(r'[a-zA-Z0-9][a-zA-Z0-9_.-]{0,63}',c.get('name','')):raise ValueError('Ungültiger Containername.')
|
||||
if any(c.get('labels',{}).get(k)!=v for k,v in LABELS.items()):raise ValueError('Nur ausdrücklich Deck zugeordnete Anwendungscontainer erlaubt.')
|
||||
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') not in ('bridge','default','host','none'):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-soulx-singer-web'):raise ValueError('Host-Netzwerk nur für bekannte Deck-Oberflächen erlaubt.')
|
||||
recipes={'soulx-singer-web':('athena-soulx-singer-web','athena-soulx-singer-web:0.1.0'),'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')}
|
||||
recipes={'stimmatelier':('athena-stimmatelier','athena-stimmatelier:0.1.0'),'soulx-singer-web':('athena-soulx-singer-web','athena-soulx-singer-web:0.1.0'),'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
|
||||
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','')
|
||||
@@ -97,8 +97,9 @@ def validate(c):
|
||||
native_soulx_singer=rel=='soulx_singer-data/bridge-key' and c['name']=='athena-soulx-singer-web' and target=='/run/secrets/soulx-singer-bridge' and m['read_only'] and m['was_file']
|
||||
native_xvc=rel=='xvc-data/bridge-key' and c['name']=='athena-xvc-web' and target=='/run/secrets/xvc-bridge' and m['read_only'] and m['was_file']
|
||||
native_applio=rel=='applio-data/bridge-key' and c['name']=='athena-applio-web' and target=='/run/secrets/applio-bridge' and m['read_only'] and m['was_file']
|
||||
native_studio=rel=='stimmatelier-ui' and c['name']=='athena-stimmatelier' and target=='/data' and not m['read_only'] and not m['was_file']
|
||||
native_media=rel in media and c['name']=='ltx-deskweb' and (target,m['read_only'])==media[rel] and not m['was_file']
|
||||
if rel is not None and not native_media and not native_applio and not native_xvc and not native_soulx_singer and (rel not in ('models','video/comfy-work/models','video/comfy-client-token') or not m['read_only']):raise ValueError('Deck-Volume nicht freigegeben; nur bekannte Modell-/Tokenpfade und LTX-Medienordner erlaubt.')
|
||||
if rel is not None and not native_media and not native_applio and not native_xvc and not native_soulx_singer and not native_studio and (rel not in ('models','video/comfy-work/models','video/comfy-client-token') or not m['read_only']):raise ValueError('Deck-Volume nicht freigegeben; nur bekannte Modell-/Tokenpfade und LTX-Medienordner erlaubt.')
|
||||
for name,data in m.get('files',{}).items():
|
||||
allowed=('file','Settings.fds','Backends.fds')
|
||||
if c['name'] in ('athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web','athena-acestep-web','athena-applio-web','athena-xvc-web','athena-soulx-singer-web') and m['target']=='/data':allowed+=('settings.json','deck-connection.json')
|
||||
@@ -121,7 +122,7 @@ def restore(manager,c):
|
||||
return {'state':'reused','message':'Vorhandener markierter Container unverändert übernommen.'}
|
||||
if c['name'] in ('athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web','athena-acestep-web','athena-applio-web','athena-xvc-web','athena-soulx-singer-web'):
|
||||
with socket.socket() as probe:probe.bind(('127.0.0.1',{'athena-ladypoly':8127,'athena-separator-web':8128,'athena-voxcpm2-web':8129,'athena-omnivoice-web':8130,'athena-acestep-web':8131,'athena-applio-web':8132,'athena-xvc-web':8133,'athena-soulx-singer-web':8138}[c['name']]))
|
||||
if c.get('build_recipe') in ('swarm-ui','ladypoly','separator-web','voice-web','acestep-web','applio-web','xvc-web','soulx-singer-web'):
|
||||
if c.get('build_recipe') in ('swarm-ui','ladypoly','separator-web','voice-web','acestep-web','applio-web','xvc-web','soulx-singer-web','stimmatelier'):
|
||||
source=Path(__file__).parent/c['build_recipe']
|
||||
if not (source/'Dockerfile').is_file():raise ValueError('Gepinntes Swarm-Build-Rezept fehlt im Systemhelfer.')
|
||||
if c['build_recipe']=='voice-web':
|
||||
@@ -149,7 +150,7 @@ def restore(manager,c):
|
||||
if base.is_symlink():raise ValueError('Unsicheres Dienstverzeichnis.')
|
||||
base.mkdir(parents=True,exist_ok=True,mode=0o700)
|
||||
args=['create','--name',name,'--network',c['network'],'--restart',c['restart'],'--cap-drop','ALL','--security-opt','no-new-privileges:true','--pids-limit','256']
|
||||
if c['name'] in ('athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web','athena-acestep-web','athena-applio-web','athena-xvc-web','athena-soulx-singer-web'):
|
||||
if c['name'] in ('athena-stimmatelier','athena-ladypoly','athena-separator-web','athena-voxcpm2-web','athena-omnivoice-web','athena-acestep-web','athena-applio-web','athena-xvc-web','athena-soulx-singer-web'):
|
||||
args+=['--read-only','--tmpfs','/tmp:rw,noexec,nosuid,size='+('1g' if c['name']=='athena-separator-web' else '128m')+',uid=65534,gid=65534']
|
||||
if c['memory']:args+=['--memory',str(c['memory'])]
|
||||
if c['nanocpus']:args+=['--cpus',str(c['nanocpus']/1e9)]
|
||||
@@ -181,8 +182,9 @@ def restore(manager,c):
|
||||
target=source/filename;target.write_bytes(base64.b64decode(data));target.chmod(0o600)
|
||||
# Application UIDs commonly used by these rootless interfaces.
|
||||
uid=c.get('uid',int(c['user'].split(':')[0]) if c['user'].split(':')[0].isdigit() else 0)
|
||||
if m['deck_path'] is None:
|
||||
if m['deck_path'] is None or c['name']=='athena-stimmatelier' and m['deck_path']=='stimmatelier-ui':
|
||||
os.chown(source,uid,uid)
|
||||
if c['name']=='athena-stimmatelier':source.chmod(0o700)
|
||||
if source.is_dir():
|
||||
for p in source.iterdir():os.chown(p,uid,uid)
|
||||
args+=['--mount',f'type=bind,src={source},dst={m["target"]}'+(',readonly' if m['read_only'] else '')]
|
||||
|
||||
+4
-2
@@ -15,7 +15,7 @@ import urllib.request
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
LABEL = 'de.casaderoll.athena-deck.standalone'
|
||||
FILES = ['qwen_native.py','qwen_native_worker.py','qwen_native_runtime.py','deploy/qwen-native-requirements.lock','deploy/import_qwen_native.py','deploy/install_strata_vision.py','assets/tts-presets/bundle.safetensors','assets/tts-presets/bundle.json','deploy/applio-requirements.lock','deploy/activate_applio.py','deploy/import_applio.py','deploy/backup_applio_data.py','applio.py','applio_runtime.py','applio_worker.py','applio-ui.js','deploy/activate_acestep.py','acestep_models.py','deploy/import_acestep.py','deploy/acestep-web/Dockerfile','deploy/acestep-web/app.py','deploy/acestep-web/index.html','acestep.py','acestep_worker.py','acestep_runtime.py','acestep-ui.js','deploy/acestep-requirements.lock','deploy/omnivoice-requirements.lock','omnivoice_runtime.py','omnivoice_worker.py','deploy/voice-web/Dockerfile','deploy/voice-web/base.Dockerfile','deploy/voice-web/bridge.py','deploy/patch_yue2_residency.py','embeddings.py','voxcpm_test.py','voxcpm_worker.py','qwen_clone_worker.py','voice-ui.js','voxcpm_runtime.py','voxcpm-ui.js','deploy/voxcpm-requirements.lock','network/native.py','deploy/setup_network_helper.py','separator_sources.json','deploy/separator-web/Dockerfile','deploy/separator-web/app.py','deploy/separator-web/index.html','separator.py','separator_runtime.py','separator_worker.py','separator-ui.js','deploy/ladypoly/Dockerfile','deploy/ladypoly/bridge.py','music.py','music-ui.js','audio_cpp_runtime.py','audio-cpp-ui.js','ltx_original_runtime.py','ltx_original_entry.py','video_original.py','ltx-original-ui.js','deploy/ltx-original-requirements.lock','backup.py','backup_codec.py','backup-ui.js','deploy/docker_backup.py','deploy/swarm-ui/Dockerfile','deploy/swarm-ui/patch-source.py','deploy/swarm-ui/proxy.py','deploy/swarm-ui/entrypoint.py','deploy/Dockerfile.app-update','video_comfy.py','video_comfy_node.py','video_comfy_proxy.py','prompt_enhancer.py','prompt_enhancer_worker.py','image_upload.py','audio_policy.py','deploy/tts-requirements.lock','stt.py','parakeet_runtime.py','stt-ui.js','api_compat.py','responses_compat.py','execution_setup.py','pocket.py','pocket_worker.py','pocket_runtime.py','deploy/pocket-requirements.lock','deploy/import_pocket.py','tts_runtime.py','tts_test.py','tts_worker.py','tts-ui.js','auto_test.py','auto-test-ui.js','chat_test.py','chat-test-ui.js','endpoint.py','inference.py','endpoint-ui.js','docker_support.py','docker-ui.js','deploy/docker_helper.py','deploy/setup_docker_helper.py','image_encoder_node.py','image_runtime.py','image_test.py','image-test-ui.js','profiles.py','profiles-ui.js','capacity.py','runtime.py','runtime-ui.js','video.py','video_proxy.py','video-ui.js','catalog.py','hub_auth.py','catalog-ui.js','server.py','auth.py','collect_hardware.py','dashboard_data.py','dashboard_history.py','dashboard-ui.js','dashboard.css','themes.css','deploy/import_dashboard_history.py','index.html','app.js','studio.js','style.css','login.html','login.js','access-ui.js','network-ui.js','network/__init__.py','network/client.py','network/config.py','network/hosts.py','network/policy.py','network/rpc.py','deploy/Dockerfile','deploy/image-requirements.lock']
|
||||
FILES = ['stimmatelier_proxy.py','qwen_native.py','qwen_native_worker.py','qwen_native_runtime.py','deploy/qwen-native-requirements.lock','deploy/import_qwen_native.py','deploy/install_strata_vision.py','assets/tts-presets/bundle.safetensors','assets/tts-presets/bundle.json','deploy/applio-requirements.lock','deploy/activate_applio.py','deploy/import_applio.py','deploy/backup_applio_data.py','applio.py','applio_runtime.py','applio_worker.py','applio-ui.js','deploy/activate_acestep.py','acestep_models.py','deploy/import_acestep.py','deploy/acestep-web/Dockerfile','deploy/acestep-web/app.py','deploy/acestep-web/index.html','acestep.py','acestep_worker.py','acestep_runtime.py','acestep-ui.js','deploy/acestep-requirements.lock','deploy/omnivoice-requirements.lock','omnivoice_runtime.py','omnivoice_worker.py','deploy/voice-web/Dockerfile','deploy/voice-web/base.Dockerfile','deploy/voice-web/bridge.py','deploy/patch_yue2_residency.py','embeddings.py','voxcpm_test.py','voxcpm_worker.py','qwen_clone_worker.py','voice-ui.js','voxcpm_runtime.py','voxcpm-ui.js','deploy/voxcpm-requirements.lock','network/native.py','deploy/setup_network_helper.py','separator_sources.json','deploy/separator-web/Dockerfile','deploy/separator-web/app.py','deploy/separator-web/index.html','separator.py','separator_runtime.py','separator_worker.py','separator-ui.js','deploy/ladypoly/Dockerfile','deploy/ladypoly/bridge.py','music.py','music-ui.js','audio_cpp_runtime.py','audio-cpp-ui.js','ltx_original_runtime.py','ltx_original_entry.py','video_original.py','ltx-original-ui.js','deploy/ltx-original-requirements.lock','backup.py','backup_codec.py','backup-ui.js','deploy/docker_backup.py','deploy/swarm-ui/Dockerfile','deploy/swarm-ui/patch-source.py','deploy/swarm-ui/proxy.py','deploy/swarm-ui/entrypoint.py','deploy/Dockerfile.app-update','video_comfy.py','video_comfy_node.py','video_comfy_proxy.py','prompt_enhancer.py','prompt_enhancer_worker.py','image_upload.py','audio_policy.py','deploy/tts-requirements.lock','stt.py','parakeet_runtime.py','stt-ui.js','api_compat.py','responses_compat.py','execution_setup.py','pocket.py','pocket_worker.py','pocket_runtime.py','deploy/pocket-requirements.lock','deploy/import_pocket.py','tts_runtime.py','tts_test.py','tts_worker.py','tts-ui.js','auto_test.py','auto-test-ui.js','chat_test.py','chat-test-ui.js','endpoint.py','inference.py','endpoint-ui.js','docker_support.py','docker-ui.js','deploy/docker_helper.py','deploy/setup_docker_helper.py','image_encoder_node.py','image_runtime.py','image_test.py','image-test-ui.js','profiles.py','profiles-ui.js','capacity.py','runtime.py','runtime-ui.js','video.py','video_proxy.py','video-ui.js','catalog.py','hub_auth.py','catalog-ui.js','server.py','auth.py','collect_hardware.py','dashboard_data.py','dashboard_history.py','dashboard-ui.js','dashboard.css','themes.css','deploy/import_dashboard_history.py','index.html','app.js','studio.js','style.css','login.html','login.js','access-ui.js','network-ui.js','network/__init__.py','network/client.py','network/config.py','network/hosts.py','network/policy.py','network/rpc.py','deploy/Dockerfile','deploy/image-requirements.lock']
|
||||
|
||||
|
||||
FILES += ['soulx_singer.py','soulx_singer_runtime.py','soulx-singer-ui.js','deploy/prepare_soulx_singer.py']
|
||||
@@ -26,6 +26,8 @@ FILES += ['deploy/read_backup_snapshot.py','speech_text.py','tts_text_enhancer.p
|
||||
FILES += sorted(str(p.relative_to(ROOT)) for p in (ROOT/'deploy/xvc-web').rglob('*') if p.is_file() and not {'__pycache__','.pytest_cache'} & set(p.parts))
|
||||
FILES += sorted(str(p.relative_to(ROOT)) for p in (ROOT/'deploy/applio-web').rglob('*') if p.is_file() and not {'__pycache__','.pytest_cache'} & set(p.parts))
|
||||
|
||||
FILES += ['deploy/stimmatelier/'+n for n in ('app.py','index.html','app.js','style.css','Dockerfile','README.md')]
|
||||
|
||||
def run(*args, check=True, interactive=False):
|
||||
result = subprocess.run(args, text=True, capture_output=not interactive)
|
||||
if check and result.returncode:
|
||||
@@ -268,7 +270,7 @@ def update(base, rollback=False, force=False, api_ports=None, reuse_runtime=Fals
|
||||
backup_name=config['name']+'-previous'
|
||||
if inspect(backup_name):raise RuntimeError('Rückfall-Containername belegt. Keine Änderung ausgeführt.')
|
||||
stamp=str(time.time_ns())
|
||||
shutil.copytree(base/'state',base/'backups'/stamp,ignore=shutil.ignore_patterns('strata-runtime','strata-worker','strata-data','strata-ssd','strata-install-src','soulx_singer-runtime','soulx_singer-data','seed_vc-runtime','seed_vc-data','seed_vc-prepare','reference-models','xvc-runtime','xvc-data','xvc-prepare','cache','omni-reference-check.py','omni-cache-clean.py','applio-runtime','applio-data','applio-checkout','applio-runtime.py','import_applio.py','applio-migration.log','acestep-runtime','acestep-jobs','acestep-setup-code','acestep-checkout','acestep-source-files','acestep-test-tmp','music-verification','music-test-temp','music-jobs','music-remix-runtime','separator-runtime','separator-tests','voxcpm-runtime','omnivoice-runtime','voice-worker-check','voice-integration-check','voice-setup-code','audio-cpp-runtime','ltx-original-runtime','original-work','tts-runtime','tts-tests','voice-tests','models','runtime','runtime-verification','image-tests','image-verification','image-verification-*','image-runtime','video-runtime','video-verification','video-verification-*','comfy-work','router-verification-*'))
|
||||
shutil.copytree(base/'state',base/'backups'/stamp,ignore=shutil.ignore_patterns('stimmatelier-ui','qwen-native-runtime','qwen-native-jobs','strata-runtime','strata-worker','strata-data','strata-ssd','strata-install-src','soulx_singer-runtime','soulx_singer-data','seed_vc-runtime','seed_vc-data','seed_vc-prepare','reference-models','xvc-runtime','xvc-data','xvc-prepare','cache','omni-reference-check.py','omni-cache-clean.py','applio-runtime','applio-data','applio-checkout','applio-runtime.py','import_applio.py','applio-migration.log','acestep-runtime','acestep-jobs','acestep-setup-code','acestep-checkout','acestep-source-files','acestep-test-tmp','music-verification','music-test-temp','music-jobs','music-remix-runtime','separator-runtime','separator-tests','voxcpm-runtime','omnivoice-runtime','voice-worker-check','voice-integration-check','voice-setup-code','audio-cpp-runtime','ltx-original-runtime','original-work','tts-runtime','tts-tests','voice-tests','models','runtime','runtime-verification','image-tests','image-verification','image-verification-*','image-runtime','video-runtime','video-verification','video-verification-*','comfy-work','router-verification-*'))
|
||||
was_running=previous['State']['Running']
|
||||
if was_running:run('docker','stop','--time','15',config['name'])
|
||||
run('docker','rename',config['name'],backup_name)
|
||||
|
||||
@@ -23,7 +23,7 @@ def key():
|
||||
return KEY.read_bytes().strip()+b'\n'
|
||||
|
||||
def sources():
|
||||
names=('speech-voices','pocket-jobs','soulx_singer-data','legacy-userdata','applio-data','xvc-data','voice-tests','music-jobs','acestep-jobs','separator-tests','image-tests','tts-tests')
|
||||
names=('qwen-native-jobs','speech-voices','pocket-jobs','soulx_singer-data','legacy-userdata','applio-data','xvc-data','voice-tests','music-jobs','acestep-jobs','separator-tests','image-tests','tts-tests')
|
||||
roots=[(STATE/n,'deck/'+n) for n in names]+[(STATE/'video/original-work/outputs','deck/video/original-work/outputs'),(STATE/'video/original-work/remote-inputs','deck/video/original-work/remote-inputs'),(STATE/'video/original-work/deskweb','deck/video/original-work/deskweb'),(Path('/opt/athena-ladypoly/data'),'services/ladypoly'),(Path('/opt/athena-deck-docker-apps'),'services/web-studios')]
|
||||
# Private locally-trained voices have no public replacement source.
|
||||
for p in (STATE/'models').glob('*/entry.json'):
|
||||
|
||||
@@ -22,6 +22,9 @@ def main():
|
||||
if target.is_symlink():raise SystemExit('Symlink-Ziel nicht zulässig.')
|
||||
shutil.copyfile(Path(__file__).with_name('docker_helper.py'),target);os.chown(target,0,0);target.chmod(0o644);(base/'managed-by-deck').touch()
|
||||
shutil.copyfile(Path(__file__).with_name('docker_backup.py'),base/'docker_backup.py')
|
||||
(base/'stimmatelier').mkdir(exist_ok=True)
|
||||
for name in ('Dockerfile','app.py','index.html','app.js','style.css','README.md'):
|
||||
shutil.copyfile(Path(__file__).parent/'stimmatelier'/name,base/'stimmatelier'/name)
|
||||
(base/'swarm-ui').mkdir(exist_ok=True)
|
||||
for name in ('Dockerfile','patch-source.py','proxy.py','entrypoint.py'):
|
||||
shutil.copyfile(Path(__file__).parent/'swarm-ui'/name,base/'swarm-ui'/name)
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
FROM python:3.12-slim@sha256:78387bc3881b8273120a12ebe6c1ab22b018ccc2c9adf565ae1ac9b536e184ea
|
||||
WORKDIR /app
|
||||
COPY app.py index.html app.js style.css /app/
|
||||
ENV PYTHONDONTWRITEBYTECODE=1 PYTHONUNBUFFERED=1
|
||||
USER 65534:65534
|
||||
ENTRYPOINT ["python3", "/app/app.py"]
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s CMD ["python3", "-c", "import socket; s=socket.socket(socket.AF_UNIX); s.settimeout(2); s.connect('/data/ui.sock'); s.sendall(b'GET / HTTP/1.0\\r\\n\\r\\n'); assert b'200' in s.recv(128); s.close()"]
|
||||
@@ -0,0 +1,123 @@
|
||||
# Stimmatelier
|
||||
|
||||
Private Qwen speech studio for Athena Deck. German, responsive browser UI with
|
||||
text input, reference WAV, reference recording, source WAV/recording → local STT
|
||||
→ editable transcript → cloned speech, waveform, playback and WAV download.
|
||||
No live conversion. Qwen 0.6B Q8 native CPU and 1.7B Base GPU are discovered from
|
||||
Deck's runnable profiles. CPU reuses Deck's standard voice if no reference is
|
||||
supplied. GPU requires a reference; its transcript is optional. No model copies,
|
||||
cloud services, client patches, browser secrets, Docker socket or GPU in this UI.
|
||||
|
||||
## Integration and deployment
|
||||
|
||||
Requires Athena Deck's Stimmatelier integration (authenticated static Unix-socket
|
||||
proxy and multipart reference upload for native Qwen). This is not a standalone
|
||||
model server. The browser calls Deck's existing session-authenticated APIs;
|
||||
there is no copied API key, second login or login bypass. The existing HTTPS
|
||||
origin provides microphone access. Insecure LAN HTTP cannot use the microphone.
|
||||
|
||||
```sh
|
||||
docker build -t athena-stimmatelier:0.1.0 .
|
||||
# STATE is the configured Deck state directory; use Deck's unprivileged UID/GID.
|
||||
install -d -m 700 -o 65534 -g 65534 "$STATE/stimmatelier-ui"
|
||||
docker run -d --name athena-stimmatelier --restart unless-stopped \
|
||||
--network none --read-only --cap-drop ALL --security-opt no-new-privileges:true \
|
||||
--pids-limit 64 --memory 128m --memory-swap 128m --cpus .5 \
|
||||
--label io.athena-deck.managed=true --label io.athena-deck.role=application \
|
||||
--label io.athena-deck.application=stimmatelier \
|
||||
-v "$STATE/stimmatelier-ui:/data" athena-stimmatelier:0.1.0
|
||||
```
|
||||
|
||||
Open `/stimmatelier/` on the signed-in Deck HTTPS origin, or use **Weitere
|
||||
Dienste → Stimmatelier**. The UI container listens only on `/data/ui.sock`;
|
||||
there are no TCP ports or outbound network. Deck reads only three fixed assets
|
||||
through the socket and never forwards cookies/credentials to the container.
|
||||
For native Debian Deck, use its configured state root and service UID, with the
|
||||
same optional Docker recipe. The UI can also run via `python3 app.py` under that
|
||||
UID with `STUDIO_SOCKET=<Deck state>/stimmatelier-ui/ui.sock`; Python 3.12+, no
|
||||
third-party packages. Docker is optional for a native Deck deployment.
|
||||
|
||||
## Limits and stored data
|
||||
|
||||
- German speech, text up to 1000 characters per job.
|
||||
- Reference WAV: 1–30 seconds; source recording: 1–120 seconds; files ≤16 MiB.
|
||||
- Browser recording is explicitly started/stopped, converted to mono PCM WAV,
|
||||
and shown for preview. A denied microphone permission does not affect uploads.
|
||||
- STT transcription is editable. Timing, singing and original prosody are not
|
||||
preserved by STT → TTS. This is not X-VC/RVC voice conversion.
|
||||
- 0.6B uses the existing CPU worker; model stays loaded under Deck's warm policy.
|
||||
Custom references transfer speaker identity, no reference-transcript mode.
|
||||
- 1.7B uses Deck's normal GPU scheduler and can unload Strata after current work
|
||||
drains. The existing 1.7B worker stays loaded until profile/GPU/mode changes.
|
||||
- References are deleted from Deck's job files on completion, failure or cancel;
|
||||
temporary reference embeddings stay only in worker memory. Source audio and
|
||||
transcript follow existing STT's memory-only policy. Generated WAVs remain in
|
||||
Deck's job directories. The static UI persists no user data or credentials.
|
||||
- Closing the tab does not cancel a running backend job. Shared worker status
|
||||
can be replaced by another user/job; the UI detects mismatching job IDs.
|
||||
|
||||
## Backup, restore and updates
|
||||
|
||||
Keep this source revision, the pinned Dockerfile base digest, and Deck's
|
||||
integration revision. UI container configuration/build recipe are included in
|
||||
Deck's labelled-application backup. Its sole writable mount contains a transient
|
||||
socket, recreated at startup; there is no UI database to back up. Preserve Deck
|
||||
profiles, runtime recipes, public model manifests, encrypted private voices and
|
||||
output jobs through Deck's configuration/userdata backups. Venvs are rebuilt
|
||||
using Deck's pinned runtime recipes after OS/Python changes. Restoring the UI
|
||||
alone is not a full fresh-host restore of Athena. No such full-host acceptance
|
||||
is implied here. Rebuild the image from the same source and recreate the named
|
||||
container; Deck and models need not restart for a UI-only update.
|
||||
|
||||
No private recordings, generated WAVs, model weights or credentials belong in Git.
|
||||
|
||||
## Native systemd option
|
||||
|
||||
For a native Deck installation, provision Python 3.12+ (Debian's `python3`), copy
|
||||
this revision's five source/assets into `/opt/stimmatelier` owned by root and
|
||||
readable by the configured Deck service user. Create the studio socket directory
|
||||
with mode 0700 owned by that same user/group. No venv, pip, CUDA or model runtime
|
||||
is required for this UI. Example unit for a Deck service user `athena-deck` and
|
||||
state root `/var/lib/athena-deck` (adapt both to the actual installation):
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=Stimmatelier static Qwen studio
|
||||
After=local-fs.target
|
||||
[Service]
|
||||
Type=simple
|
||||
User=athena-deck
|
||||
Group=athena-deck
|
||||
Environment=STUDIO_SOCKET=/var/lib/athena-deck/stimmatelier-ui/ui.sock
|
||||
ExecStart=/usr/bin/python3 /opt/stimmatelier/app.py
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
NoNewPrivileges=yes
|
||||
ProtectSystem=strict
|
||||
ProtectHome=yes
|
||||
PrivateTmp=yes
|
||||
PrivateNetwork=yes
|
||||
RestrictAddressFamilies=AF_UNIX
|
||||
ReadWritePaths=/var/lib/athena-deck/stimmatelier-ui
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
Save as `/etc/systemd/system/stimmatelier.service`, then `systemctl daemon-reload`
|
||||
and `systemctl enable --now stimmatelier`. Socket directory and Deck's configured
|
||||
state root must match. The current production deployment is Docker; this native
|
||||
unit is an installation recipe, not a claim of native fresh-host acceptance.
|
||||
|
||||
## Acceptance on Athena, 2026-10-19
|
||||
|
||||
- Authenticated HTTPS browser: CPU 0.6B with uploaded synthetic reference → WAV
|
||||
(6.6 seconds); GPU 1.7B with reference and reference transcript → WAV
|
||||
(5.9 seconds). These are output durations, not generation timings.
|
||||
- Uploaded source → 16 kHz PCM STT → editable transcript → 1.7B output passed.
|
||||
Reference preparation uses 24 kHz PCM. Actual WAV download passed.
|
||||
- UI container rebuilt/recreated and remained reachable; healthcheck healthy,
|
||||
restart policy `unless-stopped`, no TCP ports or model copies.
|
||||
- Microphone capture is implemented for reference and source recordings; a real
|
||||
device microphone recording still requires user acceptance in their browser.
|
||||
- Deck integration auth/reference/backup/proxy tests passed. No full fresh-host
|
||||
restore or subjective voice-quality acceptance is implied.
|
||||
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
const $=id=>document.getElementById(id);let profiles=[],sttId=null,busy=false,reference=null,source=null,recording=null,outputUrl=null;
|
||||
async function api(path,body){const opts=body?{method:'POST',headers:{'X-Athena-Deck':'1'},body:body instanceof FormData?body:JSON.stringify(body)}:{};if(body&&!(body instanceof FormData))opts.headers['Content-Type']='application/json';const r=await fetch('/api/v1/'+path,opts);if(r.status===401)throw Error('Bitte zuerst in Athena Deck anmelden und diese Seite neu laden.');const d=await r.json();if(!r.ok)throw Error(typeof d.error==='string'?d.error:d.error?.message||'Anfrage fehlgeschlagen.');return d;}
|
||||
function error(e){$('error').textContent=e.message||String(e);$('error').hidden=false;}
|
||||
function selected(){return profiles.find(p=>p.id===$('profile').value);}
|
||||
function update(){const p=selected(),cpu=p?.kind==='audio';$('model-note').textContent=cpu?'0,6B Q8 · CPU · Strata kann geladen bleiben. Eigene Referenzen übernehmen die Stimmfarbe.':'1,7B Base · GPU · Deck entlädt Strata regulär vor der Ausgabe. Mit Referenztranskript kann Qwen auch die Sprechweise besser übernehmen.';$('reference-text').disabled=cpu;$('reference-name').textContent=reference?reference.name:cpu?'Gespeicherte Standardstimme aus Deck':'Für 1,7B bitte eine Referenz hinzufügen';$('count').textContent=$('text').value.length+' / 1000';$('generate').disabled=busy||!!recording||!p||!$('text').value.trim()||$('text').value.length>1000||(!cpu&&!reference);$('transcribe').disabled=busy||!!recording||!source||!sttId;$('profile').disabled=busy||!!recording||!profiles.length;}
|
||||
function progress(message){$('error').hidden=true;$('empty').hidden=true;$('result').hidden=true;$('progress').hidden=false;$('status').textContent=message;}
|
||||
function done(){busy=false;$('progress').hidden=true;if($('result').hidden)$('empty').hidden=false;update();}
|
||||
async function poll(path,id){const deadline=Date.now()+1200000;while(Date.now()<deadline){await new Promise(r=>setTimeout(r,600));const d=await api(path),j=d.job;if(!j||j.id!==id)throw Error('Dieser Auftrag ist nicht mehr aktuell. Ein anderer Auftrag hat den Status ersetzt.');$('status').textContent=j.phase||'Athena arbeitet …';if(j.state==='complete')return j;if(j.state!=='running')throw Error(j.phase||'Auftrag beendet.');}throw Error('Zeitlimit überschritten. Den Auftrag in Deck prüfen.');}
|
||||
async function normalize(blob,maxSeconds,sampleRate){if(!blob||blob.size>16*1024*1024)throw Error('Bitte eine Aufnahme bis 16 MiB verwenden.');const ctx=new AudioContext({sampleRate});try{const b=await ctx.decodeAudioData(await blob.arrayBuffer());if(b.duration<1||b.duration>maxSeconds)throw Error('Die Aufnahme muss zwischen 1 und '+maxSeconds+' Sekunden lang sein.');const n=b.length,buf=new ArrayBuffer(44+n*2),v=new DataView(buf);function word(pos,s){for(let i=0;i<s.length;i++)v.setUint8(pos+i,s.charCodeAt(i));}word(0,'RIFF');v.setUint32(4,36+n*2,true);word(8,'WAVE');word(12,'fmt ');v.setUint32(16,16,true);v.setUint16(20,1,true);v.setUint16(22,1,true);v.setUint32(24,b.sampleRate,true);v.setUint32(28,b.sampleRate*2,true);v.setUint16(32,2,true);v.setUint16(34,16,true);word(36,'data');v.setUint32(40,n*2,true);const channels=Array.from({length:b.numberOfChannels},(_,i)=>b.getChannelData(i));for(let i=0;i<n;i++){const x=Math.max(-1,Math.min(1,channels.reduce((a,c)=>a+c[i],0)/channels.length));v.setInt16(44+i*2,x<0?x*32768:x*32767,true);}return new File([buf],'aufnahme.wav',{type:'audio/wav'});}finally{await ctx.close();}}
|
||||
async function setAudio(kind,blob){const audio=await normalize(blob,kind==='reference'?30:120,kind==='reference'?24000:16000);if(kind==='reference')reference=audio;else source=audio;const el=$(kind+'-preview');if(el.dataset.url)URL.revokeObjectURL(el.dataset.url);el.dataset.url=URL.createObjectURL(audio);el.src=el.dataset.url;el.hidden=false;$(kind+'-name').textContent=blob.name||'Mikrofonaufnahme';if(kind==='reference')$('reference-reset').hidden=false;update();}
|
||||
for(const kind of ['reference','source']){$(kind+'-file').onchange=async e=>{try{if(e.target.files[0])await setAudio(kind,e.target.files[0]);}catch(e){error(e);}};$(kind+'-record').onclick=async()=>{try{if(recording){if(recording.kind===kind)recording.recorder.stop();return;}if(busy)return;if(!window.isSecureContext||!navigator.mediaDevices?.getUserMedia)throw Error('Mikrofon benötigt HTTPS. Bitte das Studio über Athena Deck öffnen.');const stream=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:true,noiseSuppression:true}});const type=['audio/webm;codecs=opus','audio/mp4'].find(t=>MediaRecorder.isTypeSupported(t));const recorder=new MediaRecorder(stream,type?{mimeType:type}:{}),chunks=[];recording={kind,recorder};const label=$(kind+'-record').textContent;$(kind+'-record').textContent='■ Aufnahme stoppen';let timer;recorder.ondataavailable=e=>{if(e.data.size)chunks.push(e.data);};recorder.onerror=()=>{stream.getTracks().forEach(t=>t.stop());clearTimeout(timer);recording=null;$(kind+'-record').textContent=label;error(Error('Aufnahme fehlgeschlagen.'));update();};recorder.onstop=async()=>{clearTimeout(timer);stream.getTracks().forEach(t=>t.stop());recording=null;$(kind+'-record').textContent=label;try{await setAudio(kind,new Blob(chunks,{type:recorder.mimeType}));}catch(e){error(e);}update();};recorder.start();timer=setTimeout(()=>{if(recorder.state==='recording')recorder.stop();},(kind==='reference'?29:119)*1000);update();}catch(e){error(e);}};}
|
||||
$('reference-reset').onclick=()=>{if(busy)return;reference=null;$('reference-file').value='';$('reference-preview').hidden=true;$('reference-reset').hidden=true;update();};
|
||||
for(const [id,show] of [['text-tab',false],['audio-tab',true]])$(id).onclick=()=>{$('text-tab').setAttribute('aria-selected',String(!show));$('audio-tab').setAttribute('aria-selected',String(show));$('source-panel').hidden=!show;};
|
||||
$('profile').onchange=update;$('text').oninput=update;
|
||||
$('transcribe').onclick=async()=>{busy=true;update();progress('Aufnahme wird lokal transkribiert …');try{const f=new FormData();f.set('file',source,'aufnahme.wav');f.set('profile_id',sttId);f.set('language','de');const j=await api('stt/start',f),r=await poll('stt',j.id);$('text').value=r.text||'';if($('text').value.length>1000)throw Error('Das Transkript ist länger als 1000 Zeichen. Bitte den Text vor der Ausgabe kürzen.');}catch(e){error(e);}finally{done();}};
|
||||
async function waveform(blob){const ctx=new AudioContext();try{const b=await ctx.decodeAudioData(await blob.arrayBuffer()),a=b.getChannelData(0),canvas=$('waveform'),c=canvas.getContext('2d');c.clearRect(0,0,600,120);c.strokeStyle='#bd5433';c.lineWidth=2;for(let x=0;x<300;x++){const start=Math.floor(x*a.length/300),end=Math.floor((x+1)*a.length/300);let peak=0;for(let i=start;i<end;i++)peak=Math.max(peak,Math.abs(a[i]));c.beginPath();c.moveTo(x*2,60-peak*52);c.lineTo(x*2,60+peak*52);c.stroke();}}finally{await ctx.close();}}
|
||||
$('generate').onclick=async()=>{busy=true;update();progress('Deine Stimme wird vorbereitet …');const p=selected(),cpu=p.kind==='audio';try{const f=new FormData();f.set('profile_id',p.id);f.set('text',$('text').value);f.set('language','German');if(reference)f.set('file',reference,'reference.wav');if(cpu)f.set('speaker','default');else{f.set('device','3060');f.set('reference_text',$('reference-text').value);}const j=await api(cpu?'qwen-native/start':'voice/start',f),r=await poll(cpu?'qwen-native':'voice',j.id);const url='/api/v1/'+(cpu?'qwen-native':'voice')+'/audio?id='+encodeURIComponent(j.id);const response=await fetch(url);if(!response.ok)throw Error('Die fertige Ausgabe konnte nicht geladen werden.');const blob=await response.blob();if(outputUrl)URL.revokeObjectURL(outputUrl);outputUrl=URL.createObjectURL(blob);$('output').src=outputUrl;$('download').href=url;$('result-meta').textContent=p.name+' · '+(r.duration?Number(r.duration).toFixed(1)+' Sekunden · ':'')+'WAV';$('result').hidden=false;await waveform(blob);}catch(e){error(e);}finally{done();}};
|
||||
async function init(){try{const [d,policy]=await Promise.all([api('profiles'),api('audio-policy')]);profiles=d.profiles.filter(p=>p.runnable&&((p.kind==='audio'&&p.model?.repo==='Serveurperso/Qwen3-TTS-GGUF')||(p.kind==='voice'&&p.model?.repo==='Qwen/Qwen3-TTS-12Hz-1.7B-Base'))).sort((a,b)=>(a.kind==='audio'?-1:1)-(b.kind==='audio'?-1:1));const stts=d.profiles.filter(p=>p.kind==='stt'&&p.runnable);sttId=stts.find(p=>p.id===policy.settings.stt.profile_id)?.id||stts[0]?.id;$('profile').replaceChildren(...profiles.map(p=>new Option(p.name,p.id)));if(!profiles.length)throw Error('Kein ausführbares Qwen-Profil gefunden. Bitte in Deck einrichten.');update();}catch(e){error(e);}}
|
||||
init();
|
||||
@@ -0,0 +1,17 @@
|
||||
"""Static Qwen studio over a private Unix socket; no models, keys or user files."""
|
||||
import http.server,os,socketserver
|
||||
from pathlib import Path
|
||||
ROOT=Path(__file__).resolve().parent
|
||||
FILES={'/':('index.html','text/html; charset=utf-8'),'/app.js':('app.js','text/javascript; charset=utf-8'),'/style.css':('style.css','text/css; charset=utf-8')}
|
||||
class Handler(http.server.BaseHTTPRequestHandler):
|
||||
def log_message(self,*args):pass
|
||||
def do_GET(self):
|
||||
item=FILES.get(self.path)
|
||||
if not item:self.send_error(404);return
|
||||
body=(ROOT/item[0]).read_bytes();self.send_response(200);self.send_header('Content-Type',item[1]);self.send_header('Content-Length',str(len(body)));self.send_header('Cache-Control','no-store');self.end_headers();self.wfile.write(body)
|
||||
class Server(socketserver.ThreadingMixIn,socketserver.UnixStreamServer):daemon_threads=True
|
||||
if __name__=='__main__':
|
||||
path=Path(os.environ.get('STUDIO_SOCKET','/data/ui.sock'));path.parent.mkdir(parents=True,exist_ok=True)
|
||||
if path.is_socket():path.unlink()
|
||||
with Server(str(path),Handler) as server:
|
||||
path.chmod(0o600);server.serve_forever()
|
||||
@@ -0,0 +1,6 @@
|
||||
<!doctype html><html lang="de"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Stimmatelier · Qwen</title><link rel="stylesheet" href="style.css"><script src="app.js" defer></script></head><body>
|
||||
<header><a href="/#services" class="back">← Athena Deck</a><span class="tag">QWEN · STIMMSTUDIO</span><span class="privacy">● Lokal auf Athena</span></header>
|
||||
<main><div class="hero"><div><p class="eyebrow">DEINE WORTE. DEINE ZIELSTIMME.</p><h1>Stimmatelier<span>.</span></h1><p class="intro">Aus Text wird Stimme. Aus einer Aufnahme werden neue Worte im vertrauten Klang.</p></div><div class="soundmark" aria-hidden="true"><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i></div></div>
|
||||
<div class="layout"><section class="inputs"><article class="card"><div class="section-title"><span class="number">01</span><h2>Modell & Zielstimme</h2></div><label for="profile">Qwen-Profil</label><select id="profile" disabled><option>Profile werden geladen …</option></select><p id="model-note" class="hint"></p><div class="reference"><div class="row"><h3>Referenzstimme</h3><span class="badge">WAV · 1–30 Sekunden</span></div><p class="hint">Eine klare, ruhige Aufnahme der gewünschten Stimme. Sie bestimmt den Klang, nicht den zu sprechenden Text.</p><label class="upload" for="reference-file">Referenz-WAV auswählen<input id="reference-file" type="file" accept=".wav,audio/wav"></label><div class="mic-row"><button id="reference-record" type="button" class="secondary">● Referenz aufnehmen</button><span id="reference-name" class="hint">Gespeicherte Standardstimme aus Deck</span></div><audio id="reference-preview" controls hidden></audio><button id="reference-reset" class="text-button" type="button" hidden>Referenz entfernen</button><label for="reference-text">Transkript der Referenz <span class="muted">optional · für 1,7B</span></label><textarea id="reference-text" rows="2" placeholder="Was wird in deiner Referenzaufnahme gesagt?"></textarea></div></article>
|
||||
<article class="card"><div class="section-title"><span class="number">02</span><h2>Was soll gesprochen werden?</h2></div><div class="tabs" role="tablist" aria-label="Quelle"><button role="tab" id="text-tab" aria-selected="true">Text schreiben</button><button role="tab" id="audio-tab" aria-selected="false">Aufnahme verwenden</button></div><div id="source-panel" hidden><p class="hint">WAV hochladen oder aufnehmen. Danach den erkannten Text prüfen. Timing und Betonung der Originalaufnahme werden nicht exakt übernommen.</p><label class="upload" for="source-file">Sprach-WAV auswählen<input id="source-file" type="file" accept=".wav,audio/wav"></label><div class="mic-row"><button id="source-record" type="button" class="secondary">● Sprache aufnehmen</button><span id="source-name" class="hint">Bis 120 Sekunden</span></div><audio id="source-preview" controls hidden></audio><button id="transcribe" type="button" class="secondary" disabled>Aufnahme in Text umwandeln</button></div><label for="text">Text für die Ausgabe</label><textarea id="text" rows="7" maxlength="1000" placeholder="Schreibe hier deinen Text oder übernimm ihn aus einer Aufnahme …"></textarea><div class="row"><span class="hint">Deutsch · Ausgabe als WAV</span><span id="count" class="hint">0 / 1000</span></div><button id="generate" class="primary" disabled>Sprache erzeugen <span>↗</span></button><p id="error" role="alert" class="error" hidden></p></article></section>
|
||||
<aside><article class="card output"><div class="section-title"><span class="number">03</span><h2>Deine Ausgabe</h2></div><div id="empty"><div class="empty-icon" aria-hidden="true">◉</div><h3>Hier bekommt dein Text eine Stimme.</h3><p>Wähle ein Profil, ergänze deine Zielstimme und starte die Erzeugung.</p></div><div id="progress" hidden><span class="spinner"></span><p id="status" role="status">Wird vorbereitet …</p><small>Du kannst diese Seite geöffnet lassen. Athena verarbeitet den Auftrag lokal.</small></div><div id="result" hidden><span class="success">FERTIG ZUM ANHÖREN</span><canvas id="waveform" width="600" height="120" aria-label="Wellenform der erzeugten Sprache"></canvas><audio id="output" controls></audio><a id="download" class="download" download="stimmatelier.wav">WAV herunterladen ↓</a><p id="result-meta" class="hint"></p></div></article><p class="footnote">Referenzaufnahmen werden nur für den Auftrag an Deck übertragen und anschließend aus dessen Arbeitsdateien entfernt. Ausgaben bleiben in Deck verfügbar. Keine Cloud-Dienste, keine zusätzlichen Modellkopien.</p></aside></div></main><footer>STIMMATELIER <span>Ein Studio für deine Qwen-Stimmen.</span></footer></body></html>
|
||||
@@ -0,0 +1 @@
|
||||
:root{color-scheme:light;--bg:#f4f2ec;--ink:#252b28;--muted:#6f7770;--accent:#bd5433;--line:#dedfd5;--green:#48755c}*{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.55 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}header,main,footer{max-width:1240px;margin:auto}header{display:flex;align-items:center;gap:22px;padding:28px 36px;border-bottom:1px solid var(--line)}a{color:inherit;text-decoration:none}.back{font-size:13px;color:var(--muted)}.tag,.eyebrow,.success{font-size:10px;font-weight:750;letter-spacing:2px}.tag{border-left:1px solid var(--line);padding-left:22px}.privacy{margin-left:auto;color:var(--green);font-size:12px}.hero{display:flex;align-items:center;justify-content:space-between;padding:48px 0 38px}.eyebrow{color:var(--accent);margin:0 0 10px}h1{font:clamp(45px,6vw,75px)/1.05 Georgia,serif;letter-spacing:-3px;margin:0 0 18px}h1 span{color:var(--accent)}.intro{color:var(--muted);max-width:500px;margin:0}.soundmark{display:flex;gap:8px;align-items:center;padding:10px 40px}.soundmark i{display:block;width:7px;height:28px;background:#c5cbbd;border-radius:20px}.soundmark i:nth-child(2n){height:62px}.soundmark i:nth-child(3n){height:100px;background:#b9c4b1}.soundmark i:nth-child(5){height:125px;background:var(--accent)}main{padding:0 36px 42px}.layout{display:grid;grid-template-columns:minmax(0,1.35fr) minmax(280px,.85fr);gap:24px}.inputs{display:grid;gap:22px}.card{background:#fdfdf9;border:1px solid var(--line);border-radius:18px;padding:26px;box-shadow:0 4px 18px #222b2104}.section-title{display:flex;gap:12px;align-items:center;margin-bottom:22px}.number{border:1px solid #dedfd5;border-radius:50%;width:30px;height:30px;display:grid;place-items:center;font-size:11px;color:var(--muted)}h2{font-size:17px;font-weight:650;margin:0}h3{font-size:14px;font-weight:600;margin:0}label{display:block;font-size:12px;font-weight:600;margin:15px 0 8px}select,textarea{display:block;width:100%;background:#f7f8f2;border:1px solid #d9ddd2;border-radius:10px;padding:12px;color:var(--ink);font:inherit}textarea{resize:vertical;font-size:14px;line-height:1.6}textarea::placeholder{color:#959c93}select:focus,textarea:focus,button:focus-visible,a:focus-visible{outline:2px solid #bd543380;outline-offset:3px}.hint,.footnote,small{font-size:12px;color:var(--muted)}.reference{border-top:1px solid var(--line);margin-top:22px;padding-top:20px}.row,.mic-row{display:flex;align-items:center;justify-content:space-between;gap:12px}.badge{font-size:10px;color:var(--muted);white-space:nowrap}.muted{color:var(--muted);font-weight:400}.upload{border:1px dashed #bfc8b8;border-radius:10px;padding:14px;text-align:center;background:#f6f8f1;cursor:pointer;font-size:12px}.upload input{display:block;margin:8px auto 0;max-width:100%;font-size:11px;font-weight:400}button{cursor:pointer;border:0;font:inherit}button:disabled{opacity:.45;cursor:not-allowed}.secondary{padding:9px 12px;border:1px solid #d8ddd1;border-radius:8px;background:#f6f8f1;font-size:12px;font-weight:550}.mic-row{justify-content:flex-start;flex-wrap:wrap;margin:12px 0}.text-button{background:none;color:var(--muted);padding:4px 0;font-size:11px;text-decoration:underline}audio{width:100%;height:42px;margin:12px 0}.tabs{display:flex;gap:4px;background:#edf0e7;border-radius:10px;padding:4px;margin-bottom:20px}.tabs button{flex:1;border-radius:7px;background:transparent;padding:10px;font-size:12px}.tabs [aria-selected=true]{background:#fff;box-shadow:0 1px 5px #0001}.primary{display:flex;align-items:center;justify-content:space-between;background:var(--ink);color:#fff;border-radius:10px;padding:16px 18px;width:100%;margin-top:20px;font-weight:600;font-size:13px}.primary span{font-size:20px;color:#e1b093}.error{color:#a13e30;background:#fff0ea;padding:12px;border-radius:8px;font-size:13px}.output{position:sticky;top:22px;min-height:350px}#empty{text-align:center;padding:42px 12px 25px;color:var(--muted)}.empty-icon{font-size:44px;color:#aab99e;margin-bottom:22px}#empty h3{font-family:Georgia,serif;font-size:21px;font-weight:400;color:var(--ink)}#empty p{font-size:13px;max-width:250px;margin:14px auto}.footnote{padding:0 14px;line-height:1.7}.success{color:var(--green)}canvas{width:100%;height:100px;margin-top:25px}.download{display:block;border:1px solid #ccd6c5;background:#edf3e7;border-radius:9px;text-align:center;padding:12px;font-size:12px;font-weight:650}.spinner{display:block;width:30px;height:30px;border:2px solid #e6e8de;border-top-color:var(--accent);border-radius:50%;animation:spin 1s linear infinite;margin:45px auto 20px}#progress{text-align:center}#status{font-size:14px}footer{display:flex;justify-content:space-between;border-top:1px solid var(--line);padding:24px 36px;font-size:10px;letter-spacing:2px;color:var(--muted)}footer span{letter-spacing:0}[hidden]{display:none!important}@keyframes spin{to{transform:rotate(360deg)}}@media(max-width:750px){header{padding:20px}.tag{display:none}main{padding:0 18px 30px}.hero{padding:30Line truncated
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
window.DockerUI=(()=>{
|
||||
const esc=v=>String(v??'').replace(/[&<>"']/g,c=>({'&':'&','<':'<','>':'>','"':'"',"'":'''}[c]));
|
||||
const apps={
|
||||
'athena-stimmatelier':{title:'Stimmatelier · Qwen',description:'Text, WAV oder Mikrofonaufnahme mit eigener Qwen-Referenzstimme neu sprechen lassen.',path:'/stimmatelier/',hint:'0,6B auf CPU oder 1,7B auf GPU. Mikrofon über die HTTPS-Anmeldung von Deck.'},
|
||||
'athena-voxcpm2-web':{title:'VoxCPM2 Studio',description:'Stimme erzeugen, gestalten und klonen; Ausführung über Decks Stimmworker.',port:8129,hint:'VoxCPM2-Profil in Deck aktivieren und Stimmwerkzeuge starten.'},
|
||||
'athena-omnivoice-web':{title:'OmniVoice Studio',description:'Bisherige OmniVoice-Weboberfläche; GPU-Aufträge laufen über Deck.',port:8130,hint:'OmniVoice-Profil in Deck aktivieren und Stimmwerkzeuge starten. Beim Klonen Referenztranskript eingeben.'},
|
||||
'athena-soulx-singer-web':{title:'SoulX-Singer Gesang',description:'Reiner Gesang und Referenzstimme → Gesang in der Zielstimme, ohne Training.',port:8138,hint:'SoulX-Singer-Profil aktivieren und Stimmwerkzeuge starten.'},
|
||||
@@ -12,7 +13,7 @@ window.DockerUI=(()=>{
|
||||
'ltx-deskweb':{title:'LTX DeskWEB',description:'LTX-Webstudio für Videoerzeugung über Decks originale LTX-Laufzeit.',port:8118,hint:'Videoprofil freigeben und in der Steuerung Video starten.'},
|
||||
'athena-swarm-ui':{title:'SwarmUI',description:'API By URL · Oberfläche für Decks ComfyUI-Laufzeit.',port:8125,hint:'In der Steuerung Video mit ComfyUI starten.'}
|
||||
};
|
||||
function appInfo(c){const a=apps[c.name];return a?`<p>${esc(a.description)}</p><a class="link" href="${esc(DeckLinks.url(a.port))}" target="_blank" rel="noopener">${esc(a.title)} öffnen →</a><p class="small">${esc(a.hint)} Port ${a.port}.</p>`:'';}
|
||||
function appInfo(c){const a=apps[c.name];return a?`<p>${esc(a.description)}</p><a class="link" href="${esc(a.path||DeckLinks.url(a.port))}" target="_blank" rel="noopener">${esc(a.title)} öffnen →</a><p class="small">${esc(a.hint)} ${a.port?'Port '+a.port+'.':''}</p>`:'';}
|
||||
async function api(action='',data){const r=await fetch('/api/v1/docker'+action,data?{method:'POST',headers:{'Content-Type':'application/json','X-Athena-Deck':'1'},body:JSON.stringify(data)}:{});if(r.status===401){location.reload();throw Error('Bitte erneut anmelden.');}const value=await r.json();if(!r.ok)throw Error(value.error||'Docker-Anfrage fehlgeschlagen');return value;}
|
||||
function html(services=false){return `<div class="kicker">${services?'ANWENDUNGEN':'EINSTELLUNGEN / LAUFZEITEN'}</div><h1>${services?'Weitere Dienste':'Docker'}</h1><p>${services?'Zusätzliche Oberflächen werden getrennt von Modellen und Laufzeiten verwaltet. Hier erscheinen ausschließlich ausdrücklich für Deck markierte Anwendungscontainer.':'Optionale Umgebung für zusätzliche Studios. Native Modelllaufzeiten bleiben unabhängig davon.'}</p><section id="docker-panel"></section><p id="docker-message" role="status"></p>`;}
|
||||
function bind(services=false){const panel=document.querySelector('#docker-panel'),message=document.querySelector('#docker-message');let signature='',pending=false,timer;
|
||||
|
||||
@@ -1,5 +1,15 @@
|
||||
# Neuer Athena-Router: aktueller Dokumentationsstand
|
||||
|
||||
Am 19. Oktober 2026 zusätzlich eingerichtet: **Stimmatelier**, eigene
|
||||
Qwen-Oberfläche unter `/stimmatelier/` und **Weitere Dienste**. Text, eigene
|
||||
Referenz-WAV/Mikrofonaufnahme und Sprachaufnahme → STT → prüfbarer Text →
|
||||
Qwen-Ausgabe. 0,6B Q8 CPU und 1,7B GPU praktisch im HTTPS-Browser geprüft,
|
||||
WAV-Download erfolgreich. Mikrofonaufnahme noch durch den Nutzer abzunehmen.
|
||||
Eigener isolierter UI-Container, keine Modellkopien oder neuen API-Schlüssel.
|
||||
[Einrichtung, Grenzen, Backup und Abnahme](maintenance/2026-10-19-stimmatelier.md).
|
||||
Quellcode: [privates Stimmatelier-Repository](https://git.casaderoll.de/michael/Stimmatelier).
|
||||
|
||||
|
||||
Am 18. Oktober 2026 auf Nutzerwunsch stillgelegt: Agent Zero, beide
|
||||
Hermes-WebUI-Varianten und der gesamte LobeHub-Teststack. Der alte eigenständige
|
||||
Hermes-Agent und der laufende Webtop-Workspace bleiben erhalten.
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
# Stimmatelier, 19. Oktober 2026
|
||||
|
||||
Nutzerauftrag: eigene zusätzliche Qwen-TTS-Oberfläche als Docker-Dienst, mit
|
||||
Text, Referenzstimme, WAV-Upload und Mikrofonaufnahme; Quelle als Sprache →
|
||||
Transkript → neue Zielstimme. Kein Live-Betrieb. Neues privates Git-Repository.
|
||||
|
||||
## Aktiver Aufbau
|
||||
|
||||
- [Studio](https://athena.casaderoll.de/stimmatelier/) sowie Weitere Dienste →
|
||||
Stimmatelier. Reguläre Deck-Anmeldung, kein zweites Passwort/Token.
|
||||
- [Eigenständiger Quellcode](https://git.casaderoll.de/michael/Stimmatelier).
|
||||
Die sechs Dateien unter `deploy/stimmatelier` entsprechen diesem Repository;
|
||||
sie sind Decks mitgepflegtes Build-/Restore-Rezept.
|
||||
- Container `athena-stimmatelier`, Image `athena-stimmatelier:0.1.0`,
|
||||
`unless-stopped`, UID/GID 65534, readonly root, cap-drop ALL,
|
||||
no-new-privileges, Netzwerk `none`, keine Ports/GPU/Docker-Socket,
|
||||
128 MiB RAM ohne Swap, 0,5 CPU, 64 PIDs.
|
||||
- Einziger Mount: konfigurierter Deck-Zustand `/stimmatelier-ui` nach `/data`.
|
||||
Aktuell `/opt/athena-deck-dev/runtime/state/stimmatelier-ui`, Modus0700,
|
||||
Socket `ui.sock` Modus0600. Deck sieht ihn im selben Zustandsbereich.
|
||||
- `stimmatelier_proxy.py` liefert nach GUI-Authentifizierung nur drei feste
|
||||
statische Dateien über den Unix-Socket. Keine Zugangsdatenweitergabe.
|
||||
CSP-Ausnahme `media-src 'self' blob:` gilt nur für diesen UI-Pfad.
|
||||
- Aktives Deck-Image `athena-deck-standalone:5f655f7707988c20`; vorhandene
|
||||
Laufzeit wiederverwendet. Kein Host-/OpenWebUI-/Hermes-Neustart.
|
||||
- Keine Profil-/Endpunkt-/Stimmen-Voreinstellungen verändert. Das vom Nutzer
|
||||
zuvor freigegebene 1,7B-Voice-Profil bleibt freigegeben. Die Oberfläche wählt
|
||||
direkte Profil-IDs, keinen mehrdeutigen Modellalias.
|
||||
|
||||
## Bedienung und Grenzen
|
||||
|
||||
CPU 0,6B Q8 nutzt die bestehende native Laufzeit und optional die gespeicherte
|
||||
Standardstimme; individuelle Referenz wird nur im Auftrag verwendet, Anna wird
|
||||
nicht überschrieben. 1,7B Base verlangt Referenz und nutzt regulär den GPU-
|
||||
Scheduler (hier3060); Strata kann dafür nach laufenden Anfragen entladen werden.
|
||||
Ein freiwilliges korrektes Referenztranskript verbessert den 1,7B-Modus.
|
||||
|
||||
Deutsch, 1000 Zeichen, Referenz1–30s, Quelle1–120s, WAV bis16MiB. Browser
|
||||
konvertiert Referenz in mono PCM24kHz, STT-Quelle in PCM16kHz. Mikrofon benötigt
|
||||
HTTPS und normale Browserfreigabe; Start/Stop jeweils explizit, keine dauerhafte
|
||||
Aufnahme. Quelle wird zuerst transkribiert und kann korrigiert werden. Das ist
|
||||
keine Audio-zu-Audio-Konvertierung mit erhaltenem Timing/Betonung und kein Gesang.
|
||||
|
||||
Referenzen werden nach Abschluss/Abbruch/Fehler aus den Auftragsdateien entfernt;
|
||||
Embeddings können im Worker-RAM bleiben. STT hält Quelle/Transkript nur im RAM.
|
||||
Generierte WAVs bleiben in Decks Auftragsverzeichnissen. Der UI-Container hat
|
||||
keine Datenbank, privaten Dateien oder Schlüssel. Beim Tab-Schließen läuft ein
|
||||
begonnener Auftrag weiter; nach Neuladen zeigt das Studio keinen Auftragsverlauf.
|
||||
Geteilte Backendstatus werden bei fremder Auftrags-ID erkannt.
|
||||
|
||||
## Abnahme
|
||||
|
||||
- Echter angemeldeter HTTPS-Browser: beide Qwen-Profile sichtbar.
|
||||
- 0,6B CPU mit hochgeladener eigener synthetischer Referenz und Text: fertige
|
||||
WAV6,6s, Audioplayer und Wellenform. Keine neue LLM-Anfrage dafür.
|
||||
- Quelle hochgeladen, STT: „Gerne, hier eine Micro Story über deinen Arbeitsalltag,
|
||||
genau 50 Wörter.“ editierbar im Textfeld. Anschließend Referenz plus dieses
|
||||
Transkript im 1,7B-Modus: fertige WAV5,9s; Download tatsächlich erfolgreich.
|
||||
Dies sind Audiodauern, keine Laufzeit-Benchmarks.
|
||||
- Erste STT-Prüfung zeigte24kHz/16kHz-Abweichung; Browserkonvertierung korrigiert,
|
||||
erneuter vollständiger Ablauf erfolgreich. Kein Backendformat aufgeweicht.
|
||||
- UI-Container neu gebaut/erstellt, HTTPS danach funktionsfähig und gesund.
|
||||
- Reales Hardwaremikrofon und subjektive Qualität noch Nutzerabnahme.
|
||||
- 125 passende Backendtests (Qwen, Pocket, Policy, Proxy, Auth, Backup, Endpoint)
|
||||
erfolgreich, danach drei gezielte Auth/Restore/Proxy-Tests ebenfalls bestanden.
|
||||
JS-Syntaxprüfung bestanden. Reguläre Auth/CSRF bleibt auch für Uploads erhalten.
|
||||
|
||||
## Installation, Update und Wiederherstellung
|
||||
|
||||
Vollständige Docker-Build-/Run-Anleitung und native systemd-Alternative in
|
||||
[`deploy/stimmatelier/README.md`](../../deploy/stimmatelier/README.md). Pinned
|
||||
Python3.12-Basisimage; UI hat keine Python-Drittanbieterabhängigkeiten. Nativer
|
||||
Betrieb benötigt denselben expliziten Deck-Dienstbenutzer und Zustandspfad.
|
||||
Das Rezept ist kein fertiger nativer Gesamtinstaller und wurde nicht auf einem
|
||||
frischen nativen Debian abgenommen.
|
||||
|
||||
`deploy/install.py` liefert Proxy und UI-Rezept; `setup_docker_helper.py` liefert
|
||||
das Rezept an den Helfer; `docker_backup.py` exportiert/prüft/reproduziert genau
|
||||
diesen Container, einschließlich Netzwerk-none/readonly und engem Socket-Mount.
|
||||
Realer Export und Validierung dieses einen Containers bestanden. Wiederherstellung
|
||||
auf frischem Host wurde nicht durchgeführt. UI-only-Updates brauchen keinen
|
||||
Deck-/Modellneustart: Image neu bauen, nur UI-Container neu erstellen.
|
||||
|
||||
Vorupdatesnapshots lassen transienten Socket sowie rekonstruierbare native Qwen-
|
||||
Laufzeit und separat gesicherte native Qwen-Aufträge aus. Der erste Updateversuch
|
||||
scheiterte am Socketkopieren **vor** dem Stoppen von Deck; danach Exklusion
|
||||
korrigiert und reguläres Update erfolgreich. `scheduled_backup.py` nimmt
|
||||
`qwen-native-jobs` jetzt zusätzlich in verschlüsselte Nutzdatensicherung auf;
|
||||
Timer/Zeitplan unverändert. Modelle, private Stimmen und Ausgaben werden nicht
|
||||
in Git gespeichert. Vollständiger verschlüsselter Backup-Lauf nicht neu ausgelöst.
|
||||
|
||||
Abschluss: `active_requests=0`, danach `flash-next-strata-iq3` über bestehenden
|
||||
API-Endpunkt mit minimaler synthetischer Anfrage regulär wieder geladen;
|
||||
erfolgreiche Antwort nach30,9s. Keine Service-Zugangsdaten ausgegeben.
|
||||
CPU-Testauftrag `complete`, dessen temporäre Referenz entfernt; auch GPU-
|
||||
Testreferenz nach Abschluss entfernt. Deck und Studio `healthy`.
|
||||
Das eigenständige UI-Repository steht für diesen Stand auf `2196855`.
|
||||
@@ -58,16 +58,20 @@ class Pocket(TTSTests):
|
||||
finally:
|
||||
with self.lock:self.warming=False
|
||||
self.gate.release()
|
||||
def start(self,profile_id,text,speaker='default',language='German',wait=False,speed=None,streaming=False):
|
||||
def prepare_reference(self,audio):raise ValueError('Dieses Profil unterstützt keine eigene Referenz.')
|
||||
def start(self,profile_id,text,speaker='default',language='German',wait=False,speed=None,streaming=False,reference=None):
|
||||
if not isinstance(text,str) or not 1<=len(text.strip())<=1000:raise ValueError('Text mit 1–1000 Zeichen erforderlich.')
|
||||
if language not in ('German','german','de',''):raise ValueError('Dieses Pocket-Profil unterstützt Deutsch.')
|
||||
if speed is not None and (type(speed) not in (int,float) or speed!=1):raise ValueError('Pocket unterstützt hier speed=1. Geschwindigkeit im Client einstellen.')
|
||||
if type(streaming) is not bool:raise ValueError('Ungültiger Streaming-Modus.')
|
||||
voice=self.voice_path(speaker);p=self._profile(profile_id)
|
||||
reference=self.prepare_reference(reference) if reference is not None else None
|
||||
voice=self.voice_path(speaker) if reference is None else None;p=self._profile(profile_id)
|
||||
if not self.gate.acquire(timeout=300 if wait else 0):raise ValueError('Pocket ist beschäftigt. Anfrage erneut versuchen.')
|
||||
try:
|
||||
ident=uuid.uuid4().hex;self.root.mkdir(parents=True,exist_ok=True,mode=0o700)
|
||||
directory=self.root/ident;directory.mkdir(mode=0o700)
|
||||
if reference is not None:
|
||||
voice=directory/'reference.wav';voice.write_bytes(reference)
|
||||
with self.lock:self.cancel.clear();self.job=dict(id=ident,state='running',phase=self.name+' · CPU',profile_id=profile_id,started_at=time.time())
|
||||
threading.Thread(target=self._run_cpu,args=(p,ident,text,voice,streaming),daemon=True).start()
|
||||
return dict(self.job)
|
||||
@@ -107,4 +111,5 @@ class Pocket(TTSTests):
|
||||
for f in directory.glob('chunk-*.pcm'):f.unlink(missing_ok=True)
|
||||
with self.lock:
|
||||
self.job.update(state=state,phase=phase,finished_at=time.time());(directory/'job.json').write_text(json.dumps(self.job))
|
||||
if voice==directory/'reference.wav':voice.unlink(missing_ok=True)
|
||||
self.gate.release()
|
||||
@@ -11,6 +11,16 @@ class QwenNative(Pocket):
|
||||
with self.lock:
|
||||
if self.job and self.job['id']==ident and self.job.get('state')=='running':
|
||||
self.cancel.set();(self.root/ident/'cancel').touch()
|
||||
def prepare_reference(self,audio):
|
||||
import io,wave
|
||||
if not isinstance(audio,bytes) or not 0<len(audio)<=16*1024**2 or audio[:4] not in (b'RIFF',b'RF64') or audio[8:12]!=b'WAVE':raise ValueError('Referenz als WAV bis 16 MiB hochladen.')
|
||||
try:
|
||||
r=subprocess.run(['ffmpeg','-nostdin','-v','error','-protocol_whitelist','pipe','-i','pipe:0','-t','31','-ac','1','-ar','24000','-f','s16le','pipe:1'],input=audio,capture_output=True,timeout=30)
|
||||
except (OSError,subprocess.TimeoutExpired):raise ValueError('Referenz konnte nicht vorbereitet werden.') from None
|
||||
if r.returncode or not 48000<=len(r.stdout)<=30*48000:raise ValueError('Referenz muss eine lesbare WAV mit 1–30 Sekunden sein.')
|
||||
out=io.BytesIO()
|
||||
with wave.open(out,'wb') as w:w.setnchannels(1);w.setsampwidth(2);w.setframerate(24000);w.writeframes(r.stdout)
|
||||
return out.getvalue()
|
||||
def voice_path(self,name):
|
||||
folder=self.root.parent/'speech-voices'
|
||||
if name=='default':
|
||||
|
||||
@@ -311,7 +311,9 @@ class Handler(BaseHTTPRequestHandler):
|
||||
self.send_header('Content-Length', str(len(body)))
|
||||
self.send_header('Cache-Control', 'no-store')
|
||||
self.send_header('X-Content-Type-Options', 'nosniff')
|
||||
self.send_header('Content-Security-Policy', "default-src 'self'; script-src 'self'; style-src 'self'; frame-ancestors 'none'")
|
||||
policy="default-src 'self'; script-src 'self'; style-src 'self'; frame-ancestors 'none'"
|
||||
if self.path.startswith('/stimmatelier/'):policy+="; media-src 'self' blob:"
|
||||
self.send_header('Content-Security-Policy',policy)
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
@@ -469,6 +471,12 @@ class Handler(BaseHTTPRequestHandler):
|
||||
return self.respond({'error':'Anmeldung erforderlich.'},401)
|
||||
if not self.authenticated() and self.path == '/':
|
||||
return self.respond((ROOT/'login.html').read_bytes(), mime='text/html; charset=utf-8')
|
||||
if self.path.startswith('/stimmatelier/'):
|
||||
try:
|
||||
from stimmatelier_proxy import asset
|
||||
body,mime=asset(self.path,self.server.catalog.root.parent)
|
||||
return self.respond(body,mime=mime)
|
||||
except (OSError,ValueError):return self.respond({'error':'Stimmatelier nicht erreichbar. Den Dienst unter Weitere Dienste starten.'},503)
|
||||
routes = {'/strata-ui.js':('strata-ui.js','text/javascript'),'/soulx-singer-ui.js':('soulx-singer-ui.js','text/javascript'),'/xvc-ui.js':('xvc-ui.js','text/javascript'),'/applio-ui.js':('applio-ui.js','text/javascript'),'/acestep-ui.js':('acestep-ui.js','text/javascript'),'/voice-ui.js':('voice-ui.js','text/javascript'),'/voxcpm-ui.js':('voxcpm-ui.js','text/javascript'),'/separator-ui.js':('separator-ui.js','text/javascript'),'/music-ui.js':('music-ui.js','text/javascript'),'/audio-cpp-ui.js':('audio-cpp-ui.js','text/javascript'),'/ltx-original-ui.js':('ltx-original-ui.js','text/javascript'),'/backup-ui.js':('backup-ui.js','text/javascript'),'/dashboard-ui.js':('dashboard-ui.js','text/javascript'),'/dashboard.css':('dashboard.css','text/css'),'/themes.css':('themes.css','text/css'),'/video-ui.js':('video-ui.js','text/javascript'),'/stt-ui.js':('stt-ui.js','text/javascript'),'/tts-ui.js':('tts-ui.js','text/javascript'),'/auto-test-ui.js':('auto-test-ui.js','text/javascript'),'/chat-test-ui.js':('chat-test-ui.js','text/javascript'),'/endpoint-ui.js':('endpoint-ui.js','text/javascript'),'/docker-ui.js': ('docker-ui.js','text/javascript'), '/': ('index.html', 'text/html; charset=utf-8'), '/app.js': ('app.js', 'text/javascript'), '/style.css': ('style.css', 'text/css'), '/network-ui.js': ('network-ui.js', 'text/javascript'), '/access-ui.js': ('access-ui.js', 'text/javascript'), '/studio.js': ('studio.js', 'text/javascript'), '/catalog-ui.js': ('catalog-ui.js','text/javascript'), '/runtime-ui.js': ('runtime-ui.js','text/javascript'), '/profiles-ui.js': ('profiles-ui.js','text/javascript'), '/image-test-ui.js': ('image-test-ui.js','text/javascript')}
|
||||
if self.path in routes:
|
||||
name, mime = routes[self.path]
|
||||
@@ -879,6 +887,10 @@ class Handler(BaseHTTPRequestHandler):
|
||||
except (ValueError,OSError) as exc:return self.respond({'error':str(exc)},400)
|
||||
if self.path in ('/api/v1/qwen-native/install','/api/v1/qwen-native/install-cancel','/api/v1/qwen-native/start','/api/v1/qwen-native/cancel'):
|
||||
try:
|
||||
if self.path.endswith('/start') and self.headers.get('Content-Type','').startswith('multipart/form-data'):
|
||||
fields,audio=read_upload(self,validate=False,allowed_fields=('profile_id','text','speaker','language'),max_field=4096,max_audio=16*1024**2)
|
||||
if not {'profile_id','text'}<=set(fields):raise ValueError('Profil und Text erforderlich.')
|
||||
return self.respond(self.server.qwen_native.start(**fields,reference=audio))
|
||||
data=self.read_json()
|
||||
if self.path.endswith('/install') and not data:return self.respond(self.server.qwen_native_runtime.start())
|
||||
if self.path.endswith('/install-cancel') and not data:return self.respond(self.server.qwen_native_runtime.stop())
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
"""Fixed static-asset proxy to the isolated studio container, never forwards credentials."""
|
||||
import http.client,socket
|
||||
ASSETS={'/stimmatelier/':('/','text/html; charset=utf-8'),'/stimmatelier/app.js':('/app.js','text/javascript; charset=utf-8'),'/stimmatelier/style.css':('/style.css','text/css; charset=utf-8')}
|
||||
def asset(path,root):
|
||||
if path not in ASSETS:raise ValueError('Unbekannte Studio-Datei.')
|
||||
target,mime=ASSETS[path];conn=http.client.HTTPConnection('localhost',timeout=5)
|
||||
conn.sock=socket.socket(socket.AF_UNIX,socket.SOCK_STREAM);conn.sock.settimeout(5)
|
||||
try:
|
||||
conn.sock.connect(str(root/'stimmatelier-ui/ui.sock'));conn.request('GET',target)
|
||||
r=conn.getresponse();body=r.read(262145)
|
||||
if r.status!=200 or len(body)>262144:raise ValueError('Stimmatelier-Datei nicht verfügbar.')
|
||||
return body,mime
|
||||
finally:conn.close()
|
||||
@@ -97,6 +97,21 @@ class AccessAPITests(unittest.TestCase):
|
||||
code,_,headers=self.request('/api/v1/login',{'password':password})
|
||||
self.assertEqual(code,200)
|
||||
return headers['Set-Cookie'].split(';')[0]
|
||||
def test_stimmatelier_requires_session_and_upload_keeps_csrf_checks(self):
|
||||
self.assertEqual(self.request('/stimmatelier/')[0],401)
|
||||
cookie=self.setup_login()
|
||||
self.assertEqual(self.request('/stimmatelier/',token=self.token)[0],401)
|
||||
with patch('stimmatelier_proxy.asset',return_value=({'studio':True},'application/json')):
|
||||
self.assertEqual(self.request('/stimmatelier/',cookie=cookie)[0],200)
|
||||
body=b'--test-boundary\r\nContent-Disposition: form-data; name="profile_id"\r\n\r\nnative\r\n--test-boundary\r\nContent-Disposition: form-data; name="text"\r\n\r\nEin Test\r\n--test-boundary\r\nContent-Disposition: form-data; name="file"; filename="reference.wav"\r\nContent-Type: audio/wav\r\n\r\nreference-bytes\r\n--test-boundary--\r\n'
|
||||
headers={'Content-Type':'multipart/form-data; boundary=test-boundary','Cookie':cookie,'X-Athena-Deck':'1'}
|
||||
with patch.object(self.server.qwen_native,'start',return_value={'id':'test'}) as start:
|
||||
req=urllib.request.Request(self.base+'/api/v1/qwen-native/start',data=body,headers=headers)
|
||||
with urllib.request.urlopen(req) as r:self.assertEqual(r.status,200)
|
||||
self.assertEqual(start.call_args.kwargs['reference'],b'reference-bytes')
|
||||
headers['Origin']='https://foreign.example'
|
||||
with self.assertRaises(urllib.error.HTTPError) as error:urllib.request.urlopen(urllib.request.Request(req.full_url,data=body,headers=headers))
|
||||
self.assertEqual(error.exception.code,403);self.assertEqual(start.call_count,1)
|
||||
def test_prompt_enhancer_management_requires_login_and_validates_actions(self):
|
||||
self.assertEqual(self.request('/api/v1/prompt-enhancers')[0],401)
|
||||
cookie=self.setup_login()
|
||||
|
||||
@@ -335,6 +335,16 @@ class ContainerTests(unittest.TestCase):
|
||||
for change in (lambda x:x.update(name='other-ui'),lambda x:x['mounts'][0].update(deck_path='models'),lambda x:x['mounts'][0].update(deck_path='video/original-work'),lambda x:x['mounts'][0].update(target='/data/outputs')):
|
||||
bad=copy.deepcopy(c);change(bad)
|
||||
with self.assertRaises(ValueError):validate_container(bad)
|
||||
def test_stimmatelier_restore_recreates_isolated_socket_directory(self):
|
||||
c=self.config();c.update(name='athena-stimmatelier',image='athena-stimmatelier:0.1.0',registry=None,network='none',ports={},build_recipe='stimmatelier',running=False,mounts=[dict(index=0,target='/data',deck_path='stimmatelier-ui',read_only=False,was_file=False,files={})])
|
||||
validate_container(c)
|
||||
bad=copy.deepcopy(c);bad['mounts'][0]['deck_path']='speech-voices'
|
||||
with self.assertRaises(ValueError):validate_container(bad)
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
root=Path(d);(root/'backup-policy.json').write_text(json.dumps({'deck_state':d}));calls=[]
|
||||
with patch('deploy.docker_backup.subprocess.run',return_value=Mock(returncode=1)),patch('deploy.docker_backup.command',side_effect=lambda args,*extra,**kw:calls.append(args) or ''),patch('deploy.docker_backup.Path.stat',return_value=Mock(st_uid=0,st_mode=0o100600)),patch('deploy.docker_backup.os.chown'):
|
||||
result=restore_container(Mock(state=root),c)
|
||||
self.assertEqual(result['state'],'complete');create=next(x for x in calls if x[0]=='create');self.assertIn('--read-only',create);self.assertEqual(create[create.index('--network')+1],'none');self.assertTrue((root/'stimmatelier-ui').is_dir())
|
||||
def test_ladypoly_recipe_and_config_are_scoped(self):
|
||||
c=self.config();c.update(name='athena-ladypoly',image='athena-ladypoly:3960afc-deck1',registry=None,network='host',build_recipe='ladypoly',mounts=[dict(index=0,target='/data',deck_path=None,read_only=False,was_file=False,files={'deck-connection.json':'e30='})]);validate_container(c)
|
||||
for change in (lambda x:x.update(name='other-ui'),lambda x:x.update(image='untrusted:1'),lambda x:x['mounts'][0].update(target='/other')):
|
||||
|
||||
@@ -41,6 +41,22 @@ class NativeQwenTests(unittest.TestCase):
|
||||
APIHandler.speech(h,ep,dict(model='tts',input='Ein synthetischer Satz.',response_format=fmt))
|
||||
ep.qwen_native.start.assert_called_once();pocket.start.assert_not_called();ep.tts.start.assert_not_called()
|
||||
self.assertEqual(ep.qwen_native.start.call_args.kwargs['streaming'],fmt=='pcm')
|
||||
def test_uploaded_reference_is_job_local_deleted_and_does_not_change_default(self):
|
||||
with tempfile.TemporaryDirectory() as d,patch('pocket.threading.Thread.start'):
|
||||
worker=QwenNative(Path(d)/'jobs',Mock(),Mock());worker.prepare_reference=Mock(return_value=b'reference-wave')
|
||||
worker.voice_path=Mock(side_effect=AssertionError('default voice must not be overwritten'));worker._profile=Mock(return_value={'id':'native'})
|
||||
job=worker.start('native','Ein Test.',reference=b'upload');root=worker.root/job['id']
|
||||
self.assertEqual((root/'reference.wav').read_bytes(),b'reference-wave')
|
||||
process=Mock();process.poll.return_value=None;worker._ensure_cpu=Mock(return_value=process)
|
||||
(root/'result.json').write_text(json.dumps(dict(ok=True,duration=1,sample_rate=24000,seconds=.9,first_chunk_seconds=.2)));(root/'result.wav').write_bytes(b'RIFF-audio')
|
||||
worker._run_cpu({'id':'native'},job['id'],'Ein Test.',root/'reference.wav',False)
|
||||
self.assertEqual(worker.job['state'],'complete');self.assertFalse((root/'reference.wav').exists());worker.voice_path.assert_not_called()
|
||||
def test_reference_rejects_invalid_and_overlong_audio(self):
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
worker=QwenNative(Path(d),Mock(),Mock())
|
||||
with self.assertRaises(ValueError):worker.prepare_reference(b'not-wave')
|
||||
with patch('qwen_native.subprocess.run',return_value=Mock(returncode=0,stdout=b'0'*(31*48000))):
|
||||
with self.assertRaisesRegex(ValueError,'1–30'):worker.prepare_reference(b'RIFF0000WAVE0000')
|
||||
def test_cancelled_native_job_keeps_healthy_worker_and_releases_gate(self):
|
||||
for policy,ok,expected_unload in (('warm',True,False),('auto',True,False),('per_request',True,True),('warm',False,True)):
|
||||
with self.subTest(policy=policy,ok=ok),tempfile.TemporaryDirectory() as d:
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import importlib.util,tempfile,threading,unittest
|
||||
from pathlib import Path
|
||||
from stimmatelier_proxy import asset
|
||||
class StudioProxyTests(unittest.TestCase):
|
||||
def test_unix_proxy_serves_only_fixed_assets_without_network_or_credentials(self):
|
||||
spec=importlib.util.spec_from_file_location('studio_app',Path(__file__).parent/'deploy/stimmatelier/app.py');module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module)
|
||||
with tempfile.TemporaryDirectory(prefix='studio-',dir='/tmp') as d:
|
||||
root=Path(d);folder=root/'stimmatelier-ui';folder.mkdir()
|
||||
server=module.Server(str(folder/'ui.sock'),module.Handler);thread=threading.Thread(target=server.serve_forever);thread.start()
|
||||
try:
|
||||
data,mime=asset('/stimmatelier/',root);self.assertIn(b'Stimmatelier',data);self.assertIn('text/html',mime)
|
||||
with self.assertRaises(ValueError):asset('/stimmatelier/../../auth.json',root)
|
||||
finally:server.shutdown();server.server_close();thread.join()
|
||||
Reference in new issue
Block a user