From d2cbec09811be819d59ed3aac0e74f4198d1dc87 Mon Sep 17 00:00:00 2001 From: Sakura-RanChen <1908198662@qq.com> Date: Fri, 17 Apr 2026 10:59:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=95=B4=E5=A4=84=E7=90=86?= =?UTF-8?q?=E9=A1=BA=E5=BA=8F=E4=BF=9D=E7=95=99=E8=8B=B1=E6=96=87=E7=A9=BA?= =?UTF-8?q?=E6=A0=BC=E7=9A=84=E5=90=8C=E6=97=B6=E4=BF=AE=E5=A4=8Dmarkdown?= =?UTF-8?q?=E8=A2=AB=E8=AF=86=E5=88=AB=E4=B8=BA=E7=BA=AFASCII=20=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E7=9A=84=E9=94=99=E8=AF=AF=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/core/utils/tts.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/main/xiaozhi-server/core/utils/tts.py b/main/xiaozhi-server/core/utils/tts.py index df3e90b4..eedbc4ac 100644 --- a/main/xiaozhi-server/core/utils/tts.py +++ b/main/xiaozhi-server/core/utils/tts.py @@ -130,17 +130,17 @@ class MarkdownCleaner: """ 主入口方法:依序执行所有正则,移除或替换 Markdown 元素 """ - # 检查文本是否全为英文和基本标点符号 - if text and all((c.isascii() or c.isspace() or c in punctuation_set) for c in text): - # 保留原始空格,直接返回 - return text - for regex, replacement in MarkdownCleaner.REGEXES: text = regex.sub(replacement, text) # 去除emoji表情 text = check_emoji(text) + # 检查文本是否全为英文和基本标点符号 + if text and all((c.isascii() or c.isspace() or c in punctuation_set) for c in text): + # 保留原始空格,直接返回 + return text + return text.strip() def convert_percentage_to_range(percentage, min_val, max_val, base_val=None):