Files
chat/backend/config/cosyvoice.php
T
2026-08-03 10:00:05 +08:00

27 lines
1.5 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
return [
// 开启后优先请求 CosyVoice;服务异常时会自动回落到 OpenAI / 浏览器语音。
'enabled' => filter_var(env('COSYVOICE_ENABLED', true), FILTER_VALIDATE_BOOLEAN),
'base_url' => rtrim((string) env('COSYVOICE_BASE_URL', 'http://127.0.0.1:50000'), '/'),
// sft / instruct / zero_shot / cross_lingual / instruct2
'mode' => (string) env('COSYVOICE_MODE', 'sft'),
'speaker' => (string) env('COSYVOICE_SPEAKER', '中文女'),
'instruct_text' => (string) env(
'COSYVOICE_INSTRUCT',
'请用温暖、自然、耐心的中文客服语气表达,语速适中,停顿真实,避免播音腔和夸张情绪。'
),
'prompt_text' => (string) env('COSYVOICE_PROMPT_TEXT', ''),
'prompt_wav' => (string) env(
'COSYVOICE_PROMPT_WAV',
root_path() . 'storage/cosyvoice/customer-service.wav'
),
// CosyVoice-300M 常用 22050CosyVoice2/3 通常应配置为 24000。
'sample_rate' => max(8000, (int) env('COSYVOICE_SAMPLE_RATE', 22050)),
'connect_timeout_ms' => max(200, (int) env('COSYVOICE_CONNECT_TIMEOUT_MS', 800)),
'timeout_seconds' => max(2, (int) env('COSYVOICE_TIMEOUT_SECONDS', 8)),
'failure_ttl' => max(5, (int) env('COSYVOICE_FAILURE_TTL', 20)),
// 官方 FastAPI 默认无鉴权;经网关暴露时可使用 Bearer Token。
'api_key' => (string) env('COSYVOICE_API_KEY', ''),
];