import { beforeEach, describe, expect, it, vi } from "vitest"; import { SILENT_REPLY_TOKEN } from "../../auto-reply/tokens.js"; import * as ttsRuntime from "../../tts/tts.js"; import { createTtsTool } from "./tts-tool.js";
const rendered = (result.content as Array<{ type: string; text: string }>)[0].text; // The literal directive tokens must not appear verbatim, so // parseReplyDirectives can no longer surface them as media/audio flags.
expect(rendered).not.toMatch(/^MEDIA:/m);
expect(rendered).not.toContain("[[audio_as_voice]]"); // The transcript still contains the original characters, just interrupted // by a zero-width word joiner (U+2060) that keeps the pattern from firing.
expect(rendered).toContain("\u2060MEDIA:");
expect(rendered).toContain("[\u2060[audio_as_voice]]");
});
it("defuses MEDIA lines with non-ASCII leading whitespace", async () => {
textToSpeechSpy.mockResolvedValue({
success: true,
audioPath: "/tmp/reply.opus",
provider: "test",
voiceCompatible: true,
});
it("throws when synthesis fails so the agent records a tool error", async () => {
textToSpeechSpy.mockResolvedValue({
success: false,
error: "TTS conversion failed: openai: not configured",
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.