forked from infiniflow/ragflow
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: upload file in FileManager infiniflow#345 (infiniflow#529)
### What problem does this PR solve? feat: upload file in FileManager infiniflow#345 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
- Loading branch information
Showing
17 changed files
with
412 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
web/src/pages/file-manager/connect-to-knowledge-modal/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { useFetchKnowledgeList } from '@/hooks/knowledgeHook'; | ||
import { IModalProps } from '@/interfaces/common'; | ||
import { Form, Modal, Select, SelectProps } from 'antd'; | ||
|
||
const ConnectToKnowledgeModal = ({ | ||
visible, | ||
hideModal, | ||
onOk, | ||
}: IModalProps<string[]>) => { | ||
const [form] = Form.useForm(); | ||
const { list } = useFetchKnowledgeList(); | ||
|
||
const options: SelectProps['options'] = list?.map((item) => ({ | ||
label: item.name, | ||
value: item.id, | ||
})); | ||
|
||
const handleOk = async () => { | ||
const values = await form.getFieldsValue(); | ||
const knowledgeIds = values.knowledgeIds ?? []; | ||
if (knowledgeIds.length > 0) { | ||
return onOk?.(knowledgeIds); | ||
} | ||
}; | ||
|
||
return ( | ||
<Modal | ||
title="Add to Knowledge Base" | ||
open={visible} | ||
onOk={handleOk} | ||
onCancel={hideModal} | ||
> | ||
<Form form={form}> | ||
<Form.Item | ||
name="knowledgeIds" | ||
noStyle | ||
rules={[ | ||
{ | ||
required: true, | ||
message: 'Please select your favourite colors!', | ||
type: 'array', | ||
}, | ||
]} | ||
> | ||
<Select | ||
mode="multiple" | ||
allowClear | ||
style={{ width: '100%' }} | ||
placeholder="Please select" | ||
options={options} | ||
/> | ||
</Form.Item> | ||
</Form> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default ConnectToKnowledgeModal; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.