Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
isthaison committed Dec 4, 2024
2 parents dfb9875 + 289f4f1 commit 7fbf5ad
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 40 deletions.
2 changes: 0 additions & 2 deletions web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"@ant-design/icons": "^5.2.6",
"@ant-design/pro-components": "^2.6.46",
"@ant-design/pro-layout": "^7.17.16",
"@antv/g": "^6.1.11",
"@antv/g6": "^5.0.10",
"@hookform/resolvers": "^3.9.1",
"@js-preview/excel": "^1.7.8",
Expand Down Expand Up @@ -73,7 +72,6 @@
"react-i18next": "^14.0.0",
"react-infinite-scroll-component": "^6.1.0",
"react-markdown": "^9.0.1",
"react-pdf": "^9.1.1",
"react-pdf-highlighter": "^6.1.0",
"react-string-replace": "^1.1.1",
"react-syntax-highlighter": "^15.5.0",
Expand Down
5 changes: 5 additions & 0 deletions web/src/constants/knowledge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,8 @@ export enum KnowledgeSearchParams {
DocumentId = 'doc_id',
KnowledgeId = 'id',
}

export enum DocumentType {
Virtual = 'virtual',
Visual = 'visual',
}
17 changes: 0 additions & 17 deletions web/src/hooks/file-manager-hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,6 @@ export const useDownloadFile = () => {
return { data, loading, downloadFile: mutateAsync };
};

export const useLoadFile = () => {
const {
data,
isPending: loading,
mutateAsync,
error,
} = useMutation({
mutationKey: ['downloadFile'],
mutationFn: async (params: { id: string }) => {
const response = await fileManagerService.getFile({}, params.id);
const blob = new Blob([response.data], { type: response.data.type });
return blob;
},
});
return { data, loading, loadFile: mutateAsync, error };
};

export const useRenameFile = () => {
const queryClient = useQueryClient();
const { t } = useTranslation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { Button, Dropdown, MenuProps, Space, Tooltip } from 'antd';
import { isParserRunning } from '../utils';

import { DocumentType } from '../constant';
import styles from './index.less';

interface IProps {
Expand All @@ -31,6 +32,7 @@ const ParsingActionCell = ({
const { t } = useTranslate('knowledgeDetails');
const { removeDocument } = useRemoveNextDocument();
const showDeleteConfirm = useShowDeleteConfirm();
const isVirtualDocument = record.type === DocumentType.Virtual;

const onRmDocument = () => {
if (!isRunning) {
Expand Down Expand Up @@ -73,15 +75,17 @@ const ParsingActionCell = ({

return (
<Space size={0}>
<Dropdown
menu={{ items: chunkItems }}
trigger={['click']}
disabled={isRunning}
>
<Button type="text" className={styles.iconButton}>
<ToolOutlined size={20} />
</Button>
</Dropdown>
{isVirtualDocument || (
<Dropdown
menu={{ items: chunkItems }}
trigger={['click']}
disabled={isRunning}
>
<Button type="text" className={styles.iconButton}>
<ToolOutlined size={20} />
</Button>
</Dropdown>
)}
<Tooltip title={t('rename', { keyPrefix: 'common' })}>
<Button
type="text"
Expand All @@ -102,16 +106,18 @@ const ParsingActionCell = ({
<DeleteOutlined size={20} />
</Button>
</Tooltip>
<Tooltip title={t('download', { keyPrefix: 'common' })}>
<Button
type="text"
disabled={isRunning}
onClick={onDownloadDocument}
className={styles.iconButton}
>
<DownloadOutlined size={20} />
</Button>
</Tooltip>
{isVirtualDocument || (
<Tooltip title={t('download', { keyPrefix: 'common' })}>
<Button
type="text"
disabled={isRunning}
onClick={onDownloadDocument}
className={styles.iconButton}
>
<DownloadOutlined size={20} />
</Button>
</Tooltip>
)}
</Space>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Badge, DescriptionsProps, Flex, Popover, Space, Tag } from 'antd';
import classNames from 'classnames';
import { useTranslation } from 'react-i18next';
import reactStringReplace from 'react-string-replace';
import { RunningStatus, RunningStatusMap } from '../constant';
import { DocumentType, RunningStatus, RunningStatusMap } from '../constant';
import { useHandleRunDocumentByIds } from '../hooks';
import { isParserRunning } from '../utils';
import styles from './index.less';
Expand Down Expand Up @@ -96,7 +96,7 @@ export const ParsingStatusCell = ({ record }: IProps) => {
handleRunDocumentByIds(record.id, isRunning);
};

return (
return record.type === DocumentType.Virtual ? null : (
<Flex justify={'space-between'} align="center">
<Popover content={<PopoverContent record={record}></PopoverContent>}>
<Tag color={runningStatus.color}>
Expand Down
1 change: 1 addition & 0 deletions web/src/pages/flow/flow-drawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import OperatorIcon from '../operator-icon';

import { CloseOutlined } from '@ant-design/icons';
import { lowerFirst } from 'lodash';
import EmailForm from '../form/email-form';
import TemplateForm from '../form/template-form';
import { getDrawerWidth } from '../utils';
import styles from './index.less';
Expand Down

0 comments on commit 7fbf5ad

Please sign in to comment.