Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions src/pages/backends/components/add-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ const AddModal: React.FC<AddModalProps> = (props) => {
const [yamlContent, setYamlContent] = useState<string>('');
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
const genertateCurrentVersionData = (values: ListItem): ListItem => {
const data = { ...values };
Expand Down Expand Up @@ -82,10 +89,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
(acc: Record<string, any>, curr) => {
if (curr.version_no) {
acc[curr.version_no] = {
custom_framework: curr.custom_framework,
image_name: curr.image_name,
run_command: curr.run_command,
entrypoint: curr.entrypoint
..._.pick(curr, versionFields)
};
}
return acc;
Expand All @@ -111,10 +115,8 @@ const AddModal: React.FC<AddModalProps> = (props) => {
const versionConfigs = Object.keys(values.version_configs || {}).map(
(key: string) => ({
version_no: key,
image_name: values.version_configs?.[key]?.image_name,
run_command: values.version_configs?.[key]?.run_command,
custom_framework: values.version_configs?.[key]?.custom_framework,
is_default: key === values.default_version
is_default: key === values.default_version,
..._.pick(values.version_configs?.[key], versionFields)
})
);

Expand All @@ -123,12 +125,15 @@ const AddModal: React.FC<AddModalProps> = (props) => {
values.built_in_version_configs || {}
).map((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,
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 {
Expand Down
1 change: 1 addition & 0 deletions src/pages/backends/components/version-info-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const VersionInfoModal: React.FC<VersionInfoModalProps> = ({
version_no: key,
image_name: value.image_name,
run_command: value.run_command,
entrypoint: value.entrypoint,
is_default: key === currentData.default_version,
availableFrameworks: [
...(value.built_in_frameworks || []),
Expand Down
3 changes: 3 additions & 0 deletions src/pages/backends/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ export const yamlTemplate = `# ----------------------------------------
# version_configs:
# - image_name: required
# - run_command: optional
# - entrypoint: optional
# - custom_framework:
# - optional
# - choose from: ${Object.values(GPUDriverMap).join(', ')}, CPU
Expand All @@ -214,9 +215,11 @@ version_configs:
v0.11.0:
image_name: lm/vllm:latest
run_command: vllm serve {{model_path}} --port {{port}} --host {{worker_ip}} --served-model-name {{model_name}}
entrypoint: "/bin/sh -c"
custom_framework: cuda
v0.10.0:
image_name: lm/vllm:test
entrypoint:
run_command:
custom_framework:
`;
8 changes: 8 additions & 0 deletions src/pages/backends/config/schema/create.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
"type": ["string", "null"],
"description": "start command"
},
"entrypoint": {
"type": "string",
"description": "Override the default ENTRYPOINT of the image"
},
"custom_framework": {
"type": ["string", "null"],
"description": "custom framework"
Expand All @@ -74,6 +78,10 @@
"type": ["string", "null"],
"description": "start command"
},
"entrypoint": {
"type": "string",
"description": "Override the default ENTRYPOINT of the image"
},
"custom_framework": {
"type": ["string", "null"],
"description": "custom framework"
Expand Down
4 changes: 4 additions & 0 deletions src/pages/backends/config/schema/update-builtin.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
"type": ["string", "null"],
"description": "start command"
},
"entrypoint": {
"type": "string",
"description": "Override the default ENTRYPOINT of the image"
},
"custom_framework": {
"type": ["string", "null"],
"description": "custom framework"
Expand Down
4 changes: 4 additions & 0 deletions src/pages/backends/config/schema/update-custom.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
"type": ["string", "null"],
"description": "start command"
},
"entrypoint": {
"type": "string",
"description": "Override the default ENTRYPOINT of the image"
},
"custom_framework": {
"type": ["string", "null"],
"description": "custom framework"
Expand Down
10 changes: 10 additions & 0 deletions src/pages/backends/forms/version-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ export const VersionItem: React.FC<VersionItemProps> = ({ data }) => {
</AutoTooltip>
</InfoItem>
)}
{data.entrypoint && (
<InfoItem>
<span className="label">
{intl.formatMessage({ id: 'backend.replaceEntrypoint' })}:
</span>
<AutoTooltip ghost minWidth={20}>
{data.entrypoint}
</AutoTooltip>
</InfoItem>
)}
{data.run_command && (
<InfoItem>
<span className="label">
Expand Down
2 changes: 2 additions & 0 deletions src/pages/backends/forms/versions-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const VersionsForm: React.FC<AddModalProps> = ({
version_no: '',
image_name: '',
run_command: '',
entrypoint: '',
isBuiltin: false,
is_default: false
}
Expand All @@ -99,6 +100,7 @@ const VersionsForm: React.FC<AddModalProps> = ({
version_no: '',
image_name: '',
run_command: '',
entrypoint: '',
isBuiltin: false,
is_default: false
};
Expand Down