fix(tts): fail fast when no delivery channel is bound
Prevents TTS tool from hanging indefinitely in isolated cron sessions where no channel is bound for audio delivery. Part of #43483
This commit is contained in:
parent
fba394c56b
commit
fdc003bb3f
@ -27,11 +27,25 @@ export function createTtsTool(opts?: {
|
||||
const params = args as Record<string, unknown>;
|
||||
const text = readStringParam(params, "text", { required: true });
|
||||
const channel = readStringParam(params, "channel");
|
||||
const resolvedChannel = channel ?? opts?.agentChannel;
|
||||
const cfg = opts?.config ?? loadConfig();
|
||||
|
||||
if (!resolvedChannel) {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: "TTS requires a bound channel for audio delivery. Use sessionTarget: \"main\" or provide a channel parameter.",
|
||||
},
|
||||
],
|
||||
details: { error: "no_channel" },
|
||||
};
|
||||
}
|
||||
|
||||
const result = await textToSpeech({
|
||||
text,
|
||||
cfg,
|
||||
channel: channel ?? opts?.agentChannel,
|
||||
channel: resolvedChannel,
|
||||
});
|
||||
|
||||
if (result.success && result.audioPath) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user