Merge remote-tracking branch 'upstream/main' into add_local_tts_change_voice

This commit is contained in:
shane0411
2025-06-11 14:29:35 +08:00
8 changed files with 41 additions and 29 deletions
+12 -8
View File
@@ -1,4 +1,5 @@
import os
import re
import queue
import uuid
import asyncio
@@ -169,15 +170,18 @@ class TTSProviderBase(ABC):
content_type=ContentType.ACTION,
)
)
self.tts_text_queue.put(
TTSMessageDTO(
sentence_id=sentence_id,
sentence_type=SentenceType.MIDDLE,
content_type=content_type,
content_detail=content_detail,
content_file=content_file,
# 对于单句的文本,进行分段处理
segments = re.split(r'([。!?!?;\n])', content_detail)
for seg in segments:
self.tts_text_queue.put(
TTSMessageDTO(
sentence_id=sentence_id,
sentence_type=SentenceType.MIDDLE,
content_type=content_type,
content_detail=seg,
content_file=content_file,
)
)
)
self.tts_text_queue.put(
TTSMessageDTO(
sentence_id=sentence_id,
@@ -11,8 +11,8 @@ class TTSProvider(TTSProviderBase):
self.voice = config.get("private_voice")
else:
self.voice = config.get("voice")
self.response_format = config.get("response_format", "mp3")
self.audio_file_type = config.get("response_format", "mp3")
self.response_format = config.get("response_format", "wav")
self.audio_file_type = config.get("response_format", "wav")
self.host = "api.coze.cn"
self.api_url = f"https://{self.host}/v1/audio/speech"