fix: move loadConfig after channel guard and fix string formatting

This commit is contained in:
Hiago Silva 2026-03-16 08:55:35 -03:00 committed by GitHub
parent 014fc66da1
commit f83a82169b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -28,20 +28,20 @@ export function createTtsTool(opts?: {
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.",
text: 'TTS requires a bound channel for audio delivery. Use sessionTarget: "main" or provide a channel parameter.',
},
],
details: { error: "no_channel" },
};
}
const cfg = opts?.config ?? loadConfig();
const result = await textToSpeech({
text,
cfg,