feat(tts): resolve channel account config generically

This commit is contained in:
Peter Steinberger
2026-04-26 08:10:25 +01:00
parent 6c60cd2b72
commit d419fb561d
24 changed files with 515 additions and 47 deletions

View File

@@ -185,6 +185,7 @@ describe("dispatchOutbound", () => {
text: "read this aloud",
cfg: {},
channel: "qqbot",
accountId: "qq-main",
});
expect(audioFileToSilkBase64Mock).toHaveBeenCalledWith("/tmp/openclaw-qqbot/tts.wav");
expect(sendVoiceMessageMock).toHaveBeenCalledWith(

View File

@@ -57,7 +57,12 @@ export interface GatewayPluginRuntime {
};
};
tts: {
textToSpeech: (params: { text: string; cfg: unknown; channel: string }) => Promise<{
textToSpeech: (params: {
text: string;
cfg: unknown;
channel: string;
accountId?: string;
}) => Promise<{
success: boolean;
audioPath?: string;
provider?: string;

View File

@@ -37,7 +37,12 @@ import {
/** TTS provider interface — injected from the outer layer. */
export interface TTSProvider {
/** Framework TTS: text → audio file path. */
textToSpeech(params: { text: string; cfg: unknown; channel: string }): Promise<{
textToSpeech(params: {
text: string;
cfg: unknown;
channel: string;
accountId?: string;
}): Promise<{
success: boolean;
audioPath?: string;
provider?: string;
@@ -406,6 +411,7 @@ export async function sendTextAsVoiceReply(
text: ttsText,
cfg,
channel: "qqbot",
accountId: account.accountId,
});
if (!ttsResult.success || !ttsResult.audioPath) {
log?.error(`TTS failed: ${ttsResult.error ?? "unknown"}`);