TTS: 修正音色为stepaudio合法voice_id, 修回落格式与错误透传

This commit is contained in:
zhiqui
2026-11-15 16:48:04 +08:00
parent 6aa3559033
commit 9f90de0541
3 changed files with 25 additions and 17 deletions
+1 -1
View File
@@ -15,7 +15,7 @@ class CharacterIn(BaseModel):
name: str
persona: str = ""
greeting: str = ""
voice: str = "tongtong"
voice: str = "elegantgentle-female"
avatar_url: str = ""
+3 -3
View File
@@ -271,11 +271,11 @@ async def tts(sid: int, mid: int, user: User = Depends(current_user),
raise HTTPException(404, "消息不存在")
client, models = await _channel_for(db, user, s)
model = models.get("tts") or "stepaudio-2.5-tts"
voice = "tongtong"
voice = "elegantgentle-female"
if s.character_id:
ch = await db.get(Character, s.character_id)
if ch:
voice = ch.voice
if ch and ch.voice:
voice = ch.voice # 非法音色由 client.fix_voice 兜底
try:
audio = await client.tts(model, _dec(user, m.content_enc), voice)
except Exception as e: