Fix: File selection in Retrieval testing causes other options to disappear (#7759)

### What problem does this PR solve?

https://github.com/infiniflow/ragflow/issues/7753

The internal is due to when the selected row keys change will trigger a
testing, but I do not know why.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
Stephen Hu
2025-05-30 09:38:50 +08:00
committed by GitHub
parent e97fd2b5e6
commit a31ad7f960
9 changed files with 150 additions and 18 deletions

View File

@ -18,10 +18,15 @@ type FieldType = {
interface IProps {
form: FormInstance;
handleTesting: () => Promise<any>;
handleTesting: (documentIds?: string[]) => Promise<any>;
selectedDocumentIds: string[];
}
const TestingControl = ({ form, handleTesting }: IProps) => {
const TestingControl = ({
form,
handleTesting,
selectedDocumentIds,
}: IProps) => {
const question = Form.useWatch('question', { form, preserve: true });
const loading = useChunkIsTesting();
const { t } = useTranslate('knowledgeDetails');
@ -29,6 +34,10 @@ const TestingControl = ({ form, handleTesting }: IProps) => {
const buttonDisabled =
!question || (typeof question === 'string' && question.trim() === '');
const onClick = () => {
handleTesting(selectedDocumentIds);
};
return (
<section className={styles.testingControlWrapper}>
<div>
@ -53,7 +62,7 @@ const TestingControl = ({ form, handleTesting }: IProps) => {
<Button
type="primary"
size="small"
onClick={handleTesting}
onClick={onClick}
disabled={buttonDisabled}
loading={loading}
>