chore: default_env, env

This commit is contained in:
jialin
2026-01-30 20:48:55 +08:00
committed by Lawrence Li
parent d3a0c6a330
commit 56985be26b
9 changed files with 21 additions and 21 deletions
+1 -1
View File
@@ -57,7 +57,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
'run_command', 'run_command',
'custom_framework', 'custom_framework',
'entrypoint', 'entrypoint',
'environment' 'env'
]; ];
// remove '-custom' suffix from version_no in currentData, when action is EDIT // remove '-custom' suffix from version_no in currentData, when action is EDIT
@@ -48,7 +48,7 @@ const VersionInfoModal: React.FC<VersionInfoModalProps> = ({
'image_name', 'image_name',
'run_command', 'run_command',
'entrypoint', 'entrypoint',
'environment', 'env',
'backend_source' 'backend_source'
]), ]),
is_default: key === currentData.default_version, is_default: key === currentData.default_version,
+3 -3
View File
@@ -286,18 +286,18 @@ health_check_path: /v1/models
default_backend_param: default_backend_param:
- --host - --host
default_run_command: "{{model_path}} --port {{port}} --host {{worker_ip}} --served-model-name {{model_name}}" default_run_command: "{{model_path}} --port {{port}} --host {{worker_ip}} --served-model-name {{model_name}}"
default_environment: default_env:
version_configs: version_configs:
v0.11.0: v0.11.0:
image_name: lm/vllm:latest image_name: lm/vllm:latest
run_command: "{{model_path}} --port {{port}} --host {{worker_ip}} --served-model-name {{model_name}}" run_command: "{{model_path}} --port {{port}} --host {{worker_ip}} --served-model-name {{model_name}}"
entrypoint: "/bin/sh -c" entrypoint: "/bin/sh -c"
custom_framework: cuda custom_framework: cuda
environment: env:
v0.10.0: v0.10.0:
image_name: lm/vllm:test image_name: lm/vllm:test
entrypoint: entrypoint:
run_command: run_command:
custom_framework: rocm custom_framework: rocm
environment: env:
`; `;
+2 -2
View File
@@ -30,7 +30,7 @@
"type": ["string", "null"], "type": ["string", "null"],
"description": "default start command" "description": "default start command"
}, },
"default_environment": { "default_env": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"type": "string" "type": "string"
@@ -63,7 +63,7 @@
"type": ["string", "null"], "type": ["string", "null"],
"description": "custom framework" "description": "custom framework"
}, },
"environment": { "env": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"type": "string" "type": "string"
@@ -20,7 +20,7 @@
"type": ["string", "null"], "type": ["string", "null"],
"description": "health check path" "description": "health check path"
}, },
"default_environment": { "default_env": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"type": "string" "type": "string"
@@ -49,7 +49,7 @@
"type": ["string", "null"], "type": ["string", "null"],
"description": "custom framework" "description": "custom framework"
}, },
"environment": { "env": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"type": "string" "type": "string"
@@ -24,7 +24,7 @@
"type": ["string", "null"], "type": ["string", "null"],
"description": "health check path" "description": "health check path"
}, },
"default_environment": { "default_env": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"type": "string" "type": "string"
@@ -53,7 +53,7 @@
"type": ["string", "null"], "type": ["string", "null"],
"description": "custom framework" "description": "custom framework"
}, },
"environment": { "env": {
"type": "object", "type": "object",
"additionalProperties": { "additionalProperties": {
"type": "string" "type": "string"
+2 -2
View File
@@ -8,7 +8,7 @@ export interface VersionConfigs {
version_no?: string; version_no?: string;
is_built_in?: boolean; is_built_in?: boolean;
backend_source?: string; backend_source?: string;
environment: Record<string, any>; env: Record<string, any>;
} }
export interface VersionListItem extends VersionConfigs { export interface VersionListItem extends VersionConfigs {
@@ -27,7 +27,7 @@ export interface FormData {
content?: string; content?: string;
enabled?: boolean; enabled?: boolean;
backend_source?: string; backend_source?: string;
default_environment?: Record<string, any>; default_env?: Record<string, any>;
} }
export interface ListItem extends FormData { export interface ListItem extends FormData {
+3 -3
View File
@@ -16,10 +16,10 @@ const BasicForm = () => {
const intl = useIntl(); const intl = useIntl();
const { getRuleMessage } = useAppUtils(); const { getRuleMessage } = useAppUtils();
const { action, backendSource } = useFormContext(); const { action, backendSource } = useFormContext();
const defaultEnvs = Form.useWatch('default_environment', form); const defaultEnvs = Form.useWatch('default_env', form);
const handleEnviromentVarsChange = (labels: Record<string, any>) => { const handleEnviromentVarsChange = (labels: Record<string, any>) => {
form.setFieldValue('env', labels); form.setFieldValue('default_env', labels);
}; };
useEffect(() => { useEffect(() => {
@@ -101,7 +101,7 @@ const BasicForm = () => {
})} })}
></ListInput> ></ListInput>
</Form.Item> </Form.Item>
<Form.Item<FormData> name="default_environment"> <Form.Item<FormData> name="default_env">
<LabelSelector <LabelSelector
label={intl.formatMessage({ label={intl.formatMessage({
id: 'backend.form.defaultEnvironment' id: 'backend.form.defaultEnvironment'
+5 -5
View File
@@ -79,7 +79,7 @@ const VersionsForm: React.FC<AddModalProps> = ({
entrypoint: '', entrypoint: '',
isBuiltin: false, isBuiltin: false,
is_default: false, is_default: false,
environment: {} env: {}
} }
]; ];
@@ -107,7 +107,7 @@ const VersionsForm: React.FC<AddModalProps> = ({
entrypoint: '', entrypoint: '',
isBuiltin: false, isBuiltin: false,
is_default: false, is_default: false,
environment: {} env: {}
}; };
form.setFieldValue('version_configs', [...versions, newVersion]); form.setFieldValue('version_configs', [...versions, newVersion]);
}; };
@@ -150,7 +150,7 @@ const VersionsForm: React.FC<AddModalProps> = ({
if (idx === name) { if (idx === name) {
return { return {
...version, ...version,
environment: { env: {
...envs ...envs
} }
}; };
@@ -400,12 +400,12 @@ const VersionsForm: React.FC<AddModalProps> = ({
label={intl.formatMessage({ id: 'backend.runCommand' })} label={intl.formatMessage({ id: 'backend.runCommand' })}
></SealTextArea> ></SealTextArea>
</Form.Item> </Form.Item>
<Form.Item name={[name, 'environment']}> <Form.Item name={[name, 'env']}>
<LabelSelector <LabelSelector
label={intl.formatMessage({ label={intl.formatMessage({
id: 'models.form.env' id: 'models.form.env'
})} })}
labels={versionConfigs?.[name]?.environment} labels={versionConfigs?.[name]?.env}
btnText={intl.formatMessage({ id: 'common.button.vars' })} btnText={intl.formatMessage({ id: 'common.button.vars' })}
onChange={(envs) => onChange={(envs) =>
handleEnviromentVarsChange(envs, name) handleEnviromentVarsChange(envs, name)