feat: Supports chatting with files/images #1880 (#1943)

### What problem does this PR solve?

feat: Supports chatting with files/images #1880

### Type of change


- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-08-14 17:26:47 +08:00
committed by GitHub
parent 78ed8fe9a5
commit a3a5a9966f
17 changed files with 487 additions and 37 deletions

View File

@ -38,7 +38,6 @@ export default {
knowledge_graph: `${api_host}/chunk/knowledge_graph`,
// document
upload: `${api_host}/document/upload`,
get_document_list: `${api_host}/document/list`,
document_change_status: `${api_host}/document/change_status`,
document_rm: `${api_host}/document/rm`,
@ -50,6 +49,7 @@ export default {
get_document_file: `${api_host}/document/get`,
document_upload: `${api_host}/document/upload`,
web_crawl: `${api_host}/document/web_crawl`,
document_infos: `${api_host}/document/infos`,
// chat
setDialog: `${api_host}/dialog/set`,

View File

@ -1,4 +1,4 @@
import { SupportedPreviewDocumentTypes } from '@/constants/common';
import { Images, SupportedPreviewDocumentTypes } from '@/constants/common';
import { IChunk } from '@/interfaces/database/knowledge';
import { UploadFile } from 'antd';
import { v4 as uuid } from 'uuid';
@ -51,3 +51,7 @@ export const getUnSupportedFilesCount = (message: string) => {
export const isSupportedPreviewDocumentType = (fileExtension: string) => {
return SupportedPreviewDocumentTypes.includes(fileExtension);
};
export const isImage = (image: string) => {
return [...Images, 'svg'].some((x) => x === image);
};