refactor: dedupe channel and gateway surfaces

This commit is contained in:
Peter Steinberger
2026-03-02 19:48:12 +00:00
parent 9617ac9dd5
commit 9d30159fcd
44 changed files with 1072 additions and 1479 deletions

View File

@@ -532,6 +532,13 @@ function formatTtsProviderError(provider: TtsProvider, err: unknown): string {
return `${provider}: ${error.message}`;
}
function buildTtsFailureResult(errors: string[]): { success: false; error: string } {
return {
success: false,
error: `TTS conversion failed: ${errors.join("; ") || "no providers available"}`,
};
}
export async function textToSpeech(params: {
text: string;
cfg: OpenClawConfig;
@@ -696,10 +703,7 @@ export async function textToSpeech(params: {
}
}
return {
success: false,
error: `TTS conversion failed: ${errors.join("; ") || "no providers available"}`,
};
return buildTtsFailureResult(errors);
}
export async function textToSpeechTelephony(params: {
@@ -785,10 +789,7 @@ export async function textToSpeechTelephony(params: {
}
}
return {
success: false,
error: `TTS conversion failed: ${errors.join("; ") || "no providers available"}`,
};
return buildTtsFailureResult(errors);
}
export async function maybeApplyTtsToPayload(params: {