feat: add provider menu

This commit is contained in:
jialin
2026-02-03 18:21:08 +08:00
parent cb5413c2ce
commit 2dfdd4a0d9
21 changed files with 701 additions and 7 deletions
+73
View File
@@ -0,0 +1,73 @@
import icons from '@/components/icon-font/icons';
import { StatusMaps } from '@/config';
import { StatusType } from '@/config/types';
export type maasProviderType =
| 'doubao'
| 'qwen'
| 'openai'
| 'deepseek'
| 'anthropic';
export const maasProviderValueMap = {
Doubao: 'doubao',
Qwen: 'qwen',
OpenAI: 'openai',
Deepseek: 'deepseek',
Anthropic: 'anthropic'
};
export const maasProviderLabelMap = {
[maasProviderValueMap.Doubao]: 'Doubao',
[maasProviderValueMap.Qwen]: 'Qwen',
[maasProviderValueMap.OpenAI]: 'OpenAI',
[maasProviderValueMap.Deepseek]: 'Deepseek',
[maasProviderValueMap.Anthropic]: 'Anthropic'
};
export const IconsMap = {
[maasProviderValueMap.Doubao]: 'icon-doubao',
[maasProviderValueMap.Qwen]: 'icon-qwen',
[maasProviderValueMap.OpenAI]: 'icon-openai',
[maasProviderValueMap.Deepseek]: 'icon-deepseek',
[maasProviderValueMap.Anthropic]: 'icon-anthropic'
};
export const maasProviderOptions = Object.keys(maasProviderValueMap).map(
(key) => ({
label: maasProviderLabelMap[key],
value: maasProviderValueMap[key as keyof typeof maasProviderValueMap]
})
);
export const ProviderStatusValueMap: Record<string, string> = {
Ready: 'Ready',
InActive: 'Inactive'
};
export const ProviderStatusLabelMap = {
[ProviderStatusValueMap.Ready]: 'Ready',
[ProviderStatusValueMap.InActive]: 'Inactive'
};
export const ProviderStatus: Record<string, StatusType> = {
[ProviderStatusValueMap.Ready]: StatusMaps.success,
[ProviderStatusValueMap.InActive]: StatusMaps.error
};
// actions for each row
export const rowActionList = [
{
key: 'edit',
label: 'common.button.edit',
icon: icons.EditOutlined
},
{
key: 'delete',
label: 'common.button.delete',
icon: icons.DeleteOutlined,
props: {
danger: true
}
}
];
+13
View File
@@ -0,0 +1,13 @@
import { maasProviderType } from '.';
export interface MaasProviderItem {
id: number;
name: string;
state: string;
state_message: string;
provider: maasProviderType;
}
export interface FormData {
name: string;
}