chore: backend default command

This commit is contained in:
jialin
2026-05-07 18:26:48 +08:00
committed by jialin
parent e1b28b01df
commit a2d5d55518
8 changed files with 62 additions and 4 deletions
+1 -4
View File
@@ -1,10 +1,7 @@
{ {
"*.{md,json}": ["prettier --cache --write"], "*.{md,json}": ["prettier --cache --write"],
"*.{js,jsx}": ["max lint --fix --eslint-only", "prettier --cache --write"], "*.{js,jsx}": ["max lint --fix --eslint-only", "prettier --cache --write"],
"*.{css,less}": [ "*.{css,less}": ["prettier --cache --write"],
"node ./scripts/stylelint-compat.cjs --fix --allow-empty-input",
"prettier --cache --write"
],
"!public/vs/**": [], "!public/vs/**": [],
"*.ts?(x)": [ "*.ts?(x)": [
"max lint --fix --eslint-only", "max lint --fix --eslint-only",
+1
View File
@@ -19,6 +19,7 @@ export default {
'backend.mode.form': 'Form Mode', 'backend.mode.form': 'Form Mode',
'backend.mode.yaml': 'YAML Mode', 'backend.mode.yaml': 'YAML Mode',
'backend.form.healthCheckPath': 'Health Check Path', 'backend.form.healthCheckPath': 'Health Check Path',
'backend.form.defaultEntrypoint': 'Default Image Entrypoint',
'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',
+1
View File
@@ -19,6 +19,7 @@ export default {
'backend.mode.form': 'Form Mode', 'backend.mode.form': 'Form Mode',
'backend.mode.yaml': 'YAML Mode', 'backend.mode.yaml': 'YAML Mode',
'backend.form.healthCheckPath': 'Health Check Path', 'backend.form.healthCheckPath': 'Health Check Path',
'backend.form.defaultEntrypoint': 'Default Image Entrypoint',
'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',
+1
View File
@@ -19,6 +19,7 @@ export default {
'backend.mode.form': 'Режим формы', 'backend.mode.form': 'Режим формы',
'backend.mode.yaml': 'Режим YAML', 'backend.mode.yaml': 'Режим YAML',
'backend.form.healthCheckPath': 'Путь проверки здоровья', 'backend.form.healthCheckPath': 'Путь проверки здоровья',
'backend.form.defaultEntrypoint': 'Точка входа образа по умолчанию',
'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': 'Параметры бэкенда по умолчанию',
+1
View File
@@ -19,6 +19,7 @@ export default {
'backend.mode.form': 'Form Modu', 'backend.mode.form': 'Form Modu',
'backend.mode.yaml': 'YAML Modu', 'backend.mode.yaml': 'YAML Modu',
'backend.form.healthCheckPath': 'Sağlık Kontrolü Yolu', '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': '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',
+1
View File
@@ -19,6 +19,7 @@ export default {
'backend.mode.form': '表单模式', 'backend.mode.form': '表单模式',
'backend.mode.yaml': 'YAML 模式', 'backend.mode.yaml': 'YAML 模式',
'backend.form.healthCheckPath': '健康检查路径', 'backend.form.healthCheckPath': '健康检查路径',
'backend.form.defaultEntrypoint': '默认镜像入口命令',
'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': '默认后端参数',
+49
View File
@@ -1,4 +1,5 @@
import { PageAction } from '@/config'; import { PageAction } from '@/config';
import { backendOptionsMap } from '@/pages/llmodels/constants/backend-parameters';
import { import {
Input as CInput, Input as CInput,
LabelSelector, LabelSelector,
@@ -12,12 +13,32 @@ import { useEffect } from 'react';
import { BackendSourceValueMap } from '../config'; import { BackendSourceValueMap } from '../config';
import { useFormContext } from '../config/form-context'; import { useFormContext } from '../config/form-context';
import { FormData } from '../config/types'; 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 BasicForm = () => {
const form = Form.useFormInstance(); const form = Form.useFormInstance();
const intl = useIntl(); const intl = useIntl();
const { getRuleMessage } = useAppUtils(); const { getRuleMessage } = useAppUtils();
const { action, backendSource } = useFormContext(); const { action, backendSource } = useFormContext();
const backendName = Form.useWatch('backend_name', form);
const showBuiltinPreset =
action === PageAction.EDIT &&
backendSource === BackendSourceValueMap.BUILTIN &&
!!defaultCommand[backendName];
useEffect(() => { useEffect(() => {
if (action === PageAction.CREATE) { if (action === PageAction.CREATE) {
@@ -83,6 +104,34 @@ const BasicForm = () => {
</Form.Item> </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> <Form.Item<FormData>
name="default_backend_param" name="default_backend_param"
rules={[{ required: false }]} rules={[{ required: false }]}
+7
View File
@@ -0,0 +1,7 @@
.command {
:global {
.seal-textarea-label {
background-color: transparent;
}
}
}