From e77a3b79cd95ebad838008b01ec3a3273a002e6f Mon Sep 17 00:00:00 2001 From: Sakura-RanChen <1908198662@qq.com> Date: Thu, 25 Sep 2025 10:17:56 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix:=20Markdown=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/core/utils/tts.py | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/main/xiaozhi-server/core/utils/tts.py b/main/xiaozhi-server/core/utils/tts.py index eb383667..8b68d195 100644 --- a/main/xiaozhi-server/core/utils/tts.py +++ b/main/xiaozhi-server/core/utils/tts.py @@ -6,6 +6,27 @@ import importlib logger = setup_logging() +punctuation_set = { + ",", + ",", # 中文逗号 + 英文逗号 + "。", + ".", # 中文句号 + 英文句号 + "!", + "!", # 中文感叹号 + 英文感叹号 + "“", + "”", + '"', # 中文双引号 + 英文引号 + ":", + ":", # 中文冒号 + 英文冒号 + "-", + "-", # 英文连字符 + 中文全角横线 + "、", # 中文顿号 + "[", + "]", # 方括号 + "【", + "】", # 中文方括号 + "~", # 波浪号 +} def create_instance(class_name, *args, **kwargs): # 创建TTS实例 @@ -107,6 +128,11 @@ 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) return text.strip() \ No newline at end of file From e15c784bdb2511ade22534bf9e13039e2f31dc65 Mon Sep 17 00:00:00 2001 From: Sakura-RanChen <1908198662@qq.com> Date: Thu, 25 Sep 2025 10:57:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E6=96=87=E6=A1=A3=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/index-stream-integration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/index-stream-integration.md b/docs/index-stream-integration.md index 8af91612..caf3ae60 100644 --- a/docs/index-stream-integration.md +++ b/docs/index-stream-integration.md @@ -34,7 +34,7 @@ Cuda compilation tools, release 12.8, V12.8.89 ```bash pip install torch torchvision ``` -需要 pytorch 版本 2.8.0(对应 vllm 0.10.2),具体安装指令请参考:[pytorch 官网](https://pytorch.org/get-started/locally/]\) +需要 pytorch 版本 2.8.0(对应 vllm 0.10.2),具体安装指令请参考:[pytorch 官网](https://pytorch.org/get-started/locally/) ### 4. 安装依赖 ```bash