fix: filter knowledge list by keywords and clear the selected file list after the file is uploaded successfully and add ellipsis pattern to chunk list (#628)

### What problem does this PR solve?

#627 
fix: filter knowledge list by keywords
fix: clear the selected file list after the file is uploaded
successfully
feat: add ellipsis pattern to chunk list

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
balibabu
2024-04-30 18:43:26 +08:00
committed by GitHub
parent 7d3b68bb1e
commit 9703633a57
21 changed files with 154 additions and 171 deletions

View File

@ -4,6 +4,7 @@ import { Card, Checkbox, CheckboxProps, Flex, Popover, Switch } from 'antd';
import classNames from 'classnames';
import { useState } from 'react';
import { ChunkTextMode } from '../../constant';
import styles from './index.less';
interface IProps {
@ -14,6 +15,7 @@ interface IProps {
handleCheckboxClick: (chunkId: string, checked: boolean) => void;
selected: boolean;
clickChunkCard: (chunkId: string) => void;
textMode: ChunkTextMode;
}
const ChunkCard = ({
@ -24,6 +26,7 @@ const ChunkCard = ({
switchChunk,
selected,
clickChunkCard,
textMode,
}: IProps) => {
const available = Number(item.available_int);
const [enabled, setEnabled] = useState(available === 1);
@ -68,8 +71,15 @@ const ChunkCard = ({
onDoubleClick={handleContentDoubleClick}
onClick={handleContentClick}
className={styles.content}
dangerouslySetInnerHTML={{ __html: item.content_with_weight }}
></section>
>
<div
dangerouslySetInnerHTML={{ __html: item.content_with_weight }}
className={classNames({
[styles.contentEllipsis]: textMode === ChunkTextMode.Ellipse,
})}
></div>
</section>
<div>
<Switch checked={enabled} onChange={onChange} />
</div>