chore: backend api
This commit is contained in:
@@ -29,6 +29,20 @@ export const builtInBackendLogos: Record<string, string> = {
|
||||
[backendOptionsMap.voxBox]: VoxBoxLogo
|
||||
};
|
||||
|
||||
export const BackendSourceValueMap = {
|
||||
CUSTOM: 'custom',
|
||||
BUILTIN: 'built-in',
|
||||
COMMUNITY: 'community',
|
||||
USER_DEFINED: 'user_defined'
|
||||
};
|
||||
|
||||
export const BackendSourceLabelMap: Record<string, string> = {
|
||||
[BackendSourceValueMap.CUSTOM]: 'backend.custom',
|
||||
[BackendSourceValueMap.BUILTIN]: 'backend.builtin',
|
||||
[BackendSourceValueMap.COMMUNITY]: 'backend.community',
|
||||
[BackendSourceValueMap.USER_DEFINED]: 'models.form.backend.custom'
|
||||
};
|
||||
|
||||
export const backendActions = [
|
||||
{
|
||||
label: 'common.button.edit',
|
||||
@@ -44,13 +58,34 @@ export const backendActions = [
|
||||
locale: true,
|
||||
icon: icons.Yaml
|
||||
},
|
||||
{
|
||||
label: 'common.button.enable',
|
||||
value: 'enable',
|
||||
key: 'enable',
|
||||
locale: true,
|
||||
icon: icons.Yaml,
|
||||
show: (record: any) =>
|
||||
!record.enabled &&
|
||||
record.backend_source === BackendSourceValueMap.COMMUNITY
|
||||
},
|
||||
{
|
||||
label: 'common.button.disable',
|
||||
value: 'disable',
|
||||
key: 'disable',
|
||||
locale: true,
|
||||
icon: icons.Yaml,
|
||||
show: (record: any) =>
|
||||
record.enabled &&
|
||||
record.backend_source === BackendSourceValueMap.COMMUNITY
|
||||
},
|
||||
{
|
||||
label: 'common.button.delete',
|
||||
value: 'delete',
|
||||
key: 'delete',
|
||||
icon: icons.DeleteOutlined,
|
||||
locale: true,
|
||||
danger: true
|
||||
danger: true,
|
||||
show: (record: any) => !record.is_built_in
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ export interface FormData {
|
||||
default_backend_param?: string[];
|
||||
allowed_proxy_uris?: string[];
|
||||
content?: string;
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export interface ListItem extends FormData {
|
||||
@@ -30,6 +31,9 @@ export interface ListItem extends FormData {
|
||||
is_built_in?: boolean;
|
||||
created_at?: string;
|
||||
updated_at?: string;
|
||||
backend_source: string;
|
||||
icon: string;
|
||||
recommend_models: string[];
|
||||
built_in_version_configs?: Record<string, VersionConfigs>;
|
||||
framework_index_map?: Record<string, string[]>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user