From 4e6800b8f48132a2168e48714f8aaf2dc1ad84d5 Mon Sep 17 00:00:00 2001 From: afred Date: Sat, 4 Jan 2025 15:20:36 +0800 Subject: [PATCH] change edge tts _SSMLTemplate --- app/utils/ms_edge_tts.ts | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/app/utils/ms_edge_tts.ts b/app/utils/ms_edge_tts.ts index f291ebada..4da00143e 100644 --- a/app/utils/ms_edge_tts.ts +++ b/app/utils/ms_edge_tts.ts @@ -233,15 +233,23 @@ export class MsEdgeTTS { } private _SSMLTemplate(input: string, options: ProsodyOptions = {}): string { - // in case future updates to the edge API block these elements, we'll be concatenating strings. + // 对 input 进行特殊字符替换 + input = input + .replace(/&/g, "&") + .replace(//g, ">"); + + // 合并默认选项与传入选项 options = { ...new ProsodyOptions(), ...options }; - return ` - - - ${input} - - - `; + + return ` + + + + ${input} + + + `; } /**