fix: XTTS voices list + upload use fresh RVS connection with response wait
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+30
-4
@@ -560,6 +560,31 @@ function connectRVS(forcePlain) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function sendToRVS_withResponse(sendType, sendPayload, expectType, clientWs) {
|
||||||
|
if (!RVS_HOST || !RVS_TOKEN) return;
|
||||||
|
const proto = RVS_TLS === "true" ? "wss" : "ws";
|
||||||
|
const url = `${proto}://${RVS_HOST}:${RVS_PORT}?token=${RVS_TOKEN}`;
|
||||||
|
const freshWs = new WebSocket(url);
|
||||||
|
const timeout = setTimeout(() => {
|
||||||
|
try { freshWs.close(); } catch (_) {}
|
||||||
|
clientWs.send(JSON.stringify({ type: expectType, payload: { voices: [], error: "Timeout" }, timestamp: Date.now() }));
|
||||||
|
}, 15000);
|
||||||
|
freshWs.on("open", () => {
|
||||||
|
freshWs.send(JSON.stringify({ type: sendType, payload: sendPayload, timestamp: Date.now() }));
|
||||||
|
});
|
||||||
|
freshWs.on("message", (raw) => {
|
||||||
|
try {
|
||||||
|
const resp = JSON.parse(raw.toString());
|
||||||
|
if (resp.type === expectType) {
|
||||||
|
clearTimeout(timeout);
|
||||||
|
clientWs.send(JSON.stringify(resp));
|
||||||
|
setTimeout(() => { try { freshWs.close(); } catch (_) {} }, 1000);
|
||||||
|
}
|
||||||
|
} catch {}
|
||||||
|
});
|
||||||
|
freshWs.on("error", () => {});
|
||||||
|
}
|
||||||
|
|
||||||
function sendToRVS_raw(msgObj) {
|
function sendToRVS_raw(msgObj) {
|
||||||
if (!RVS_HOST || !RVS_TOKEN) return;
|
if (!RVS_HOST || !RVS_TOKEN) return;
|
||||||
const proto = RVS_TLS === "true" ? "wss" : "ws";
|
const proto = RVS_TLS === "true" ? "wss" : "ws";
|
||||||
@@ -1166,11 +1191,12 @@ wss.on("connection", (ws) => {
|
|||||||
broadcast({ type: "agent_activity", activity: "idle" });
|
broadcast({ type: "agent_activity", activity: "idle" });
|
||||||
dockerExec("aria-core", "openclaw doctor --fix 2>/dev/null || true").catch(() => {});
|
dockerExec("aria-core", "openclaw doctor --fix 2>/dev/null || true").catch(() => {});
|
||||||
} else if (msg.action === "voice_upload") {
|
} else if (msg.action === "voice_upload") {
|
||||||
// Voice-Samples an XTTS-Bridge via RVS weiterleiten
|
// Voice-Samples an XTTS-Bridge via RVS weiterleiten, auf Bestätigung warten
|
||||||
sendToRVS_raw({ type: "voice_upload", payload: { name: msg.name, samples: msg.samples }, timestamp: Date.now() });
|
log("info", "server", `Voice-Upload '${msg.name}' (${(msg.samples || []).length} Samples) sende an RVS...`);
|
||||||
log("info", "server", `Voice-Upload '${msg.name}' (${(msg.samples || []).length} Samples) an RVS gesendet`);
|
sendToRVS_withResponse("voice_upload", { name: msg.name, samples: msg.samples }, "xtts_voice_saved", ws);
|
||||||
} else if (msg.action === "xtts_list_voices") {
|
} else if (msg.action === "xtts_list_voices") {
|
||||||
sendToRVS_raw({ type: "xtts_list_voices", payload: {}, timestamp: Date.now() });
|
// Frische Verbindung die auf Antwort wartet
|
||||||
|
sendToRVS_withResponse("xtts_list_voices", {}, "xtts_voices_list", ws);
|
||||||
} else if (msg.action === "get_voice_config") {
|
} else if (msg.action === "get_voice_config") {
|
||||||
handleGetVoiceConfig(ws);
|
handleGetVoiceConfig(ws);
|
||||||
} else if (msg.action === "send_voice_config") {
|
} else if (msg.action === "send_voice_config") {
|
||||||
|
|||||||
Reference in New Issue
Block a user