mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-23 03:19:41 +00:00
fix(tts): validate timeout range
This commit is contained in:
parent
2c43a13d6e
commit
04b3ad5aae
1 changed files with 4 additions and 1 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import os
|
||||
import re
|
||||
import math
|
||||
import uuid
|
||||
import queue
|
||||
import asyncio
|
||||
|
|
@ -37,7 +38,9 @@ class TTSProviderBase(ABC):
|
|||
self.delete_audio_file = delete_audio_file
|
||||
self.audio_file_type = "wav"
|
||||
self.output_file = config.get("output_dir", "tmp/")
|
||||
self.tts_timeout = int(config.get("tts_timeout", 15))
|
||||
self.tts_timeout = float(config.get("tts_timeout", 15))
|
||||
if not math.isfinite(self.tts_timeout) or self.tts_timeout <= 0:
|
||||
raise ValueError("tts_timeout must be a positive finite number")
|
||||
self.tts_text_queue = queue.Queue()
|
||||
self.tts_audio_queue = queue.Queue()
|
||||
self.tts_audio_first_sentence = True
|
||||
|
|
|
|||
Loading…
Reference in a new issue