feat: Sprachausgabe über das Gateway (POST /v1/audio/speech, Adapter tts für das Qwen3-TTS Studio) (#1060)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GmHhg3Td16J38kAyDLzb39
This commit is contained in:
2026-11-17 19:44:56 +01:00
parent bdca8e0054
commit 9dd8037b64
17 changed files with 493 additions and 12 deletions

View File

@ -3,7 +3,7 @@
use std::path::PathBuf;
use std::process::ExitCode;
use nexus_adapter::{Engine, LlamaCppEngine, MayaEngine, OllamaEngine};
use nexus_adapter::{Engine, LlamaCppEngine, MayaEngine, OllamaEngine, StudioEngine};
use nexus_core::Priority;
use nexus_store::{NewLlm, Rights};
@ -281,6 +281,7 @@ fn model_add(args: &[String]) -> Result<(), String> {
"tag",
"maya-config",
"strata-config",
"tts-model",
"gpus",
"context",
"vram-mb",
@ -321,9 +322,12 @@ fn model_add(args: &[String]) -> Result<(), String> {
}
(path, None)
}
// Sprachausgabe: der Modellname im laufenden Studio (zum Beispiel
// `Qwen/Qwen3-TTS-12Hz-1.7B-Base`); das Studio lädt ihn selbst.
"tts" => (PathBuf::from(flags.require("tts-model")?), None),
other => {
return Err(format!(
"Unbekannte Engine \"{other}\" (llama.cpp, ollama, maya oder strata)."
"Unbekannte Engine \"{other}\" (llama.cpp, ollama, maya, strata oder tts)."
));
}
};
@ -517,9 +521,14 @@ async fn model_discover(args: &[String]) -> Result<(), String> {
.discover()
.await
}
"tts" => {
StudioEngine::new(crate::serve::tts_config(&config)?)
.discover()
.await
}
other => {
return Err(format!(
"Unbekannte Engine \"{other}\" (llama.cpp, ollama, maya oder strata)."
"Unbekannte Engine \"{other}\" (llama.cpp, ollama, maya, strata oder tts)."
));
}
}
@ -544,6 +553,8 @@ async fn model_discover(args: &[String]) -> Result<(), String> {
"--engine maya --maya-config <pfad>"
} else if engine == "strata" {
"--engine strata --strata-config <pfad>"
} else if engine == "tts" {
"--engine tts --tts-model <Modellname im Studio>"
} else {
"--path <pfad>"
}

View File

@ -28,8 +28,9 @@ Aufruf:
nexus model add --name N --engine ollama --tag MODELLNAME [--gpus 0] [--disabled]
nexus model add --name N --engine maya --maya-config PFAD.json [--gpus 0,1] [--disabled]
nexus model add --name N --engine strata --strata-config PFAD.json [--gpus 0,1] [--disabled]
nexus model add --name N --engine tts --tts-model QWEN-MODELL [--gpus 0] [--vram-mb N] [--disabled] (Sprachausgabe, laufendes Studio)
nexus model set --name N [--vram-mb N] [--idle-min MINUTEN (0 = nie) | --idle-default]
nexus model list | enable --name N | disable --name N | remove --name N (nur gesperrte Modelle) | discover [--engine llama.cpp|ollama|maya|strata]
nexus model list | enable --name N | disable --name N | remove --name N (nur gesperrte Modelle) | discover [--engine llama.cpp|ollama|maya|strata|tts]
nexus diag [--out DATEI.tar.gz] [--ohne-engine-logs] Diagnose-Archiv ohne Prompts und Keys
nexus backup [--out DATEI.db] Kopie der Datenbank (ohne sie zu migrieren; auch bei laufendem Gateway)
nexus help Diese Hilfe

View File

@ -8,6 +8,7 @@ use std::time::Duration;
use nexus_adapter::{
Engine, LlamaCppConfig, LlamaCppEngine, MayaConfig, MayaEngine, OllamaConfig, OllamaEngine,
StudioConfig, StudioEngine,
};
use nexus_api::{AppState, Runtime, RuntimeOptions, SchedulerSettings};
use nexus_core::Config;
@ -30,6 +31,15 @@ pub fn llama_config(config: &Config) -> Result<LlamaCppConfig, String> {
.map_err(|e| format!("Konfiguration [llama_cpp]: {e}"))
}
/// Liest den Abschnitt `[tts]` (Sprachausgabe, Faster Qwen3-TTS Studio).
pub fn tts_config(config: &Config) -> Result<StudioConfig, String> {
config
.tts
.clone()
.try_into::<StudioConfig>()
.map_err(|e| format!("Konfiguration [tts]: {e}"))
}
/// Liest den Abschnitt `[ollama]`; ohne eigenen `log_dir` landen die Logs im
/// Datenverzeichnis.
pub fn ollama_config(config: &Config) -> Result<OllamaConfig, String> {
@ -148,6 +158,10 @@ async fn run(args: &[String]) -> Result<(), String> {
"strata".to_string(),
Arc::new(MayaEngine::strata(strata_config(&config)?)),
);
engines.insert(
"tts".to_string(),
Arc::new(StudioEngine::new(tts_config(&config)?)),
);
let state = AppState::new(
store,
Runtime::with_options(engines, runtime_options(&config)),