mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-26 17:16:52 +08:00
Fix: Add a no-data filter condition to MetaData (#12189)
### What problem does this PR solve? Fix: Add a no-data filter condition to MetaData ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -14,6 +14,7 @@ import {
|
||||
IDocumentMetaRequestBody,
|
||||
} from '@/interfaces/request/document';
|
||||
import i18n from '@/locales/config';
|
||||
import { EMPTY_METADATA_FIELD } from '@/pages/dataset/dataset/use-select-filters';
|
||||
import kbService, { listDocument } from '@/services/knowledge-service';
|
||||
import api, { api_host } from '@/utils/api';
|
||||
import { buildChunkHighlights } from '@/utils/document-util';
|
||||
@ -114,6 +115,20 @@ export const useFetchDocumentList = () => {
|
||||
refetchInterval: isLoop ? 5000 : false,
|
||||
enabled: !!knowledgeId || !!id,
|
||||
queryFn: async () => {
|
||||
let run = [] as any;
|
||||
let returnEmptyMetadata = false;
|
||||
if (filterValue.run && Array.isArray(filterValue.run)) {
|
||||
run = [...(filterValue.run as string[])];
|
||||
const returnEmptyMetadataIndex = run.findIndex(
|
||||
(r: string) => r === EMPTY_METADATA_FIELD,
|
||||
);
|
||||
if (returnEmptyMetadataIndex > -1) {
|
||||
returnEmptyMetadata = true;
|
||||
run.splice(returnEmptyMetadataIndex, 1);
|
||||
}
|
||||
} else {
|
||||
run = filterValue.run;
|
||||
}
|
||||
const ret = await listDocument(
|
||||
{
|
||||
kb_id: knowledgeId || id,
|
||||
@ -123,7 +138,8 @@ export const useFetchDocumentList = () => {
|
||||
},
|
||||
{
|
||||
suffix: filterValue.type as string[],
|
||||
run_status: filterValue.run as string[],
|
||||
run_status: run as string[],
|
||||
return_empty_metadata: returnEmptyMetadata,
|
||||
metadata: filterValue.metadata as Record<string, string[]>,
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user