diff --git a/packages/application/cosyvoice_service.py b/packages/application/cosyvoice_service.py old mode 100755 new mode 100644 index de1b4cef0..b50df41fc --- a/packages/application/cosyvoice_service.py +++ b/packages/application/cosyvoice_service.py @@ -70,14 +70,14 @@ class CosyVoiceService: - 音色克隆: POST /services/audio/tts/customization (model=voice-enrollment) - action=create_voice: 创建克隆音色,返回 voice_id(状态 DEPLOYING) - action=query_voice: 查询音色状态(DEPLOYING / OK / UNDEPLOYED) - - 语音合成: POST /services/audio/tts/SpeechSynthesizer (model=cosyvoice-v3.5-plus) + - 语音合成: POST /services/audio/tts/SpeechSynthesizer (model=cosyvoice-v3-flash) - 非流式: 同步返回音频 URL 使用示例: service = CosyVoiceService( api_key="your-api-key", base_url="https://dashscope.aliyuncs.com/api/v1", - model="cosyvoice-v3.5-plus", + model="cosyvoice-v3-flash", ) # 音色克隆 diff --git a/packages/shared/config.py b/packages/shared/config.py index e6a7d748f..ace61d20d 100755 --- a/packages/shared/config.py +++ b/packages/shared/config.py @@ -32,8 +32,8 @@ class SharedSettings(BaseSettings): # CosyVoice (阿里云百炼语音合成) cosyvoice_api_key: str = "" cosyvoice_base_url: str = "https://dashscope.aliyuncs.com/api/v1" - cosyvoice_model: str = "cosyvoice-v3.5-plus" - cosyvoice_voice: str = "longxiaochun_v3" # 默认音色 + cosyvoice_model: str = "cosyvoice-v3-flash" + cosyvoice_voice: str = "longxiaochun_v3" # 默认音色(v3 系列系统音色带 _v3 后缀) cosyvoice_sample_rate: int = 22050 cosyvoice_format: str = "mp3" # 输出格式:mp3/wav/pcm # 音色克隆模型名(固定为 voice-enrollment) diff --git a/tests/unit/test_cosyvoice_service.py b/tests/unit/test_cosyvoice_service.py index 42c0f79e9..f6e631066 100644 --- a/tests/unit/test_cosyvoice_service.py +++ b/tests/unit/test_cosyvoice_service.py @@ -23,7 +23,7 @@ def _make_service( *, api_key: str = "test-api-key", base_url: str = "https://dashscope.aliyuncs.com/api/v1", - model: str = "cosyvoice-v3.5-plus", + model: str = "cosyvoice-v3-flash", clone_model: str = "voice-enrollment", http_client: httpx.Client | None = None, audio_url_signer=None, @@ -78,7 +78,7 @@ class TestSubmitCloneTask: 200, { "output": { - "voice_id": "cosyvoice-v3.5-plus-clone-abc123", + "voice_id": "cosyvoice-v3-flash-clone-abc123", "status": "DEPLOYING", }, "usage": {"count": 1}, @@ -92,7 +92,7 @@ class TestSubmitCloneTask: voice_name="myvoice", ) - assert result["voice_id"] == "cosyvoice-v3.5-plus-clone-abc123" + assert result["voice_id"] == "cosyvoice-v3-flash-clone-abc123" assert result["status"] == "DEPLOYING" assert result["request_id"] == "req-001" @@ -104,7 +104,7 @@ class TestSubmitCloneTask: payload = call_args.kwargs["json"] assert payload["model"] == "voice-enrollment" assert payload["input"]["action"] == "create_voice" - assert payload["input"]["target_model"] == "cosyvoice-v3.5-plus" + assert payload["input"]["target_model"] == "cosyvoice-v3-flash" assert payload["input"]["prefix"] == "myvoice" assert payload["input"]["url"] == "https://example.com/audio.wav" assert payload["input"]["language_hints"] == ["zh"] @@ -229,7 +229,7 @@ class TestQueryVoiceStatus: { "output": { "status": "DEPLOYING", - "target_model": "cosyvoice-v3.5-plus", + "target_model": "cosyvoice-v3-flash", "gmt_create": "2026-01-01T00:00:00Z", "gmt_modified": "2026-01-01T00:01:00Z", "resource_link": "https://...", @@ -242,7 +242,7 @@ class TestQueryVoiceStatus: result = service.query_voice_status("voice-123") assert result["status"] == "DEPLOYING" - assert result["target_model"] == "cosyvoice-v3.5-plus" + assert result["target_model"] == "cosyvoice-v3-flash" # 验证请求 payload = mock_client.request.call_args.kwargs["json"] @@ -253,7 +253,7 @@ class TestQueryVoiceStatus: def test_query_ok_status(self) -> None: mock_client = MagicMock() mock_client.request.return_value = _mock_response( - 200, {"output": {"status": "OK", "target_model": "cosyvoice-v3.5-plus"}} + 200, {"output": {"status": "OK", "target_model": "cosyvoice-v3-flash"}} ) service = _make_service(http_client=mock_client) @@ -278,7 +278,7 @@ class TestPollCloneTask: def test_poll_ok_on_first_check(self) -> None: mock_client = MagicMock() mock_client.request.return_value = _mock_response( - 200, {"output": {"status": "OK", "target_model": "cosyvoice-v3.5-plus"}} + 200, {"output": {"status": "OK", "target_model": "cosyvoice-v3-flash"}} ) service = _make_service(http_client=mock_client) @@ -409,7 +409,7 @@ class TestSynthesizeSpeech: assert "/services/audio/tts/SpeechSynthesizer" in call_args.kwargs["url"] payload = call_args.kwargs["json"] - assert payload["model"] == "cosyvoice-v3.5-plus" + assert payload["model"] == "cosyvoice-v3-flash" assert payload["input"]["text"] == "你好世界" assert payload["input"]["voice"] == "longxiaochun_v3" assert payload["input"]["format"] == "mp3"