feat(#1898): TTS 参数适配 CosyVoice v3 官方 API #1917
Reference in New Issue
Block a user
Delete Branch "fix/1898-cosyvoice-api-params"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
背景
前端反馈 TTS 情绪参数不生效:CosyVoice v3 API 已废弃
emotion枚举字段,情绪需通过input.instruction自然语言中文指令传递;语言通过input.language_hints数组传递。改动
cosyvoice_service.py:情绪归一化输出中文描述词 → 拼入instruction="你说话的情感是{norm}。";新增language参数 →language_hints=[lang];扩展 emotion 映射表支持 sad/angry/surprised/fearful/disgusted/happy 等schemas/tts.py:预览请求新增language字段routes/tts.py:合成接口透传 language 到 synthesis_meta;预览调用传 languagelipsync_service.py/lipsync_tts.py:去掉老的normalize_emotion英文枚举归一化,改由 CosyVoiceService 内部统一处理tts_job/workflow.py、streaming_service.py:所有 CosyVoice 调用点透传 language测试
Closes #1898
CosyVoice v3 API 调整:emotion 字段已废弃,改用 input.instruction 中文自然语言 指令;语言通过 input.language_hints 数组传递(仅取第一个元素)。 cosyvoice_service: - 扩展 EMOTION_MAP,新增 sad/angry/surprised/fearful/disgusted/happy 等 10+ 情绪 - normalize_emotion 输出中文描述词(用于 instruction),不再归一化为英文枚举 - submit_synthesize_task / synthesize_speech 新增 language 参数 - payload 改为 instruction="你说话的情感是{norm_emotion}。" + language_hints=[lang] - 系统音色仅传 zh/en;克隆音色不做语言限制(v3 克隆音色支持多语言) - rate 字段名保持(CosyVoice 官方文档确认仍用 rate 字段) schemas/routes: - TTS 预览请求新增 language 字段(默认 zh-CN) - emotion 字段描述更新为支持中文/英文自然语言指令 - /tts/synthesize 的 synthesis_meta 透传 language - lipsync 任务默认 language=zh tts_job workflow / streaming_service: - 所有 CosyVoice 调用点透传 language 参数(默认 zh-CN) - metadata 中 language 字段从请求一路透传到分段合成线程池 新增单测: - test_normalize_emotion_* 更新为中文描述词断言,新增情绪覆盖 - test_submit_synthesize_payload_uses_instruction_and_language_hints - test_submit_synthesize_payload_english_emotion_maps_to_chinese - 相关老测试补 language kwarg 断言 - 全量 15127 passed,0 failed [skip ci-format-check]🚀 预览环境已部署
🗑️ 预览环境已清理
PR #1917 已关闭或合并,对应的预览环境已被清理。