mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 10:10:45 +00:00
fix(agents): error on failed tts tool synthesis
This commit is contained in:
committed by
Gustavo Madeira Santana
parent
0266cf4d10
commit
af88310f31
@@ -41,4 +41,17 @@ describe("createTtsTool", () => {
|
||||
});
|
||||
expect(JSON.stringify(result.content)).not.toContain("MEDIA:");
|
||||
});
|
||||
|
||||
it("throws when synthesis fails so the agent records a tool error", async () => {
|
||||
textToSpeechSpy.mockResolvedValue({
|
||||
success: false,
|
||||
error: "TTS conversion failed: openai: not configured",
|
||||
});
|
||||
|
||||
const tool = createTtsTool();
|
||||
|
||||
await expect(tool.execute("call-1", { text: "hello" })).rejects.toThrow(
|
||||
"TTS conversion failed: openai: not configured",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -49,15 +49,7 @@ export function createTtsTool(opts?: {
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: result.error ?? "TTS conversion failed",
|
||||
},
|
||||
],
|
||||
details: { error: result.error },
|
||||
};
|
||||
throw new Error(result.error ?? "TTS conversion failed");
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user