chore: adjust deployment modal form

This commit is contained in:
jialin
2025-09-16 11:26:17 +08:00
parent ed49e03802
commit 29b74f85c5
39 changed files with 1574 additions and 786 deletions
-19
View File
@@ -51,25 +51,6 @@ const HuggingFaceForm: React.FC = () => {
onBlur={handleOnBlur}
></SealInput.Input>
</Form.Item>
{/* {isGGUF && (
<Form.Item<FormData>
name="file_name"
key="file_name"
rules={[
{
required: true,
message: getRuleMessage('input', 'models.form.filename')
}
]}
>
<SealInput.Input
label={intl.formatMessage({ id: 'models.form.filename' })}
required
disabled={pageAction === PageAction.CREATE}
onBlur={handleOnBlur}
></SealInput.Input>
</Form.Item>
)} */}
</>
);
};
@@ -1,67 +0,0 @@
import SealAutoComplete from '@/components/seal-form/auto-complete';
import useAppUtils from '@/hooks/use-app-utils';
import { useIntl } from '@umijs/max';
import { Form } from 'antd';
import React from 'react';
import { modelSourceMap, ollamaModelOptions } from '../config';
import { useFormContext, useFormInnerContext } from '../config/form-context';
import { FormData } from '../config/types';
const OllamaForm: React.FC = () => {
const formCtx = useFormContext();
const formInnerCtx = useFormInnerContext();
const { byBuiltIn, onValuesChange } = formCtx;
const { getRuleMessage } = useAppUtils();
const intl = useIntl();
const source = Form.useWatch('source');
const formInstance = Form.useFormInstance();
if (![modelSourceMap.ollama_library_value].includes(source) || byBuiltIn) {
return null;
}
const handleModelNameChange = (value: string) => {
if (value) {
onValuesChange?.({}, formInstance.getFieldsValue());
}
};
const handleOnBlur = (e: any) => {
onValuesChange?.({}, formInstance.getFieldsValue());
};
return (
<>
<Form.Item<FormData>
name="ollama_library_model_name"
key="ollama_library_model_name"
rules={[
{
required: true,
message: getRuleMessage('input', 'models.table.name')
}
]}
>
<SealAutoComplete
allowClear
filterOption
defaultActiveFirstOption
disabled={false}
options={ollamaModelOptions}
onSelect={handleModelNameChange}
onBlur={handleOnBlur}
description={
<span
dangerouslySetInnerHTML={{
__html: intl.formatMessage({ id: 'models.form.ollamalink' })
}}
></span>
}
label={intl.formatMessage({ id: 'model.form.ollama.model' })}
placeholder={intl.formatMessage({ id: 'model.form.ollamaholder' })}
required
></SealAutoComplete>
</Form.Item>
</>
);
};
export default OllamaForm;