fix: deploy from model files source incorrect

This commit is contained in:
jialin
2025-03-25 16:39:03 +08:00
parent b25644c590
commit f882fe2c32
11 changed files with 113 additions and 182 deletions
+1 -25
View File
@@ -99,6 +99,7 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
ref,
() => {
return {
form: form,
submit: handleSumit,
setFieldsValue: (values: FormData) => {
form.setFieldsValue(values);
@@ -288,30 +289,6 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
label={intl.formatMessage({ id: 'models.form.filePath' })}
description={<TooltipList list={localPathTipsList}></TooltipList>}
></SealAutoComplete>
{/* <SealCascader
required
showSearch
description={<TooltipList list={localPathTipsList}></TooltipList>}
expandTrigger="hover"
multiple={false}
onSearch={handleOnSearch}
popupClassName="cascader-popup-wrapper gpu-selector"
maxTagCount={1}
label={intl.formatMessage({ id: 'models.form.gpuselector' })}
options={modelFileOptions}
showCheckedStrategy="SHOW_CHILD"
value={form.getFieldValue('local_path')}
getPopupContainer={(triggerNode) => triggerNode.parentNode}
displayRender={() => (
<Input
style={{
border: 'none',
outline: 'none',
width: '100%'
}}
/>
)}
></SealCascader> */}
</Form.Item>
</>
);
@@ -488,7 +465,6 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
useEffect(() => {
handleOnSelectModel();
}, [props.selectedModel.name]);
return (
<Form
name="deployModel"
+59 -53
View File
@@ -26,6 +26,7 @@ type AddModalProps = {
gpuOptions: any[];
modelFileOptions: any[];
initialValues?: any;
deploymentType?: 'modelList' | 'modelFiles';
onOk: (values: FormData) => void;
onCancel: () => void;
};
@@ -39,6 +40,7 @@ const AddModal: FC<AddModalProps> = (props) => {
source,
action,
width = 600,
deploymentType = 'modelList',
initialValues
} = props || {};
const SEARCH_SOURCE = [
@@ -147,8 +149,10 @@ const AddModal: FC<AddModalProps> = (props) => {
} else if (source === modelSourceMap.ollama_library_value) {
form.current?.setFieldValue?.('backend', backendOptionsMap.llamaBox);
setIsGGUF(true);
} else {
form.current?.setFieldsValue({
}
if (props.deploymentType === 'modelFiles' && open) {
form.current?.form?.setFieldsValue({
...props.initialValues
});
setIsGGUF(props.isGGUF || false);
@@ -157,7 +161,7 @@ const AddModal: FC<AddModalProps> = (props) => {
return () => {
setSelectedModel({});
};
}, [open, source, props.isGGUF, props.initialValues]);
}, [open, source, props.isGGUF, props.initialValues, props.deploymentType]);
return (
<Drawer
@@ -198,52 +202,53 @@ const AddModal: FC<AddModalProps> = (props) => {
footer={false}
>
<div style={{ display: 'flex', height: '100%' }}>
{SEARCH_SOURCE.includes(props.source) && (
<>
<div
style={{
display: 'flex',
flex: 1,
maxWidth: '33.33%'
}}
>
<ColumnWrapper>
<SearchModel
modelSource={props.source}
onSelectModel={handleOnSelectModel}
></SearchModel>
</ColumnWrapper>
<Separator></Separator>
</div>
<div
style={{
display: 'flex',
flex: 1,
maxWidth: '33.33%'
}}
>
<ColumnWrapper>
<ModelCard
selectedModel={selectedModel}
onCollapse={setCollapsed}
collapsed={collapsed}
modelSource={props.source}
setIsGGUF={handleSetIsGGUF}
></ModelCard>
{isGGUF && (
<HFModelFile
ref={modelFileRef}
selectedModel={selectedModel}
{SEARCH_SOURCE.includes(props.source) &&
deploymentType === 'modelList' && (
<>
<div
style={{
display: 'flex',
flex: 1,
maxWidth: '33.33%'
}}
>
<ColumnWrapper>
<SearchModel
modelSource={props.source}
onSelectFile={handleSelectModelFile}
onSelectModel={handleOnSelectModel}
></SearchModel>
</ColumnWrapper>
<Separator></Separator>
</div>
<div
style={{
display: 'flex',
flex: 1,
maxWidth: '33.33%'
}}
>
<ColumnWrapper>
<ModelCard
selectedModel={selectedModel}
onCollapse={setCollapsed}
collapsed={collapsed}
></HFModelFile>
)}
</ColumnWrapper>
<Separator></Separator>
</div>
</>
)}
modelSource={props.source}
setIsGGUF={handleSetIsGGUF}
></ModelCard>
{isGGUF && (
<HFModelFile
ref={modelFileRef}
selectedModel={selectedModel}
modelSource={props.source}
onSelectFile={handleSelectModelFile}
collapsed={collapsed}
></HFModelFile>
)}
</ColumnWrapper>
<Separator></Separator>
</div>
</>
)}
<div style={{ display: 'flex', flex: 1, maxWidth: '100%' }}>
<ColumnWrapper
paddingBottom={warningStatus.show ? 125 : 50}
@@ -283,12 +288,13 @@ const AddModal: FC<AddModalProps> = (props) => {
}
>
<>
{SEARCH_SOURCE.includes(source) && (
<TitleWrapper>
{intl.formatMessage({ id: 'models.form.configurations' })}
<span style={{ display: 'flex', height: 24 }}></span>
</TitleWrapper>
)}
{SEARCH_SOURCE.includes(source) &&
deploymentType === 'modelList' && (
<TitleWrapper>
{intl.formatMessage({ id: 'models.form.configurations' })}
<span style={{ display: 'flex', height: 24 }}></span>
</TitleWrapper>
)}
<DataForm
initialValues={initialValues}
source={source}
@@ -6,64 +6,6 @@ import { ModelInstanceListItem } from '../config/types';
import '../style/instance-item.less';
import InstanceItem from './instance-item';
const testInstanceData = {
source: 'huggingface',
huggingface_repo_id: 'Qwen/Qwen2.5-3B-Instruct',
huggingface_filename: null,
ollama_library_model_name: null,
model_scope_model_id: null,
model_scope_file_path: null,
local_path: null,
name: 'qwen2.5-XVCXa',
worker_id: 1,
worker_name: 'sealgpuhost4080',
worker_ip: '192.168.50.12',
pid: 208852,
port: 40063,
download_progress: 72.11,
resolved_path: null,
state: 'downloading',
state_message: '',
computed_resource_claim: {
is_unified_memory: false,
offload_layers: null,
total_layers: null,
ram: null,
vram: {
'0': 1717148058
},
tensor_split: null
},
gpu_indexes: [0],
model_id: 1,
model_name: 'qwen2.5',
distributed_servers: {
rpc_servers: null,
ray_actors: [
{
worker_id: 2,
worker_ip: '192.168.50.13',
total_gpus: 1,
gpu_indexes: [0],
computed_resource_claim: {
is_unified_memory: false,
offload_layers: null,
total_layers: null,
ram: null,
vram: {
'0': 23181498777
},
tensor_split: null
},
download_progress: 27.49
}
]
},
id: 1,
created_at: '2025-03-24T12:06:30Z',
updated_at: '2025-03-24T12:09:01Z'
};
interface InstanceItemProps {
list: ModelInstanceListItem[];
workerList: WorkerListItem[];
+9 -3
View File
@@ -171,9 +171,15 @@ const TargetForm: React.FC<TargetFormProps> = forwardRef((props, ref) => {
]}
>
<SealInput.Input
description={intl.formatMessage({
id: 'resources.modelfiles.form.localdir.tips'
})}
description={
<span
dangerouslySetInnerHTML={{
__html: intl.formatMessage({
id: 'resources.modelfiles.form.localdir.tips'
})
}}
></span>
}
label={intl.formatMessage({
id: 'resources.modelfiles.form.localdir'
})}