Voice library support dashscope

This commit is contained in:
Xin Wang
2026-02-26 03:54:52 +08:00
parent b193f91432
commit f77f7c7531
11 changed files with 684 additions and 26 deletions

View File

@@ -13,12 +13,16 @@ from app.id_generator import short_id
from app.models import Voice, Assistant, KnowledgeBase, Workflow, LLMModel, ASRModel, KnowledgeDocument
VOICE_MODEL = "FunAudioLLM/CosyVoice2-0.5B"
DASHSCOPE_VOICE_MODEL = "qwen3-tts-flash-realtime"
DASHSCOPE_DEFAULT_VOICE_KEY = "Cherry"
DASHSCOPE_REALTIME_URL = "wss://dashscope.aliyuncs.com/api-ws/v1/realtime"
SEED_VOICE_IDS = {
"alex": short_id("tts"),
"david": short_id("tts"),
"bella": short_id("tts"),
"claire": short_id("tts"),
"dashscope_cherry": short_id("tts"),
}
SEED_LLM_IDS = {
@@ -177,8 +181,20 @@ def init_default_data():
voice_key=f"{VOICE_MODEL}:claire",
is_system=True,
),
Voice(
id=SEED_VOICE_IDS["dashscope_cherry"],
name="DashScope Cherry",
vendor="DashScope",
gender="Female",
language="zh",
description="DashScope realtime sample voice.",
model=DASHSCOPE_VOICE_MODEL,
voice_key=DASHSCOPE_DEFAULT_VOICE_KEY,
base_url=DASHSCOPE_REALTIME_URL,
is_system=True,
),
]
seed_if_empty(db, Voice, voices, "✅ 默认声音数据已初始化 (OpenAI Compatible CosyVoice 2.0)")
seed_if_empty(db, Voice, voices, "✅ 默认声音数据已初始化 (OpenAI Compatible + DashScope)")
def init_default_tools(recreate: bool = False):