chore: backend default command
This commit is contained in:
+1
-4
@@ -1,10 +1,7 @@
|
||||
{
|
||||
"*.{md,json}": ["prettier --cache --write"],
|
||||
"*.{js,jsx}": ["max lint --fix --eslint-only", "prettier --cache --write"],
|
||||
"*.{css,less}": [
|
||||
"node ./scripts/stylelint-compat.cjs --fix --allow-empty-input",
|
||||
"prettier --cache --write"
|
||||
],
|
||||
"*.{css,less}": ["prettier --cache --write"],
|
||||
"!public/vs/**": [],
|
||||
"*.ts?(x)": [
|
||||
"max lint --fix --eslint-only",
|
||||
|
||||
@@ -19,6 +19,7 @@ export default {
|
||||
'backend.mode.form': 'Form Mode',
|
||||
'backend.mode.yaml': 'YAML Mode',
|
||||
'backend.form.healthCheckPath': 'Health Check Path',
|
||||
'backend.form.defaultEntrypoint': 'Default Image Entrypoint',
|
||||
'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.defaultBackendParameters': 'Default Backend Parameters',
|
||||
|
||||
@@ -19,6 +19,7 @@ export default {
|
||||
'backend.mode.form': 'Form Mode',
|
||||
'backend.mode.yaml': 'YAML Mode',
|
||||
'backend.form.healthCheckPath': 'Health Check Path',
|
||||
'backend.form.defaultEntrypoint': 'Default Image Entrypoint',
|
||||
'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.defaultBackendParameters': 'Default Backend Parameters',
|
||||
|
||||
@@ -19,6 +19,7 @@ export default {
|
||||
'backend.mode.form': 'Режим формы',
|
||||
'backend.mode.yaml': 'Режим YAML',
|
||||
'backend.form.healthCheckPath': 'Путь проверки здоровья',
|
||||
'backend.form.defaultEntrypoint': 'Точка входа образа по умолчанию',
|
||||
'backend.form.defaultExecuteCommand': 'Команда выполнения по умолчанию',
|
||||
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}', '{{'port'}}', '{{'worker_ip'}}' и '{{'model_name'}}' заполняются реальными значениями во время запуска`,
|
||||
'backend.form.defaultBackendParameters': 'Параметры бэкенда по умолчанию',
|
||||
|
||||
@@ -19,6 +19,7 @@ export default {
|
||||
'backend.mode.form': 'Form Modu',
|
||||
'backend.mode.yaml': 'YAML Modu',
|
||||
'backend.form.healthCheckPath': 'Sağlık Kontrolü Yolu',
|
||||
'backend.form.defaultEntrypoint': 'Varsayılan İmaj Giriş Noktası',
|
||||
'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.defaultBackendParameters': 'Varsayılan Altyapı Parametreleri',
|
||||
|
||||
@@ -19,6 +19,7 @@ export default {
|
||||
'backend.mode.form': '表单模式',
|
||||
'backend.mode.yaml': 'YAML 模式',
|
||||
'backend.form.healthCheckPath': '健康检查路径',
|
||||
'backend.form.defaultEntrypoint': '默认镜像入口命令',
|
||||
'backend.form.defaultExecuteCommand': '默认执行命令',
|
||||
'backend.form.defaultExecuteCommand.tips': `'{{'model_path'}}'、'{{'port'}}'、'{{'worker_ip'}}' 和 '{{'model_name'}}' 都是占位符,在部署过程中会被替换为实际的值。`,
|
||||
'backend.form.defaultBackendParameters': '默认后端参数',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { PageAction } from '@/config';
|
||||
import { backendOptionsMap } from '@/pages/llmodels/constants/backend-parameters';
|
||||
import {
|
||||
Input as CInput,
|
||||
LabelSelector,
|
||||
@@ -12,12 +13,32 @@ import { useEffect } from 'react';
|
||||
import { BackendSourceValueMap } from '../config';
|
||||
import { useFormContext } from '../config/form-context';
|
||||
import { FormData } from '../config/types';
|
||||
import formStyles from '../styles/form.less';
|
||||
|
||||
const defaultCommand = {
|
||||
[backendOptionsMap.SGLang]: {
|
||||
defaultEntry: 'sglang serve',
|
||||
defaultCommand:
|
||||
'--model-path {{model_path}} --host {{worker_ip}} --port {{port}}'
|
||||
},
|
||||
[backendOptionsMap.vllm]: {
|
||||
defaultEntry: 'vllm serve',
|
||||
defaultCommand:
|
||||
'{{model_path}} --host {{worker_ip}} --port {{port}} --served-model-name {{model_name}}'
|
||||
}
|
||||
};
|
||||
|
||||
const BasicForm = () => {
|
||||
const form = Form.useFormInstance();
|
||||
const intl = useIntl();
|
||||
const { getRuleMessage } = useAppUtils();
|
||||
const { action, backendSource } = useFormContext();
|
||||
const backendName = Form.useWatch('backend_name', form);
|
||||
|
||||
const showBuiltinPreset =
|
||||
action === PageAction.EDIT &&
|
||||
backendSource === BackendSourceValueMap.BUILTIN &&
|
||||
!!defaultCommand[backendName];
|
||||
|
||||
useEffect(() => {
|
||||
if (action === PageAction.CREATE) {
|
||||
@@ -83,6 +104,34 @@ const BasicForm = () => {
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
{showBuiltinPreset && (
|
||||
<div className={formStyles.command}>
|
||||
<Form.Item>
|
||||
<CInput.Input
|
||||
disabled
|
||||
value={defaultCommand[backendName].defaultEntry}
|
||||
label={intl.formatMessage({
|
||||
id: 'backend.form.defaultEntrypoint'
|
||||
})}
|
||||
></CInput.Input>
|
||||
</Form.Item>
|
||||
<Form.Item>
|
||||
<SealTextArea
|
||||
scaleSize={false}
|
||||
disabled
|
||||
value={defaultCommand[backendName].defaultCommand}
|
||||
autoSize={{ minRows: 2, maxRows: 5 }}
|
||||
label={
|
||||
<span style={{ backgroundColor: 'transparent' }}>
|
||||
{intl.formatMessage({
|
||||
id: 'backend.form.defaultExecuteCommand'
|
||||
})}
|
||||
</span>
|
||||
}
|
||||
></SealTextArea>
|
||||
</Form.Item>
|
||||
</div>
|
||||
)}
|
||||
<Form.Item<FormData>
|
||||
name="default_backend_param"
|
||||
rules={[{ required: false }]}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
.command {
|
||||
:global {
|
||||
.seal-textarea-label {
|
||||
background-color: transparent;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user