mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 09:33:55 +08:00
update: TTS复用链接,VAD双阈值判断
This commit is contained in:
@@ -17,6 +17,7 @@ from core.utils.util import (
|
||||
filter_sensitive_info,
|
||||
)
|
||||
from typing import Dict, Any
|
||||
from collections import deque
|
||||
from core.utils.modules_initialize import (
|
||||
initialize_modules,
|
||||
initialize_tts,
|
||||
@@ -112,6 +113,8 @@ class ConnectionHandler:
|
||||
self.client_have_voice = False
|
||||
self.last_activity_time = 0.0 # 统一的活动时间戳(毫秒)
|
||||
self.client_voice_stop = False
|
||||
self.client_voice_window = deque(maxlen=5)
|
||||
self.last_is_voice = False
|
||||
|
||||
# asr相关变量
|
||||
# 因为实际部署时可能会用到公共的本地ASR,不能把变量暴露给公共ASR
|
||||
@@ -858,6 +861,9 @@ class ConnectionHandler:
|
||||
elif self.websocket:
|
||||
await self.websocket.close()
|
||||
|
||||
if self.tts:
|
||||
await self.tts.close()
|
||||
|
||||
# 最后关闭线程池(避免阻塞)
|
||||
if self.executor:
|
||||
self.executor.shutdown(wait=False)
|
||||
|
||||
Reference in New Issue
Block a user