feat: 添加旧版本提供商类型映射以兼容性支持

This commit is contained in:
Soulter
2025-05-31 11:00:59 +08:00
parent a76c98d57e
commit 93bc684e8c
2 changed files with 33 additions and 2 deletions

View File

@@ -4,3 +4,4 @@
2. 修复:修复 WebUI Chat 接口的未授权访问安全漏洞、插件 README 可能存在的 XSS 注入漏洞
3. 优化:优化 Vec DB 在 indexing 过程时的数据库事务处理
4. 修复WebUI 下,插件市场的推荐卡片无法点击帮助文档的问题
5. 新增:知识库

View File

@@ -307,6 +307,28 @@ export default {
// 添加提供商类型分类
activeProviderTypeTab: 'all',
// 兼容旧版本(< v3.5.11)的 mapping用于映射到对应的提供商能力类型
oldVersionProviderTypeMapping: {
"openai_chat_completion": "chat_completion",
"anthropic_chat_completion": "chat_completion",
"googlegenai_chat_completion": "chat_completion",
"zhipu_chat_completion": "chat_completion",
"llm_tuner": "chat_completion",
"dify": "chat_completion",
"dashscope": "chat_completion",
"openai_whisper_api": "speech_to_text",
"openai_whisper_selfhost": "speech_to_text",
"sensevoice_stt_selfhost": "speech_to_text",
"openai_tts_api": "text_to_speech",
"edge_tts": "text_to_speech",
"gsvi_tts_api": "text_to_speech",
"fishaudio_tts_api": "text_to_speech",
"dashscope_tts": "text_to_speech",
"azure_tts": "text_to_speech",
"minimax_tts_api": "text_to_speech",
"volcengine_tts": "text_to_speech",
}
}
},
@@ -317,8 +339,16 @@ export default {
return this.config_data.provider || [];
}
return this.config_data.provider.filter(provider =>
provider.provider_type === this.activeProviderTypeTab);
return this.config_data.provider.filter(provider => {
// 如果provider.provider_type已经存在,直接使用它
if (provider.provider_type) {
return provider.provider_type === this.activeProviderTypeTab;
}
// 否则使用映射关系
const mappedType = this.oldVersionProviderTypeMapping[provider.type];
return mappedType === this.activeProviderTypeTab;
});
}
},