fix: entrypoint do not display in edit

This commit is contained in:
jialin
2025-12-19 15:00:10 +08:00
parent ad048a92ed
commit bb793a41fc
8 changed files with 48 additions and 11 deletions
+16 -11
View File
@@ -51,6 +51,13 @@ const AddModal: React.FC<AddModalProps> = (props) => {
const [yamlContent, setYamlContent] = useState<string>(''); const [yamlContent, setYamlContent] = useState<string>('');
const [formContent, setFormContent] = useState<FormData>({} as FormData); const [formContent, setFormContent] = useState<FormData>({} as FormData);
const versionFields = [
'image_name',
'run_command',
'custom_framework',
'entrypoint'
];
// remove '-custom' suffix from version_no in currentData, when action is EDIT // remove '-custom' suffix from version_no in currentData, when action is EDIT
const genertateCurrentVersionData = (values: ListItem): ListItem => { const genertateCurrentVersionData = (values: ListItem): ListItem => {
const data = { ...values }; const data = { ...values };
@@ -82,10 +89,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
(acc: Record<string, any>, curr) => { (acc: Record<string, any>, curr) => {
if (curr.version_no) { if (curr.version_no) {
acc[curr.version_no] = { acc[curr.version_no] = {
custom_framework: curr.custom_framework, ..._.pick(curr, versionFields)
image_name: curr.image_name,
run_command: curr.run_command,
entrypoint: curr.entrypoint
}; };
} }
return acc; return acc;
@@ -111,10 +115,8 @@ const AddModal: React.FC<AddModalProps> = (props) => {
const versionConfigs = Object.keys(values.version_configs || {}).map( const versionConfigs = Object.keys(values.version_configs || {}).map(
(key: string) => ({ (key: string) => ({
version_no: key, version_no: key,
image_name: values.version_configs?.[key]?.image_name, is_default: key === values.default_version,
run_command: values.version_configs?.[key]?.run_command, ..._.pick(values.version_configs?.[key], versionFields)
custom_framework: values.version_configs?.[key]?.custom_framework,
is_default: key === values.default_version
}) })
); );
@@ -123,12 +125,15 @@ const AddModal: React.FC<AddModalProps> = (props) => {
values.built_in_version_configs || {} values.built_in_version_configs || {}
).map((key) => ({ ).map((key) => ({
version_no: key, version_no: key,
image_name: values.built_in_version_configs?.[key]?.image_name,
run_command: values.built_in_version_configs?.[key]?.run_command,
is_default: key === values.default_version, is_default: key === values.default_version,
built_in_frameworks: built_in_frameworks:
values.built_in_version_configs?.[key]?.built_in_frameworks || [], values.built_in_version_configs?.[key]?.built_in_frameworks || [],
is_built_in: true is_built_in: true,
..._.pick(values.built_in_version_configs?.[key], [
'image_name',
'run_command',
'entrypoint'
])
})); }));
return { return {
@@ -43,6 +43,7 @@ const VersionInfoModal: React.FC<VersionInfoModalProps> = ({
version_no: key, version_no: key,
image_name: value.image_name, image_name: value.image_name,
run_command: value.run_command, run_command: value.run_command,
entrypoint: value.entrypoint,
is_default: key === currentData.default_version, is_default: key === currentData.default_version,
availableFrameworks: [ availableFrameworks: [
...(value.built_in_frameworks || []), ...(value.built_in_frameworks || []),
+3
View File
@@ -199,6 +199,7 @@ export const yamlTemplate = `# ----------------------------------------
# version_configs: # version_configs:
# - image_name: required # - image_name: required
# - run_command: optional # - run_command: optional
# - entrypoint: optional
# - custom_framework: # - custom_framework:
# - optional # - optional
# - choose from: ${Object.values(GPUDriverMap).join(', ')}, CPU # - choose from: ${Object.values(GPUDriverMap).join(', ')}, CPU
@@ -214,9 +215,11 @@ version_configs:
v0.11.0: v0.11.0:
image_name: lm/vllm:latest image_name: lm/vllm:latest
run_command: vllm serve {{model_path}} --port {{port}} --host {{worker_ip}} --served-model-name {{model_name}} run_command: vllm serve {{model_path}} --port {{port}} --host {{worker_ip}} --served-model-name {{model_name}}
entrypoint: "/bin/sh -c"
custom_framework: cuda custom_framework: cuda
v0.10.0: v0.10.0:
image_name: lm/vllm:test image_name: lm/vllm:test
entrypoint:
run_command: run_command:
custom_framework: custom_framework:
`; `;
@@ -48,6 +48,10 @@
"type": ["string", "null"], "type": ["string", "null"],
"description": "start command" "description": "start command"
}, },
"entrypoint": {
"type": "string",
"description": "Override the default ENTRYPOINT of the image"
},
"custom_framework": { "custom_framework": {
"type": ["string", "null"], "type": ["string", "null"],
"description": "custom framework" "description": "custom framework"
@@ -74,6 +78,10 @@
"type": ["string", "null"], "type": ["string", "null"],
"description": "start command" "description": "start command"
}, },
"entrypoint": {
"type": "string",
"description": "Override the default ENTRYPOINT of the image"
},
"custom_framework": { "custom_framework": {
"type": ["string", "null"], "type": ["string", "null"],
"description": "custom framework" "description": "custom framework"
@@ -34,6 +34,10 @@
"type": ["string", "null"], "type": ["string", "null"],
"description": "start command" "description": "start command"
}, },
"entrypoint": {
"type": "string",
"description": "Override the default ENTRYPOINT of the image"
},
"custom_framework": { "custom_framework": {
"type": ["string", "null"], "type": ["string", "null"],
"description": "custom framework" "description": "custom framework"
@@ -38,6 +38,10 @@
"type": ["string", "null"], "type": ["string", "null"],
"description": "start command" "description": "start command"
}, },
"entrypoint": {
"type": "string",
"description": "Override the default ENTRYPOINT of the image"
},
"custom_framework": { "custom_framework": {
"type": ["string", "null"], "type": ["string", "null"],
"description": "custom framework" "description": "custom framework"
+10
View File
@@ -112,6 +112,16 @@ export const VersionItem: React.FC<VersionItemProps> = ({ data }) => {
</AutoTooltip> </AutoTooltip>
</InfoItem> </InfoItem>
)} )}
{data.entrypoint && (
<InfoItem>
<span className="label">
{intl.formatMessage({ id: 'backend.replaceEntrypoint' })}:
</span>
<AutoTooltip ghost minWidth={20}>
{data.entrypoint}
</AutoTooltip>
</InfoItem>
)}
{data.run_command && ( {data.run_command && (
<InfoItem> <InfoItem>
<span className="label"> <span className="label">
@@ -73,6 +73,7 @@ const VersionsForm: React.FC<AddModalProps> = ({
version_no: '', version_no: '',
image_name: '', image_name: '',
run_command: '', run_command: '',
entrypoint: '',
isBuiltin: false, isBuiltin: false,
is_default: false is_default: false
} }
@@ -99,6 +100,7 @@ const VersionsForm: React.FC<AddModalProps> = ({
version_no: '', version_no: '',
image_name: '', image_name: '',
run_command: '', run_command: '',
entrypoint: '',
isBuiltin: false, isBuiltin: false,
is_default: false is_default: false
}; };