feat: 功能优化
This commit is contained in:
61
frontend/app/web-gold/src/config/voiceConfig.js
Normal file
61
frontend/app/web-gold/src/config/voiceConfig.js
Normal file
@@ -0,0 +1,61 @@
|
||||
/**
|
||||
* 语音供应商统一配置
|
||||
*/
|
||||
|
||||
// 供应商类型枚举
|
||||
export const VOICE_PROVIDER_TYPES = {
|
||||
COSYVOICE: 'cosyvoice',
|
||||
SILICONFLOW: 'siliconflow',
|
||||
QWEN: 'qwen',
|
||||
AZURE: 'azure',
|
||||
AWS: 'aws'
|
||||
}
|
||||
|
||||
// 默认供应商
|
||||
export const DEFAULT_VOICE_PROVIDER = VOICE_PROVIDER_TYPES.COSYVOICE
|
||||
|
||||
// 供应商选项(用于下拉选择)
|
||||
export const VOICE_PROVIDER_OPTIONS = [
|
||||
{ label: '阿里云 CosyVoice', value: VOICE_PROVIDER_TYPES.COSYVOICE },
|
||||
{ label: '硅基流动 SiliconFlow', value: VOICE_PROVIDER_TYPES.SILICONFLOW }
|
||||
]
|
||||
|
||||
// 供应商别名映射(兼容旧名称)
|
||||
export const PROVIDER_ALIAS_MAP = {
|
||||
[VOICE_PROVIDER_TYPES.QWEN]: VOICE_PROVIDER_TYPES.COSYVOICE
|
||||
}
|
||||
|
||||
/**
|
||||
* 标准化供应商类型(处理别名映射)
|
||||
*/
|
||||
export function normalizeProviderType(providerType) {
|
||||
if (!providerType) return DEFAULT_VOICE_PROVIDER
|
||||
return PROVIDER_ALIAS_MAP[providerType] || providerType
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取供应商显示名称
|
||||
*/
|
||||
export function getProviderLabel(providerType) {
|
||||
const option = VOICE_PROVIDER_OPTIONS.find(opt => opt.value === providerType)
|
||||
return option?.label || providerType
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查供应商是否支持
|
||||
*/
|
||||
export function isProviderSupported(providerType) {
|
||||
const normalized = normalizeProviderType(providerType)
|
||||
return Object.values(VOICE_PROVIDER_TYPES).includes(normalized)
|
||||
}
|
||||
|
||||
// 默认导出配置对象
|
||||
export default {
|
||||
VOICE_PROVIDER_TYPES,
|
||||
DEFAULT_VOICE_PROVIDER,
|
||||
VOICE_PROVIDER_OPTIONS,
|
||||
PROVIDER_ALIAS_MAP,
|
||||
normalizeProviderType,
|
||||
getProviderLabel,
|
||||
isProviderSupported
|
||||
}
|
||||
Reference in New Issue
Block a user