Add and activate pinned native Qwen Q8 CPU TTS integration

This commit is contained in:
Mikei386 committed 2026-10-19 11:48:19 +02:00
1 parent bfd21c8548
commit 562c01ef37
19 files changed
+486 -42

No files matched your search

+14 -1
View File
@@ -163,6 +163,7 @@ class Endpoint:
subset=[p for p in rows if p['kind']==kind]
counts[key]=dict(enabled=sum(p['enabled'] for p in subset),available=sum(p['enabled'] and p['runnable'] for p in subset),loaded=bool(worker['state']=='ready' and kind=='chat') if kind=='chat' else bool(self.tts and self.tts.status().get('loaded')) if kind=='audio' else bool(self.stt and self.stt.status().get('loaded')) if kind=='stt' else bool(self.music and self.music.status().get('loaded')) if kind=='music' else bool(self.voxcpm and self.voxcpm.status().get('loaded')) if kind=='voice' else bool(kind=='image' and job and job['state']=='running'),supported=kind in ('chat','image') or (kind=='audio' and self.tts is not None) or (kind=='stt' and self.stt is not None) or (kind=='music' and self.music is not None) or (kind=='voice' and self.voxcpm is not None))
if getattr(self,'pocket',None):counts['tts']['loaded']=counts['tts']['loaded'] or self.pocket.status()['loaded']
if getattr(self,'qwen_native',None):counts['tts']['loaded']=counts['tts']['loaded'] or self.qwen_native.status()['loaded']
scheduler_status=self.scheduler.status()
# Video status can call back into endpoint.rows(); never hold our lock
# while acquiring another service's lock. Concurrent GUI requests otherwise deadlock.
@@ -219,6 +220,9 @@ class Endpoint:
if not data['enabled'] and row['kind']=='audio' and getattr(self,'pocket',None):
status=self.pocket.status()
if status.get('profile_id')==row['id'] and (status.get('job') or {}).get('state')!='running':self.pocket.stop()
if not data['enabled'] and row['kind']=='audio' and getattr(self,'qwen_native',None):
status=self.qwen_native.status()
if status.get('profile_id')==row['id'] and (status.get('job') or {}).get('state')!='running':self.qwen_native.stop()
if not data['enabled'] and row['kind']=='stt' and self.stt:
job=self.stt.status().get('job') or {}
if job.get('profile_id')==row['id'] and job.get('state')!='running':self.stt.stop()
@@ -259,6 +263,7 @@ class Endpoint:
if self.music:self.music.stop()
if self.tts:self.tts.stop()
if getattr(self,'pocket',None):self.pocket.stop()
if getattr(self,'qwen_native',None):self.qwen_native.stop()
if self.embeddings:self.embeddings.stop()
if self.voxcpm:self.voxcpm.stop()
if self.stt:self.stt.stop()
@@ -483,8 +488,16 @@ class APIHandler(BaseHTTPRequestHandler):
from profiles import voice_recipe
voice=next((p for p in ep.rows() if p.get('model') and voice_recipe(p['model']) and data.get('model') in [p.get('api_id',p['name']),p['name'],*p.get('api_aliases',[])] and p['enabled']),None)
from pocket_runtime import supported as pocket_model
from qwen_native_runtime import supported as native_model
native_row=next((p for p in ep.rows() if native_model(p.get('model')) and data.get('model') in [p.get('api_id',p['name']),p['name'],*p.get('api_aliases',[])] and p['enabled']),None)
pocket_row=next((p for p in ep.rows() if pocket_model(p.get('model')) and data.get('model') in [p.get('api_id',p['name']),p['name'],*p.get('api_aliases',[])] and p['enabled']),None)
if pocket_row:
if native_row:
profile=ep.find_profile(data.get('model'),'audio');backend=getattr(ep,'qwen_native',None)
if not backend:raise APIError('Native Qwen-CPU-Laufzeit nicht eingerichtet.',503,'qwen_native_unavailable')
profile_seconds=time.monotonic()-started
try:job=backend.start(profile['id'],data.get('input'),speaker=data.get('voice','default'),language=data.get('language','German'),speed=data.get('speed'),wait=True,streaming=streaming)
except ValueError as exc:raise APIError(str(exc)) from None
elif pocket_row:
profile=ep.find_profile(data.get('model'),'audio');backend=getattr(ep,'pocket',None)
if not backend:raise APIError('Pocket-CPU-Laufzeit nicht eingerichtet.',503,'pocket_unavailable')
profile_seconds=time.monotonic()-started