mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-26 09:03:54 +08:00
添加阿里云CosyVoice 和 修复文件编码
添加阿里云的CosyVoice功能 更新wakeup_word.py,在读写配置文件时指定UTF-8编码,以确保正确处理非ascii字符。
This commit is contained in:
@@ -55,7 +55,7 @@ class WakeupWordsConfig:
|
||||
return self._config_cache
|
||||
|
||||
try:
|
||||
with open(self.config_file, "a+") as f:
|
||||
with open(self.config_file, "a+", encoding="utf-8") as f:
|
||||
with FileLock(f, timeout=self._lock_timeout):
|
||||
f.seek(0)
|
||||
content = f.read()
|
||||
@@ -73,7 +73,7 @@ class WakeupWordsConfig:
|
||||
def _save_config(self, config: Dict):
|
||||
"""保存配置到文件,使用文件锁保护"""
|
||||
try:
|
||||
with open(self.config_file, "w") as f:
|
||||
with open(self.config_file, "w", encoding="utf-8") as f:
|
||||
with FileLock(f, timeout=self._lock_timeout):
|
||||
yaml.dump(config, f, allow_unicode=True)
|
||||
self._config_cache = config
|
||||
|
||||
Reference in New Issue
Block a user