feat: 功能优化
This commit is contained in:
@@ -10,28 +10,15 @@ import { normalizeProviderType, VOICE_PROVIDER_TYPES } from '@/config/voiceConfi
|
||||
// 兼容旧代码的导出
|
||||
const TTS_PROVIDERS = VOICE_PROVIDER_TYPES
|
||||
|
||||
// 供应商默认配置(使用标准化后的键名)
|
||||
const DEFAULT_CONFIG = {
|
||||
cosyvoice: {
|
||||
const DEFAULT_CONFIG = {
|
||||
apiEndpoint: '/api/tik/voice/tts',
|
||||
audioFormat: 'mp3',
|
||||
supportedFormats: ['mp3', 'wav']
|
||||
},
|
||||
azure: {
|
||||
apiEndpoint: '/api/tik/voice/azure/tts',
|
||||
audioFormat: 'mp3',
|
||||
supportedFormats: ['mp3', 'wav', 'ogg']
|
||||
},
|
||||
aws: {
|
||||
apiEndpoint: '/api/tik/voice/aws/tts',
|
||||
audioFormat: 'mp3',
|
||||
supportedFormats: ['mp3', 'wav', 'ogg']
|
||||
}
|
||||
}
|
||||
|
||||
export function useTTS(options = {}) {
|
||||
const {
|
||||
provider = VOICE_PROVIDER_TYPES.COSYVOICE,
|
||||
provider = VOICE_PROVIDER_TYPES.SILICONFLOW,
|
||||
customConfig = {}
|
||||
} = options
|
||||
|
||||
@@ -49,9 +36,7 @@ export function useTTS(options = {}) {
|
||||
|
||||
// 获取当前供应商配置
|
||||
const getProviderConfig = () => {
|
||||
const normalizedProvider = normalizeProviderType(provider)
|
||||
const config = DEFAULT_CONFIG[normalizedProvider] || DEFAULT_CONFIG.cosyvoice
|
||||
return { ...config, ...customConfig }
|
||||
return DEFAULT_CONFIG
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user