mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-11-29 16:36:49 +00:00
* feat: download documents on the document list page * feat: add tooltip to Form.Item * feat: set font family to inter * feat: add loading to ChatContainer
104 lines
2.6 KiB
TypeScript
104 lines
2.6 KiB
TypeScript
import { useFetchKnowledgeList } from '@/hooks/knowledgeHook';
|
|
import { PlusOutlined } from '@ant-design/icons';
|
|
import { Form, Input, Select, Upload } from 'antd';
|
|
import classNames from 'classnames';
|
|
import { ISegmentedContentProps } from '../interface';
|
|
|
|
import styles from './index.less';
|
|
|
|
const AssistantSetting = ({ show }: ISegmentedContentProps) => {
|
|
const { list: knowledgeList } = useFetchKnowledgeList(true);
|
|
const knowledgeOptions = knowledgeList.map((x) => ({
|
|
label: x.name,
|
|
value: x.id,
|
|
}));
|
|
|
|
const normFile = (e: any) => {
|
|
if (Array.isArray(e)) {
|
|
return e;
|
|
}
|
|
return e?.fileList;
|
|
};
|
|
|
|
return (
|
|
<section
|
|
className={classNames({
|
|
[styles.segmentedHidden]: !show,
|
|
})}
|
|
>
|
|
<Form.Item
|
|
name={'name'}
|
|
label="Assistant name"
|
|
rules={[{ required: true }]}
|
|
>
|
|
<Input placeholder="e.g. Resume Jarvis" />
|
|
</Form.Item>
|
|
<Form.Item
|
|
name="icon"
|
|
label="Assistant avatar"
|
|
valuePropName="fileList"
|
|
getValueFromEvent={normFile}
|
|
>
|
|
<Upload
|
|
listType="picture-card"
|
|
maxCount={1}
|
|
showUploadList={{ showPreviewIcon: false, showRemoveIcon: false }}
|
|
>
|
|
<button style={{ border: 0, background: 'none' }} type="button">
|
|
<PlusOutlined />
|
|
<div style={{ marginTop: 8 }}>Upload</div>
|
|
</button>
|
|
</Upload>
|
|
</Form.Item>
|
|
<Form.Item
|
|
name={'language'}
|
|
label="Language"
|
|
initialValue={'Chinese'}
|
|
tooltip="coming soon"
|
|
>
|
|
<Select
|
|
options={[
|
|
{ value: 'Chinese', label: 'Chinese' },
|
|
{ value: 'English', label: 'English' },
|
|
]}
|
|
/>
|
|
</Form.Item>
|
|
<Form.Item
|
|
name={['prompt_config', 'empty_response']}
|
|
label="Empty response"
|
|
tooltip="coming soon"
|
|
>
|
|
<Input placeholder="" />
|
|
</Form.Item>
|
|
<Form.Item
|
|
name={['prompt_config', 'prologue']}
|
|
label="Set an opener"
|
|
tooltip="coming soon"
|
|
initialValue={"Hi! I'm your assistant, what can I do for you?"}
|
|
>
|
|
<Input.TextArea autoSize={{ minRows: 5 }} />
|
|
</Form.Item>
|
|
<Form.Item
|
|
label="Select one context"
|
|
name="kb_ids"
|
|
tooltip="coming soon"
|
|
rules={[
|
|
{
|
|
required: true,
|
|
message: 'Please select!',
|
|
type: 'array',
|
|
},
|
|
]}
|
|
>
|
|
<Select
|
|
mode="multiple"
|
|
options={knowledgeOptions}
|
|
placeholder="Please select"
|
|
></Select>
|
|
</Form.Item>
|
|
</section>
|
|
);
|
|
};
|
|
|
|
export default AssistantSetting;
|