* feat: add 302.ai TTS integration (#166)

* update:将tts_302ai tts合并到doubao tts

---------

Co-authored-by: Junsen <66542771+Huang-junsen@users.noreply.github.com>
Co-authored-by: hrz <1710360675@qq.com>
This commit is contained in:
欣南科技
2025-03-02 16:59:25 +08:00
committed by GitHub
co-authored by Junsen hrz
parent bc531652e9
commit effd79b465
4 changed files with 31 additions and 10 deletions
+1 -1
View File
@@ -234,7 +234,7 @@ class ConnectionHandler:
current_text = full_text[processed_chars:] # 从未处理的位置开始
# 查找最后一个有效标点
punctuations = ("", "", "", ".", "?", "!", ";", "", ":", "", "", ",")
punctuations = ("", "", "", "?", "!", ";", "", ":", "", "")
last_punct_pos = -1
for punct in punctuations:
pos = current_text.rfind(punct)
+3 -4
View File
@@ -14,10 +14,9 @@ class TTSProvider(TTSProviderBase):
self.access_token = config.get("access_token")
self.cluster = config.get("cluster")
self.voice = config.get("voice")
self.host = "openspeech.bytedance.com"
self.api_url = f"https://{self.host}/api/v1/tts"
self.header = {"Authorization": f"Bearer;{self.access_token}"}
self.api_url = config.get("api_url")
self.authorization = config.get("authorization")
self.header = {"Authorization": f"{self.authorization}{self.access_token}"}
def generate_filename(self, extension=".wav"):
return os.path.join(self.output_file, f"tts-{datetime.now().date()}@{uuid.uuid4().hex}{extension}")