File size: 2,445 Bytes
7ccbbf8 d80b399 7ccbbf8 d80b399 7ccbbf8 d80b399 7ccbbf8 b7adc24 7ccbbf8 b7adc24 d80b399 7ccbbf8 84f80c5 b7adc24 84f80c5 d80b399 7ccbbf8 b7adc24 7ccbbf8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
import { IModalManagerChildrenProps } from '@/components/modal-manager';
import { LlmModelType } from '@/constants/knowledge';
import { ISystemModelSettingSavingParams } from '@/hooks/llmHooks';
import { Form, Modal, Select } from 'antd';
import { useEffect } from 'react';
import { useFetchSystemModelSettingOnMount } from '../hooks';
interface IProps extends Omit<IModalManagerChildrenProps, 'showModal'> {
loading: boolean;
onOk: (
payload: Omit<ISystemModelSettingSavingParams, 'tenant_id' | 'name'>,
) => void;
}
const SystemModelSettingModal = ({
visible,
hideModal,
onOk,
loading,
}: IProps) => {
const [form] = Form.useForm();
const { systemSetting: initialValues, allOptions } =
useFetchSystemModelSettingOnMount(visible);
const handleOk = async () => {
const values = await form.validateFields();
onOk(values);
};
useEffect(() => {
form.setFieldsValue(initialValues);
}, [form, initialValues]);
const onFormLayoutChange = () => {};
return (
<Modal
title="System Model Settings"
open={visible}
onOk={handleOk}
onCancel={hideModal}
okButtonProps={{ loading }}
confirmLoading={loading}
>
<Form form={form} onValuesChange={onFormLayoutChange} layout={'vertical'}>
<Form.Item label="Chat model" name="llm_id" tooltip="The default chat LLM all the newly created knowledgebase will use.">
<Select options={allOptions[LlmModelType.Chat]} />
</Form.Item>
<Form.Item label="Embedding model" name="embd_id" tooltip="The default embedding model all the newly created knowledgebase will use.">
<Select options={allOptions[LlmModelType.Embedding]} />
</Form.Item>
<Form.Item
label="Img2txt model"
name="img2txt_id"
tooltip="The default multi-module model all the newly created knowledgebase will use. It can describe a picture or video."
>
<Select options={allOptions[LlmModelType.Image2text]} />
</Form.Item>
<Form.Item
label="Sequence2txt model"
name="asr_id"
tooltip="The default ASR model all the newly created knowledgebase will use. Use this model to translate voices to corresponding text."
>
<Select options={allOptions[LlmModelType.Speech2text]} />
</Form.Item>
</Form>
</Modal>
);
};
export default SystemModelSettingModal;
|