### What problem does this PR solve? fix: Bulk disable the chunk, the UI still shows they are enabled #1236 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
75086f41a9
commit
266119bf62
1 changed files with 6 additions and 2 deletions
|
|
@ -3,7 +3,7 @@ import { IChunk } from '@/interfaces/database/knowledge';
|
|||
import { Card, Checkbox, CheckboxProps, Flex, Popover, Switch } from 'antd';
|
||||
import classNames from 'classnames';
|
||||
import DOMPurify from 'dompurify';
|
||||
import { useState } from 'react';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
import { ChunkTextMode } from '../../constant';
|
||||
import styles from './index.less';
|
||||
|
|
@ -30,7 +30,7 @@ const ChunkCard = ({
|
|||
textMode,
|
||||
}: IProps) => {
|
||||
const available = Number(item.available_int);
|
||||
const [enabled, setEnabled] = useState(available === 1);
|
||||
const [enabled, setEnabled] = useState(false);
|
||||
|
||||
const onChange = (checked: boolean) => {
|
||||
setEnabled(checked);
|
||||
|
|
@ -49,6 +49,10 @@ const ChunkCard = ({
|
|||
clickChunkCard(item.chunk_id);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
setEnabled(available === 1);
|
||||
}, [available]);
|
||||
|
||||
return (
|
||||
<Card
|
||||
className={classNames(styles.chunkCard, {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue