From 33faeee75d8ce3580f24853226b34e0318f2dd46 Mon Sep 17 00:00:00 2001 From: CGD <3030332422@qq.com> Date: Tue, 10 Jun 2025 14:14:02 +0800 Subject: [PATCH] =?UTF-8?q?update:=E9=80=9A=E8=BF=87=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E2=80=9C=E6=9B=B4=E6=96=B0=E5=94=A4=E9=86=92=E8=AF=8D=E5=93=8D?= =?UTF-8?q?=E5=BA=94=E9=85=8D=E7=BD=AE=E2=80=9D=E6=97=B6=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E8=A1=A8=E6=83=85=E7=AC=A6=E5=8F=B7=EF=BC=8C?= =?UTF-8?q?=E8=A7=A3=E5=86=B3GBK=E7=BC=96=E7=A0=81=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/core/utils/wakeup_word.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main/xiaozhi-server/core/utils/wakeup_word.py b/main/xiaozhi-server/core/utils/wakeup_word.py index 29929081..fe07b41c 100644 --- a/main/xiaozhi-server/core/utils/wakeup_word.py +++ b/main/xiaozhi-server/core/utils/wakeup_word.py @@ -1,4 +1,5 @@ import os +import re import yaml import time import hashlib @@ -108,13 +109,16 @@ class WakeupWordsConfig: def update_wakeup_response(self, voice: str, file_path: str, text: str): """更新唤醒词回复配置""" try: + # 过滤表情字符 + filtered_text = re.sub(r'[\U0001F600-\U0001F64F]', '', text) + config = self._load_config() voice_hash = hashlib.md5(voice.encode()).hexdigest() config[voice_hash] = { "voice": voice, "file_path": file_path, "time": time.time(), - "text": text, + "text": filtered_text, } self._save_config(config) except Exception as e: