feat: add parameter format and common parameters to backend configuration
This commit is contained in:
@@ -23,6 +23,13 @@ export default {
|
|||||||
'backend.form.defaultExecuteCommand': 'Default Execution Command',
|
'backend.form.defaultExecuteCommand': 'Default Execution Command',
|
||||||
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}', '{{'port'}}', '{{'worker_ip'}}' and '{{'model_name'}}' are placeholders that will be substituted with the actual values during deployment.`,
|
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}', '{{'port'}}', '{{'worker_ip'}}' and '{{'model_name'}}' are placeholders that will be substituted with the actual values during deployment.`,
|
||||||
'backend.form.defaultBackendParameters': 'Default Backend Parameters',
|
'backend.form.defaultBackendParameters': 'Default Backend Parameters',
|
||||||
|
'backend.form.parameterFormat': 'Parameter Format',
|
||||||
|
'backend.form.parameterFormat.default': 'Backend Default',
|
||||||
|
'backend.form.parameterFormat.space': 'Space (--key value)',
|
||||||
|
'backend.form.parameterFormat.equal': 'Equal (--key=value)',
|
||||||
|
'backend.form.commonParameters': 'Common Parameters',
|
||||||
|
'backend.form.commonParameters.tips':
|
||||||
|
'Shown as suggestions in the backend parameters input during deployment.',
|
||||||
'backend.form.versionConfig': 'Versions Config',
|
'backend.form.versionConfig': 'Versions Config',
|
||||||
'backend.form.addParameter': 'Add Parameter',
|
'backend.form.addParameter': 'Add Parameter',
|
||||||
'backend.form.noVersion': 'No versions added',
|
'backend.form.noVersion': 'No versions added',
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ export default {
|
|||||||
'backend.form.defaultExecuteCommand': 'Default Execution Command',
|
'backend.form.defaultExecuteCommand': 'Default Execution Command',
|
||||||
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}', '{{'port'}}', '{{'worker_ip'}}' and '{{'model_name'}}' are placeholders that will be substituted with the actual values during deployment.`,
|
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}', '{{'port'}}', '{{'worker_ip'}}' and '{{'model_name'}}' are placeholders that will be substituted with the actual values during deployment.`,
|
||||||
'backend.form.defaultBackendParameters': 'Default Backend Parameters',
|
'backend.form.defaultBackendParameters': 'Default Backend Parameters',
|
||||||
|
'backend.form.parameterFormat': 'パラメータ形式',
|
||||||
|
'backend.form.parameterFormat.default': 'バックエンドのデフォルト',
|
||||||
|
'backend.form.parameterFormat.space': 'スペース区切り (--key value)',
|
||||||
|
'backend.form.parameterFormat.equal': 'イコール連結 (--key=value)',
|
||||||
|
'backend.form.commonParameters': 'よく使うパラメータ',
|
||||||
|
'backend.form.commonParameters.tips':
|
||||||
|
'モデルのデプロイ時にバックエンドパラメータ入力欄の候補として表示されます。',
|
||||||
'backend.form.versionConfig': 'Versions Config',
|
'backend.form.versionConfig': 'Versions Config',
|
||||||
'backend.form.addParameter': 'Add Parameter',
|
'backend.form.addParameter': 'Add Parameter',
|
||||||
'backend.form.noVersion': 'No versions added',
|
'backend.form.noVersion': 'No versions added',
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ export default {
|
|||||||
'backend.form.defaultExecuteCommand': 'Команда выполнения по умолчанию',
|
'backend.form.defaultExecuteCommand': 'Команда выполнения по умолчанию',
|
||||||
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}', '{{'port'}}', '{{'worker_ip'}}' и '{{'model_name'}}' заполняются реальными значениями во время запуска`,
|
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}', '{{'port'}}', '{{'worker_ip'}}' и '{{'model_name'}}' заполняются реальными значениями во время запуска`,
|
||||||
'backend.form.defaultBackendParameters': 'Параметры бэкенда по умолчанию',
|
'backend.form.defaultBackendParameters': 'Параметры бэкенда по умолчанию',
|
||||||
|
'backend.form.parameterFormat': 'Формат параметров',
|
||||||
|
'backend.form.parameterFormat.default': 'По умолчанию бэкенда',
|
||||||
|
'backend.form.parameterFormat.space': 'Пробел (--key value)',
|
||||||
|
'backend.form.parameterFormat.equal': 'Знак равенства (--key=value)',
|
||||||
|
'backend.form.commonParameters': 'Часто используемые параметры',
|
||||||
|
'backend.form.commonParameters.tips':
|
||||||
|
'Отображаются как подсказки в поле параметров бэкенда при развёртывании.',
|
||||||
'backend.form.versionConfig': 'Конфигурация версий',
|
'backend.form.versionConfig': 'Конфигурация версий',
|
||||||
'backend.form.addParameter': 'Добавить параметр',
|
'backend.form.addParameter': 'Добавить параметр',
|
||||||
'backend.form.noVersion': 'Версии не добавлены',
|
'backend.form.noVersion': 'Версии не добавлены',
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ export default {
|
|||||||
'backend.form.defaultExecuteCommand': 'Varsayılan Çalıştırma Komutu',
|
'backend.form.defaultExecuteCommand': 'Varsayılan Çalıştırma Komutu',
|
||||||
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}', '{{'port'}}', '{{'worker_ip'}}' ve '{{'model_name'}}' dağıtım sırasında gerçek değerlerle değiştirilecek yer tutuculardır.`,
|
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}', '{{'port'}}', '{{'worker_ip'}}' ve '{{'model_name'}}' dağıtım sırasında gerçek değerlerle değiştirilecek yer tutuculardır.`,
|
||||||
'backend.form.defaultBackendParameters': 'Varsayılan Altyapı Parametreleri',
|
'backend.form.defaultBackendParameters': 'Varsayılan Altyapı Parametreleri',
|
||||||
|
'backend.form.parameterFormat': 'Parametre Biçimi',
|
||||||
|
'backend.form.parameterFormat.default': 'Varsayılan',
|
||||||
|
'backend.form.parameterFormat.space': 'Boşluk (--key value)',
|
||||||
|
'backend.form.parameterFormat.equal': 'Eşittir (--key=value)',
|
||||||
|
'backend.form.commonParameters': 'Yaygın Parametreler',
|
||||||
|
'backend.form.commonParameters.tips':
|
||||||
|
'Dağıtım sırasında altyapı parametreleri girişinde öneri olarak gösterilir.',
|
||||||
'backend.form.versionConfig': 'Sürüm Yapılandırması',
|
'backend.form.versionConfig': 'Sürüm Yapılandırması',
|
||||||
'backend.form.addParameter': 'Parametre Ekle',
|
'backend.form.addParameter': 'Parametre Ekle',
|
||||||
'backend.form.noVersion': 'Sürüm eklenmedi',
|
'backend.form.noVersion': 'Sürüm eklenmedi',
|
||||||
|
|||||||
@@ -23,6 +23,12 @@ export default {
|
|||||||
'backend.form.defaultExecuteCommand': '默认执行命令',
|
'backend.form.defaultExecuteCommand': '默认执行命令',
|
||||||
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}'、'{{'port'}}'、'{{'worker_ip'}}' 和 '{{'model_name'}}' 都是占位符,在部署过程中会被替换为实际的值。`,
|
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}'、'{{'port'}}'、'{{'worker_ip'}}' 和 '{{'model_name'}}' 都是占位符,在部署过程中会被替换为实际的值。`,
|
||||||
'backend.form.defaultBackendParameters': '默认后端参数',
|
'backend.form.defaultBackendParameters': '默认后端参数',
|
||||||
|
'backend.form.parameterFormat': '参数输出格式',
|
||||||
|
'backend.form.parameterFormat.default': '后端默认',
|
||||||
|
'backend.form.parameterFormat.space': '空格分隔 (--key value)',
|
||||||
|
'backend.form.parameterFormat.equal': '等号连接 (--key=value)',
|
||||||
|
'backend.form.commonParameters': '常用参数',
|
||||||
|
'backend.form.commonParameters.tips': '部署模型时作为后端参数候选项展示。',
|
||||||
'backend.form.versionConfig': '版本配置',
|
'backend.form.versionConfig': '版本配置',
|
||||||
'backend.form.addParameter': '添加参数',
|
'backend.form.addParameter': '添加参数',
|
||||||
'backend.form.noVersion': '未添加版本',
|
'backend.form.noVersion': '未添加版本',
|
||||||
|
|||||||
@@ -119,6 +119,10 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
|
|
||||||
onSubmit({
|
onSubmit({
|
||||||
...values,
|
...values,
|
||||||
|
parameter_format:
|
||||||
|
values.parameter_format === 'auto' || !values.parameter_format
|
||||||
|
? null
|
||||||
|
: values.parameter_format,
|
||||||
default_version: defaultVersion?.version_no || '',
|
default_version: defaultVersion?.version_no || '',
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
version_configs: versionConfigs
|
version_configs: versionConfigs
|
||||||
@@ -155,6 +159,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
return {
|
return {
|
||||||
...values,
|
...values,
|
||||||
backend_name: values.backend_name.replace(/-custom$/, ''),
|
backend_name: values.backend_name.replace(/-custom$/, ''),
|
||||||
|
parameter_format: values.parameter_format ?? 'auto',
|
||||||
version_configs: versionConfigs,
|
version_configs: versionConfigs,
|
||||||
built_in_version_configs: builtInVersions
|
built_in_version_configs: builtInVersions
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -198,6 +198,8 @@ export const customBackendFields = [
|
|||||||
'default_run_command',
|
'default_run_command',
|
||||||
'version_configs',
|
'version_configs',
|
||||||
'default_backend_param',
|
'default_backend_param',
|
||||||
|
'parameter_format',
|
||||||
|
'common_parameters',
|
||||||
'default_env'
|
'default_env'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -208,6 +210,8 @@ export const builtInBackendFields = [
|
|||||||
'description',
|
'description',
|
||||||
'version_configs',
|
'version_configs',
|
||||||
'default_backend_param',
|
'default_backend_param',
|
||||||
|
'parameter_format',
|
||||||
|
'common_parameters',
|
||||||
'default_env'
|
'default_env'
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -293,6 +297,10 @@ default_version: v0.11.0
|
|||||||
health_check_path: /v1/models
|
health_check_path: /v1/models
|
||||||
default_backend_param:
|
default_backend_param:
|
||||||
- --host
|
- --host
|
||||||
|
parameter_format: space
|
||||||
|
common_parameters:
|
||||||
|
- --max-model-len
|
||||||
|
- --gpu-memory-utilization
|
||||||
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_env:
|
default_env:
|
||||||
version_configs:
|
version_configs:
|
||||||
|
|||||||
@@ -26,6 +26,18 @@
|
|||||||
},
|
},
|
||||||
"description": "default backend parameter"
|
"description": "default backend parameter"
|
||||||
},
|
},
|
||||||
|
"parameter_format": {
|
||||||
|
"type": ["string", "null"],
|
||||||
|
"enum": ["space", "equal", null],
|
||||||
|
"description": "parameter output format: 'space' -> --key value, 'equal' -> --key=value"
|
||||||
|
},
|
||||||
|
"common_parameters": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": "commonly used parameters shown as hints in deployment UI"
|
||||||
|
},
|
||||||
"default_run_command": {
|
"default_run_command": {
|
||||||
"type": ["string", "null"],
|
"type": ["string", "null"],
|
||||||
"description": "default start command"
|
"description": "default start command"
|
||||||
|
|||||||
@@ -12,6 +12,18 @@
|
|||||||
},
|
},
|
||||||
"description": "default backend parameter"
|
"description": "default backend parameter"
|
||||||
},
|
},
|
||||||
|
"parameter_format": {
|
||||||
|
"type": ["string", "null"],
|
||||||
|
"enum": ["space", "equal", null],
|
||||||
|
"description": "parameter output format: 'space' -> --key value, 'equal' -> --key=value"
|
||||||
|
},
|
||||||
|
"common_parameters": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": "commonly used parameters shown as hints in deployment UI"
|
||||||
|
},
|
||||||
"default_run_command": {
|
"default_run_command": {
|
||||||
"type": ["string", "null"],
|
"type": ["string", "null"],
|
||||||
"description": "default start command"
|
"description": "default start command"
|
||||||
|
|||||||
@@ -16,6 +16,18 @@
|
|||||||
},
|
},
|
||||||
"description": "default backend parameter"
|
"description": "default backend parameter"
|
||||||
},
|
},
|
||||||
|
"parameter_format": {
|
||||||
|
"type": ["string", "null"],
|
||||||
|
"enum": ["space", "equal", null],
|
||||||
|
"description": "parameter output format: 'space' -> --key value, 'equal' -> --key=value"
|
||||||
|
},
|
||||||
|
"common_parameters": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": "commonly used parameters shown as hints in deployment UI"
|
||||||
|
},
|
||||||
"default_run_command": {
|
"default_run_command": {
|
||||||
"type": ["string", "null"],
|
"type": ["string", "null"],
|
||||||
"description": "default start command"
|
"description": "default start command"
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ export interface FormData {
|
|||||||
enabled?: boolean;
|
enabled?: boolean;
|
||||||
backend_source?: string;
|
backend_source?: string;
|
||||||
default_env?: Record<string, any>;
|
default_env?: Record<string, any>;
|
||||||
|
parameter_format?: 'space' | 'equal' | 'auto' | null;
|
||||||
|
common_parameters?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ListItem extends FormData {
|
export interface ListItem extends FormData {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import {
|
|||||||
Input as CInput,
|
Input as CInput,
|
||||||
LabelSelector,
|
LabelSelector,
|
||||||
ListInput,
|
ListInput,
|
||||||
|
Select as SealSelect,
|
||||||
Textarea as SealTextArea,
|
Textarea as SealTextArea,
|
||||||
useAppUtils
|
useAppUtils
|
||||||
} from '@gpustack/core-ui';
|
} from '@gpustack/core-ui';
|
||||||
@@ -148,6 +149,46 @@ const BasicForm = () => {
|
|||||||
})}
|
})}
|
||||||
></ListInput>
|
></ListInput>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
<Form.Item<FormData>
|
||||||
|
name="parameter_format"
|
||||||
|
initialValue="auto"
|
||||||
|
rules={[{ required: false }]}
|
||||||
|
>
|
||||||
|
<SealSelect
|
||||||
|
label={intl.formatMessage({ id: 'backend.form.parameterFormat' })}
|
||||||
|
options={[
|
||||||
|
{
|
||||||
|
label: intl.formatMessage({
|
||||||
|
id: 'backend.form.parameterFormat.default'
|
||||||
|
}),
|
||||||
|
value: 'auto'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: intl.formatMessage({
|
||||||
|
id: 'backend.form.parameterFormat.space'
|
||||||
|
}),
|
||||||
|
value: 'space'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: intl.formatMessage({
|
||||||
|
id: 'backend.form.parameterFormat.equal'
|
||||||
|
}),
|
||||||
|
value: 'equal'
|
||||||
|
}
|
||||||
|
]}
|
||||||
|
></SealSelect>
|
||||||
|
</Form.Item>
|
||||||
|
<Form.Item<FormData>
|
||||||
|
name="common_parameters"
|
||||||
|
rules={[{ required: false }]}
|
||||||
|
>
|
||||||
|
<ListInput
|
||||||
|
btnText={intl.formatMessage({ id: 'backend.form.addParameter' })}
|
||||||
|
label={intl.formatMessage({
|
||||||
|
id: 'backend.form.commonParameters'
|
||||||
|
})}
|
||||||
|
></ListInput>
|
||||||
|
</Form.Item>
|
||||||
<Form.Item<FormData> name="default_env">
|
<Form.Item<FormData> name="default_env">
|
||||||
<LabelSelector
|
<LabelSelector
|
||||||
label={intl.formatMessage({
|
label={intl.formatMessage({
|
||||||
|
|||||||
@@ -344,6 +344,8 @@ export interface BackendGroupItem {
|
|||||||
isBuiltIn: boolean;
|
isBuiltIn: boolean;
|
||||||
backend_source: string;
|
backend_source: string;
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
|
common_parameters?: string[];
|
||||||
|
parameter_format?: 'space' | 'equal' | null;
|
||||||
versions: {
|
versions: {
|
||||||
label: string;
|
label: string;
|
||||||
value: string;
|
value: string;
|
||||||
@@ -363,6 +365,8 @@ export interface BackendOption {
|
|||||||
backend_source: string;
|
backend_source: string;
|
||||||
default_env?: Record<string, any>;
|
default_env?: Record<string, any>;
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
|
common_parameters?: string[];
|
||||||
|
parameter_format?: 'space' | 'equal' | null;
|
||||||
versions: {
|
versions: {
|
||||||
label: string;
|
label: string;
|
||||||
value: string;
|
value: string;
|
||||||
@@ -387,6 +391,8 @@ export interface BackendItem {
|
|||||||
is_built_in: boolean;
|
is_built_in: boolean;
|
||||||
backend_source: string;
|
backend_source: string;
|
||||||
enabled: boolean;
|
enabled: boolean;
|
||||||
|
common_parameters?: string[];
|
||||||
|
parameter_format?: 'space' | 'equal' | null;
|
||||||
versions: {
|
versions: {
|
||||||
version: string;
|
version: string;
|
||||||
env?: Record<string, any>;
|
env?: Record<string, any>;
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import BackendParameters, {
|
|||||||
|
|
||||||
const BackendParametersList: React.FC = () => {
|
const BackendParametersList: React.FC = () => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const { onValuesChange } = useFormContext();
|
const { onValuesChange, flatBackendOptions } = useFormContext();
|
||||||
const form = Form.useFormInstance();
|
const form = Form.useFormInstance();
|
||||||
const backend = Form.useWatch('backend', form);
|
const backend = Form.useWatch('backend', form);
|
||||||
|
|
||||||
@@ -21,8 +21,18 @@ const BackendParametersList: React.FC = () => {
|
|||||||
}, [backend]);
|
}, [backend]);
|
||||||
|
|
||||||
const paramsConfig = useMemo(() => {
|
const paramsConfig = useMemo(() => {
|
||||||
return _.get(BackendParameters, backend, []);
|
const builtIn = _.get(BackendParameters, backend, []) as Array<{
|
||||||
}, [backend]);
|
label: string;
|
||||||
|
value: string;
|
||||||
|
opts?: { label: any; value: any }[];
|
||||||
|
}>;
|
||||||
|
const selected = flatBackendOptions?.find((o) => o.value === backend);
|
||||||
|
const extra = (selected?.common_parameters || []).map((v) => ({
|
||||||
|
label: v,
|
||||||
|
value: v
|
||||||
|
}));
|
||||||
|
return _.uniqBy([...extra, ...builtIn], 'value');
|
||||||
|
}, [backend, flatBackendOptions]);
|
||||||
|
|
||||||
const handleBackendParametersOnBlur = () => {
|
const handleBackendParametersOnBlur = () => {
|
||||||
onValuesChange?.({}, form.getFieldsValue());
|
onValuesChange?.({}, form.getFieldsValue());
|
||||||
|
|||||||
@@ -63,7 +63,9 @@ export default function useQueryBackends() {
|
|||||||
'backend_source',
|
'backend_source',
|
||||||
'is_built_in',
|
'is_built_in',
|
||||||
'default_backend_param',
|
'default_backend_param',
|
||||||
'default_env'
|
'default_env',
|
||||||
|
'common_parameters',
|
||||||
|
'parameter_format'
|
||||||
]),
|
]),
|
||||||
backend_source: item.backend_source || BackendSourceValueMap.CUSTOM,
|
backend_source: item.backend_source || BackendSourceValueMap.CUSTOM,
|
||||||
value: item.backend_name,
|
value: item.backend_name,
|
||||||
|
|||||||
Reference in New Issue
Block a user