feat: add file icon and add message popover content (#77)
* feat: add message popover content * feat: add file icon
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import Image from '@/components/image';
|
||||
import { IChunk } from '@/interfaces/database/knowledge';
|
||||
import { api_host } from '@/utils/api';
|
||||
import { Card, Checkbox, CheckboxProps, Flex, Popover, Switch } from 'antd';
|
||||
import { useState } from 'react';
|
||||
import styles from './index.less';
|
||||
@@ -48,11 +47,6 @@ const ChunkCard = ({
|
||||
<Image id={item.img_id} className={styles.imagePreview}></Image>
|
||||
}
|
||||
>
|
||||
<img
|
||||
src={`${api_host}/document/image/${item.img_id}`}
|
||||
alt=""
|
||||
className={styles.image}
|
||||
/>
|
||||
<Image id={item.img_id} className={styles.image}></Image>
|
||||
</Popover>
|
||||
)}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ReactComponent as NavigationPointerIcon } from '@/assets/svg/navigation-pointer.svg';
|
||||
import NewDocumentLink from '@/components/new-document-link';
|
||||
import { ITestingDocument } from '@/interfaces/database/knowledge';
|
||||
import { api_host } from '@/utils/api';
|
||||
import { Table, TableProps } from 'antd';
|
||||
import { useDispatch, useSelector } from 'umi';
|
||||
|
||||
@@ -34,13 +34,9 @@ const SelectFiles = ({ handleTesting }: IProps) => {
|
||||
key: 'view',
|
||||
width: 50,
|
||||
render: (_, { doc_id }) => (
|
||||
<a
|
||||
href={`${api_host}/document/get/${doc_id}`}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
<NewDocumentLink documentId={doc_id}>
|
||||
<NavigationPointerIcon />
|
||||
</a>
|
||||
</NewDocumentLink>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
@@ -2,7 +2,7 @@ import { useKnowledgeBaseId } from '@/hooks/knowledgeHook';
|
||||
import { useSecondPathName, useThirdPathName } from '@/hooks/routeHook';
|
||||
import { Breadcrumb } from 'antd';
|
||||
import { ItemType } from 'antd/es/breadcrumb/Breadcrumb';
|
||||
import { useEffect, useMemo } from 'react';
|
||||
import { useCallback, useEffect, useMemo } from 'react';
|
||||
import { Link, Outlet, useDispatch, useLocation, useNavigate } from 'umi';
|
||||
import Siderbar from './components/knowledge-sidebar';
|
||||
import {
|
||||
@@ -25,9 +25,9 @@ const KnowledgeAdding = () => {
|
||||
const datasetActiveKey: KnowledgeDatasetRouteKey =
|
||||
useThirdPathName() as KnowledgeDatasetRouteKey;
|
||||
|
||||
const gotoList = () => {
|
||||
const gotoList = useCallback(() => {
|
||||
navigate('/knowledge');
|
||||
};
|
||||
}, [navigate]);
|
||||
|
||||
const breadcrumbItems: ItemType[] = useMemo(() => {
|
||||
const items: ItemType[] = [
|
||||
@@ -54,7 +54,7 @@ const KnowledgeAdding = () => {
|
||||
}
|
||||
|
||||
return items;
|
||||
}, [activeKey, datasetActiveKey]);
|
||||
}, [activeKey, datasetActiveKey, gotoList, knowledgeBaseId]);
|
||||
|
||||
useEffect(() => {
|
||||
const search: string = location.search.slice(1);
|
||||
@@ -71,7 +71,7 @@ const KnowledgeAdding = () => {
|
||||
...map,
|
||||
},
|
||||
});
|
||||
}, [location]);
|
||||
}, [location, dispatch]);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user