fix: reset backend parameter options in deploy model modal
This commit is contained in:
@@ -20,6 +20,7 @@ import _ from 'lodash';
|
|||||||
import React, { useCallback, useMemo } from 'react';
|
import React, { useCallback, useMemo } from 'react';
|
||||||
import {
|
import {
|
||||||
backendOptionsMap,
|
backendOptionsMap,
|
||||||
|
backendParamsHolderTips,
|
||||||
modelSourceMap,
|
modelSourceMap,
|
||||||
placementStrategyOptions
|
placementStrategyOptions
|
||||||
} from '../config';
|
} from '../config';
|
||||||
@@ -81,7 +82,13 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
const paramsConfig = useMemo(() => {
|
const paramsConfig = useMemo(() => {
|
||||||
return backend === backendOptionsMap.llamaBox ? llamaConfig : vllmConfig;
|
if (backend === backendOptionsMap.llamaBox) {
|
||||||
|
return llamaConfig;
|
||||||
|
}
|
||||||
|
if (backend === backendOptionsMap.vllm) {
|
||||||
|
return vllmConfig;
|
||||||
|
}
|
||||||
|
return [];
|
||||||
}, [backend]);
|
}, [backend]);
|
||||||
|
|
||||||
const backendParamsTips = useMemo(() => {
|
const backendParamsTips = useMemo(() => {
|
||||||
@@ -91,10 +98,13 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
|||||||
link: 'https://github.com/gpustack/llama-box?tab=readme-ov-file#usage'
|
link: 'https://github.com/gpustack/llama-box?tab=readme-ov-file#usage'
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
if (backend === backendOptionsMap.vllm) {
|
||||||
backend: 'vLLM',
|
return {
|
||||||
link: 'https://docs.vllm.ai/en/stable/serving/openai_compatible_server.html#command-line-arguments-for-the-server'
|
backend: 'vLLM',
|
||||||
};
|
link: 'https://docs.vllm.ai/en/stable/serving/openai_compatible_server.html#command-line-arguments-for-the-server'
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}, [backend]);
|
}, [backend]);
|
||||||
|
|
||||||
const renderSelectTips = (list: Array<{ title: string; tips: string }>) => {
|
const renderSelectTips = (list: Array<{ title: string; tips: string }>) => {
|
||||||
@@ -286,39 +296,43 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
|
|||||||
})}
|
})}
|
||||||
></SealInput.Input>
|
></SealInput.Input>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
<Form.Item<FormData> name="backend_parameters">
|
<Form.Item<FormData> name="backend_parameters">
|
||||||
<ListInput
|
<ListInput
|
||||||
placeholder={
|
placeholder={
|
||||||
backend === backendOptionsMap.llamaBox
|
backendParamsHolderTips[backend]
|
||||||
? intl.formatMessage({
|
? intl.formatMessage({
|
||||||
id: 'models.form.backend_parameters.llamabox.placeholder'
|
id: backendParamsHolderTips[backend].holder
|
||||||
})
|
|
||||||
: intl.formatMessage({
|
|
||||||
id: 'models.form.backend_parameters.vllm.placeholder'
|
|
||||||
})
|
})
|
||||||
|
: ''
|
||||||
}
|
}
|
||||||
btnText="common.button.addParams"
|
btnText="common.button.addParams"
|
||||||
label={intl.formatMessage({ id: 'models.form.backend_parameters' })}
|
label={intl.formatMessage({
|
||||||
|
id: 'models.form.backend_parameters'
|
||||||
|
})}
|
||||||
dataList={form.getFieldValue('backend_parameters') || []}
|
dataList={form.getFieldValue('backend_parameters') || []}
|
||||||
onChange={handleBackendParametersChange}
|
onChange={handleBackendParametersChange}
|
||||||
options={paramsConfig}
|
options={paramsConfig}
|
||||||
description={
|
description={
|
||||||
<span>
|
backendParamsTips && (
|
||||||
{intl.formatMessage(
|
<span>
|
||||||
{ id: 'models.form.backend_parameters.vllm.tips' },
|
{intl.formatMessage(
|
||||||
{ backend: backendParamsTips.backend }
|
{ id: 'models.form.backend_parameters.vllm.tips' },
|
||||||
)}{' '}
|
{ backend: backendParamsTips.backend || '' }
|
||||||
<Typography.Link
|
)}{' '}
|
||||||
style={{ color: 'var(--ant-blue-4)' }}
|
<Typography.Link
|
||||||
href={backendParamsTips.link}
|
style={{ color: 'var(--ant-blue-4)' }}
|
||||||
target="_blank"
|
href={backendParamsTips.link}
|
||||||
>
|
target="_blank"
|
||||||
{intl.formatMessage({ id: 'common.text.here' })}
|
>
|
||||||
</Typography.Link>
|
{intl.formatMessage({ id: 'common.text.here' })}
|
||||||
</span>
|
</Typography.Link>
|
||||||
|
</span>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
></ListInput>
|
></ListInput>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
||||||
{backend === backendOptionsMap.llamaBox && (
|
{backend === backendOptionsMap.llamaBox && (
|
||||||
<div style={{ paddingBottom: 22, paddingLeft: 10 }}>
|
<div style={{ paddingBottom: 22, paddingLeft: 10 }}>
|
||||||
<Form.Item<FormData>
|
<Form.Item<FormData>
|
||||||
|
|||||||
@@ -2,6 +2,20 @@ import { StatusMaps } from '@/config';
|
|||||||
import { EditOutlined } from '@ant-design/icons';
|
import { EditOutlined } from '@ant-design/icons';
|
||||||
|
|
||||||
export const ollamaModelOptions = [
|
export const ollamaModelOptions = [
|
||||||
|
{
|
||||||
|
label: 'qwen2.5-coder',
|
||||||
|
value: 'qwen2.5-coder',
|
||||||
|
name: 'qwen2.5-coder',
|
||||||
|
id: 'qwen2.5-coder',
|
||||||
|
tags: []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'llama3.2-vision',
|
||||||
|
value: 'llama3.2-vision',
|
||||||
|
name: 'llama3.2-vision',
|
||||||
|
id: 'llama3.2-vision',
|
||||||
|
tags: []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'llama3.2',
|
label: 'llama3.2',
|
||||||
value: 'llama3.2',
|
value: 'llama3.2',
|
||||||
@@ -9,6 +23,13 @@ export const ollamaModelOptions = [
|
|||||||
id: 'llama3.2',
|
id: 'llama3.2',
|
||||||
tags: ['Tools', '1B', '3B']
|
tags: ['Tools', '1B', '3B']
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: 'nomic-embed-text',
|
||||||
|
value: 'nomic-embed-text',
|
||||||
|
name: 'nomic-embed-text',
|
||||||
|
id: 'nomic-embed-text',
|
||||||
|
tags: []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'qwen2.5',
|
label: 'qwen2.5',
|
||||||
value: 'qwen2.5',
|
value: 'qwen2.5',
|
||||||
@@ -73,6 +94,18 @@ export const backendOptionsMap = {
|
|||||||
voxBox: 'vox-box'
|
voxBox: 'vox-box'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const backendParamsHolderTips = {
|
||||||
|
[backendOptionsMap.llamaBox]: {
|
||||||
|
holder: 'models.form.backend_parameters.llamabox.placeholder',
|
||||||
|
tooltip: 'models.form.backend_parameters.vllm.tips'
|
||||||
|
},
|
||||||
|
[backendOptionsMap.vllm]: {
|
||||||
|
holder: 'models.form.backend_parameters.vllm.placeholder',
|
||||||
|
tooltip: 'models.form.backend_parameters.vllm.tips'
|
||||||
|
},
|
||||||
|
[backendOptionsMap.voxBox]: null
|
||||||
|
};
|
||||||
|
|
||||||
export const modelTaskMap = {
|
export const modelTaskMap = {
|
||||||
textToSpeech: 'text-to-speech',
|
textToSpeech: 'text-to-speech',
|
||||||
speechToText: 'speech-to-text',
|
speechToText: 'speech-to-text',
|
||||||
|
|||||||
Reference in New Issue
Block a user