feat: expand AI provider support and update descriptions

- Updated AIProviderBase and AIProviderUpdate to support new API formats: 'anthropic' and 'ollama'.
- Added SVG icons for Anthropic, Azure, Ollama, and Z.ai providers.
- Updated AI provider payload interface to include new formats.
- Enhanced English and Chinese localization for new providers and updated descriptions for OpenAI and Anthropic.
- Added new provider templates for Azure OpenAI, Anthropic, Z.ai, and Ollama in the settings tab.
- Updated the API format selection in the settings tab to include new options.
This commit is contained in:
shiyu
2026-01-11 22:29:22 +08:00
parent e7cf8dbdb8
commit 87770176b6
10 changed files with 836 additions and 52 deletions
@@ -80,7 +80,7 @@ interface ProviderTemplate {
key: string;
nameKey: string;
descriptionKey: string;
api_format: 'openai' | 'gemini';
api_format: AIProviderPayload['api_format'];
identifier: string;
base_url?: string;
logo_url?: string;
@@ -150,6 +150,28 @@ const providerTemplates: ProviderTemplate[] = [
provider_type: 'builtin',
doc_url: 'https://platform.openai.com/docs/api-reference',
},
{
key: 'azure-openai',
nameKey: 'Azure OpenAI Provider',
descriptionKey: 'Azure OpenAI Provider Description',
api_format: 'openai',
identifier: 'azure-openai',
base_url: 'https://{resource-name}.openai.azure.com/openai/deployments/{deployment-name}',
logo_url: '/icon/azure-color.svg',
provider_type: 'builtin',
doc_url: 'https://learn.microsoft.com/en-us/azure/ai-services/openai/reference',
},
{
key: 'anthropic',
nameKey: 'Anthropic Provider',
descriptionKey: 'Anthropic Provider Description',
api_format: 'anthropic',
identifier: 'anthropic',
base_url: 'https://api.anthropic.com/v1',
logo_url: '/icon/anthropic.svg',
provider_type: 'builtin',
doc_url: 'https://docs.anthropic.com/claude/reference/messages_post',
},
{
key: 'google-ai',
nameKey: 'Google AI Provider',
@@ -161,6 +183,17 @@ const providerTemplates: ProviderTemplate[] = [
provider_type: 'builtin',
doc_url: 'https://ai.google.dev/api/rest',
},
{
key: 'zai',
nameKey: 'Z.ai Provider',
descriptionKey: 'Z.ai Provider Description',
api_format: 'openai',
identifier: 'zai',
base_url: 'https://open.bigmodel.cn/api/paas/v4',
logo_url: '/icon/zai.svg',
provider_type: 'builtin',
doc_url: 'https://open.bigmodel.cn/dev/api',
},
{
key: 'siliconflow',
nameKey: 'SiliconFlow Provider',
@@ -183,6 +216,17 @@ const providerTemplates: ProviderTemplate[] = [
provider_type: 'builtin',
doc_url: 'https://platform.deepseek.com/api-docs',
},
{
key: 'ollama',
nameKey: 'Ollama Provider',
descriptionKey: 'Ollama Provider Description',
api_format: 'ollama',
identifier: 'ollama',
base_url: 'http://localhost:11434',
logo_url: '/icon/ollama.svg',
provider_type: 'builtin',
doc_url: 'https://github.com/ollama/ollama/blob/main/docs/api.md',
},
];
const abilityTagColor: Record<AIAbility, string> = {
@@ -1071,14 +1115,16 @@ export default function AiSettingsTab() {
label={t('API Format')}
rules={[{ required: true }]}
>
<Select
disabled={!allowFormatChange}
options={[
{ value: 'openai', label: 'OpenAI Compatible' },
{ value: 'gemini', label: 'Gemini Compatible' },
]}
/>
</Form.Item>
<Select
disabled={!allowFormatChange}
options={[
{ value: 'openai', label: 'OpenAI Compatible' },
{ value: 'gemini', label: 'Gemini Compatible' },
{ value: 'anthropic', label: 'Anthropic Native' },
{ value: 'ollama', label: 'Ollama Native' },
]}
/>
</Form.Item>
<Form.Item name="base_url" label={t('Base URL')} rules={[{ required: true, message: t('Enter base url') }]}>
<Input placeholder="https://" />
</Form.Item>