feat: support DeepSeek (#667)
### What problem does this PR solve? #666 feat: support DeepSeek feat: preview word and excel ### Type of change - [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
@@ -9,7 +9,7 @@ import {
|
||||
LinkOutlined,
|
||||
} from '@ant-design/icons';
|
||||
import { Button, Space, Tooltip } from 'antd';
|
||||
import { useHandleDeleteFile } from '../hooks';
|
||||
import { useHandleDeleteFile, useNavigateToDocument } from '../hooks';
|
||||
|
||||
import styles from './index.less';
|
||||
|
||||
@@ -35,6 +35,7 @@ const ActionCell = ({
|
||||
[documentId],
|
||||
setSelectedRowKeys,
|
||||
);
|
||||
const navigateToDocument = useNavigateToDocument(record.id, record.name);
|
||||
|
||||
const onDownloadDocument = () => {
|
||||
downloadFile({
|
||||
@@ -58,6 +59,15 @@ const ActionCell = ({
|
||||
|
||||
return (
|
||||
<Space size={0}>
|
||||
{/* <Tooltip title={t('addToKnowledge')}>
|
||||
<Button
|
||||
type="text"
|
||||
className={styles.iconButton}
|
||||
onClick={navigateToDocument}
|
||||
>
|
||||
<EyeOutlined size={20} />
|
||||
</Button>
|
||||
</Tooltip> */}
|
||||
<Tooltip title={t('addToKnowledge')}>
|
||||
<Button
|
||||
type="text"
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
import { useGetPagination, useSetPagination } from '@/hooks/logicHooks';
|
||||
import { useOneNamespaceEffectsLoading } from '@/hooks/storeHooks';
|
||||
import { IFile } from '@/interfaces/database/file-manager';
|
||||
import { getExtension } from '@/utils/documentUtils';
|
||||
import { PaginationProps } from 'antd';
|
||||
import { UploadFile } from 'antd/lib';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
@@ -338,3 +339,12 @@ export const useHandleBreadcrumbClick = () => {
|
||||
|
||||
return { handleBreadcrumbClick };
|
||||
};
|
||||
|
||||
export const useNavigateToDocument = (documentId: string, name: string) => {
|
||||
const navigate = useNavigate();
|
||||
const navigateToDocument = () => {
|
||||
navigate(`/document/${documentId}?ext=${getExtension(name)}`);
|
||||
};
|
||||
|
||||
return navigateToDocument;
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useSelectFileList } from '@/hooks/fileManagerHooks';
|
||||
import { IFile } from '@/interfaces/database/file-manager';
|
||||
import { formatDate } from '@/utils/date';
|
||||
import { Button, Flex, Space, Table, Tag } from 'antd';
|
||||
import { Button, Flex, Space, Table, Tag, Typography } from 'antd';
|
||||
import { ColumnsType } from 'antd/es/table';
|
||||
import ActionCell from './action-cell';
|
||||
import FileToolbar from './file-toolbar';
|
||||
@@ -26,6 +26,8 @@ import ConnectToKnowledgeModal from './connect-to-knowledge-modal';
|
||||
import FolderCreateModal from './folder-create-modal';
|
||||
import styles from './index.less';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
const FileManager = () => {
|
||||
const { t } = useTranslate('fileManager');
|
||||
const fileList = useSelectFileList();
|
||||
@@ -69,6 +71,7 @@ const FileManager = () => {
|
||||
title: t('name'),
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
fixed: 'left',
|
||||
render(value, record) {
|
||||
return (
|
||||
<Flex gap={10} align="center">
|
||||
@@ -82,10 +85,10 @@ const FileManager = () => {
|
||||
className={styles.linkButton}
|
||||
onClick={() => navigateToOtherFolder(record.id)}
|
||||
>
|
||||
{value}
|
||||
<Text ellipsis={{ tooltip: value }}>{value}</Text>
|
||||
</Button>
|
||||
) : (
|
||||
value
|
||||
<Text ellipsis={{ tooltip: value }}>{value}</Text>
|
||||
)}
|
||||
</Flex>
|
||||
);
|
||||
@@ -160,6 +163,7 @@ const FileManager = () => {
|
||||
rowSelection={rowSelection}
|
||||
loading={loading}
|
||||
pagination={pagination}
|
||||
scroll={{ scrollToFirstRowOnChange: true, x: '100%' }}
|
||||
/>
|
||||
<RenameModal
|
||||
visible={fileRenameVisible}
|
||||
|
||||
@@ -2,7 +2,9 @@ import { paginationModel } from '@/base';
|
||||
import { BaseState } from '@/interfaces/common';
|
||||
import { IFile, IFolder } from '@/interfaces/database/file-manager';
|
||||
import i18n from '@/locales/config';
|
||||
import fileManagerService from '@/services/fileManagerService';
|
||||
import fileManagerService, {
|
||||
getDocumentFile,
|
||||
} from '@/services/fileManagerService';
|
||||
import { message } from 'antd';
|
||||
import omit from 'lodash/omit';
|
||||
import { DvaModel } from 'umi';
|
||||
@@ -139,6 +141,11 @@ const model: DvaModel<FileManagerModelState> = {
|
||||
}
|
||||
return data.retcode;
|
||||
},
|
||||
*getDocumentFile({ payload = {} }, { call }) {
|
||||
const ret = yield call(getDocumentFile, payload);
|
||||
|
||||
return ret;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user