feat: yaml editor

This commit is contained in:
jialin
2025-10-13 14:40:26 +08:00
parent e863b84016
commit 54703c67c1
48 changed files with 2062 additions and 246 deletions
+21 -3
View File
@@ -5,21 +5,21 @@ export const backendActions = [
label: 'Edit Versions',
value: 'version',
key: 'version',
icon: icons.EditOutlined,
icon: icons.EditContent,
locale: false
},
{
label: 'Edit Parameters',
value: 'parameter',
key: 'parameter',
icon: icons.EditOutlined,
icon: icons.Parameter,
locale: false
},
{
label: 'Edit by Yaml',
value: 'yaml',
key: 'edit',
icon: icons.EditOutlined,
icon: icons.Yaml,
locale: false
},
{
@@ -31,3 +31,21 @@ export const backendActions = [
danger: true
}
];
export const yamlTemplate = `
name: SGLang
default_version: v0.5.1
health_check_path: /health
allowed_proxy_uris:
- api/chat
- api/v1
versions:
v0.0.1:
image: lm/sglang
command: run sglang
v0.0.2:
image: lm/sglang
command: run sglang
default_backend_parameters:
- --host
`;
+56
View File
@@ -0,0 +1,56 @@
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "backend name",
"severity": "error"
},
"default_version": {
"type": "string",
"description": "default backend version"
},
"health_check_path": {
"type": "string",
"description": "health check path"
},
"allowed_proxy_uris": {
"type": "array",
"items": {
"type": "string"
},
"description": "allowed proxy URIs"
},
"versions": {
"type": "object",
"patternProperties": {
"^[a-zA-Z0-9._-]+$": {
"type": "object",
"properties": {
"image": {
"type": "string",
"description": "image name"
},
"command": {
"type": "string",
"description": "start command"
}
},
"required": ["image", "command"],
"additionalProperties": false
}
},
"additionalProperties": false,
"description": "multiple backend versions"
},
"default_backend_parameters": {
"type": "array",
"items": {
"type": "string"
},
"description": "default backend parameters"
}
},
"required": ["name", "default_version", "health_check_path", "versions"],
"additionalProperties": false
}
+4 -4
View File
@@ -1,4 +1,4 @@
import nvidiaLogo from '@/assets/logo/nvidia.png';
import lmDeployLogo from '@/assets/logo/lmdeploy.png';
import SGLangLogo from '@/assets/logo/sglang.png';
import vLLMLogo from '@/assets/logo/vllm.png';
@@ -37,8 +37,8 @@ export default [
},
{
id: 3,
backend_name: 'TensorRT',
icon: nvidiaLogo,
backend_name: 'LMDeploy',
icon: lmDeployLogo,
version_configs: {
'v1.0': {
image_name: 'example/image:v1.0',
@@ -49,6 +49,6 @@ export default [
health_check_path: '/v1/models',
default_version: 'v1.0',
default_backend_param: ['--param1', '--param2'],
description: 'TensorRT description'
description: 'LMDeploy description'
}
];
+5 -4
View File
@@ -6,7 +6,7 @@ export interface VersionConfigs {
}
export interface FormData {
backend_name: string;
backend_name?: string;
description?: string;
version_configs?: VersionConfigs;
compatibility_type?: string;
@@ -14,10 +14,11 @@ export interface FormData {
default_version?: string;
default_backend_param?: string[];
allowed_proxy_uris?: string[];
content?: string;
}
export interface ListItem extends FormData {
id: number;
created_at: string;
updated_at: string;
id?: number;
created_at?: string;
updated_at?: string;
}