fix: omit long file names (#608)

### What problem does this PR solve?

#607
fix: omit long file names
fix: change the parsing method from tag to select
fix: replace icon for new chat
fix: change the OK button text of the Chat Bot API modal to close


### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2024-04-29 18:22:17 +08:00
committed by GitHub
parent 2af74cc494
commit 4c1476032d
12 changed files with 63 additions and 45 deletions

View File

@@ -28,7 +28,7 @@
min-width: 200px;
}
.tochunks {
.toChunks {
cursor: pointer;
}
@@ -42,3 +42,7 @@
cursor: help;
writing-mode: horizontal-tb;
}
.nameText {
color: #1677ff;
}

View File

@@ -8,7 +8,7 @@ import { useSetSelectedRecord } from '@/hooks/logicHooks';
import { useSelectParserList } from '@/hooks/userSettingHook';
import { IKnowledgeFile } from '@/interfaces/database/knowledge';
import { getExtension } from '@/utils/documentUtils';
import { Divider, Flex, Switch, Table } from 'antd';
import { Divider, Flex, Switch, Table, Typography } from 'antd';
import type { ColumnsType } from 'antd/es/table';
import { useTranslation } from 'react-i18next';
import CreateFileModal from './create-file-modal';
@@ -31,6 +31,8 @@ import FileUploadModal from '@/components/file-upload-modal';
import { formatDate } from '@/utils/date';
import styles from './index.less';
const { Text } = Typography;
const KnowledgeFile = () => {
const data = useSelectDocumentList();
const { fetchDocumentList } = useFetchDocumentListOnMount();
@@ -80,7 +82,7 @@ const KnowledgeFile = () => {
key: 'name',
fixed: 'left',
render: (text: any, { id, thumbnail, name }) => (
<div className={styles.tochunks} onClick={() => toChunk(id)}>
<div className={styles.toChunks} onClick={() => toChunk(id)}>
<Flex gap={10} align="center">
{thumbnail ? (
<img className={styles.img} src={thumbnail} alt="" />
@@ -90,7 +92,9 @@ const KnowledgeFile = () => {
width={24}
></SvgIcon>
)}
{text}
<Text ellipsis={{ tooltip: text }} className={styles.nameText}>
{text}
</Text>
</Flex>
</div>
),

View File

@@ -218,7 +218,13 @@ const model: DvaModel<KFModelState> = {
});
const { data } = yield call(kbService.document_upload, formData);
if (data.retcode === 0 || data.retcode === 500) {
const succeed = data.retcode === 0;
if (succeed) {
message.success(i18n.t('message.uploaded'));
}
if (succeed || data.retcode === 500) {
yield put({
type: 'getKfList',
payload: { kb_id: payload.kb_id },

View File

@@ -93,22 +93,26 @@ const ParsingActionCell = ({
<EditOutlined size={20} />
</Button>
</Tooltip>
<Button
type="text"
disabled={isRunning}
onClick={onRmDocument}
className={styles.iconButton}
>
<DeleteOutlined size={20} />
</Button>
<Button
type="text"
disabled={isRunning}
onClick={onDownloadDocument}
className={styles.iconButton}
>
<DownloadOutlined size={20} />
</Button>
<Tooltip title={t('delete', { keyPrefix: 'common' })}>
<Button
type="text"
disabled={isRunning}
onClick={onRmDocument}
className={styles.iconButton}
>
<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>
</Space>
);
};