update:优化配置及文档

This commit is contained in:
hrz
2025-04-30 15:05:42 +08:00
parent 9e9af2a031
commit d2f8f05acb
18 changed files with 167 additions and 137 deletions
@@ -21,8 +21,15 @@ class VADProvider(VADProviderBase):
(get_speech_timestamps, _, _, _, _) = self.utils
self.decoder = opuslib_next.Decoder(16000, 1)
self.vad_threshold = float(config.get("threshold", 0.5))
self.silence_threshold_ms = int(config.get("min_silence_duration_ms", 1000))
# 处理空字符串的情况
threshold = config.get("threshold", "0.5")
min_silence_duration_ms = config.get("min_silence_duration_ms", "1000")
self.vad_threshold = float(threshold) if threshold else 0.5
self.silence_threshold_ms = (
int(min_silence_duration_ms) if min_silence_duration_ms else 1000
)
def is_vad(self, conn, opus_packet):
try: