mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-25 01:43:27 +08:00
fix: support Infinity knowledge compilation (#17288)
### What problem does this PR solve? Fix Infinity compatibility issues in knowledge compilation. This change: - Stores compilation source ID lists as JSON arrays in Infinity. - Parses JSON array fields when reading compiled documents. - Uses `json_contains` for filtering JSON array fields. - Adds the missing `name` column to the Infinity mapping. - Updates dataset navigation KNN search to use the unified `MatchDenseExpr` interface. - Handles unavailable embeddings without querying an invalid `q_0_vec` field. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -74,6 +74,8 @@ const DocumentKeys = {
|
||||
[DocumentApiAction.FetchDocumentList, 'byIds', ids] as const,
|
||||
};
|
||||
|
||||
const documentIngestInFlight = new Map<string, Promise<unknown>>();
|
||||
|
||||
export const DocumentStructureKeys = {
|
||||
graph: (datasetId: string, documentId: string) =>
|
||||
[
|
||||
@@ -389,7 +391,36 @@ export const useRunDocument = () => {
|
||||
},
|
||||
});
|
||||
|
||||
return { runDocumentByIds: mutateAsync, loading, data };
|
||||
const runDocumentByIds = useCallback(
|
||||
(params: {
|
||||
documentIds: string[];
|
||||
run: number;
|
||||
option?: { delete: boolean; apply_kb: boolean };
|
||||
}) => {
|
||||
const key = JSON.stringify({
|
||||
documentIds: [...params.documentIds].sort(),
|
||||
run: params.run,
|
||||
option: params.option || null,
|
||||
});
|
||||
const existingRequest = documentIngestInFlight.get(key);
|
||||
if (existingRequest) {
|
||||
return existingRequest;
|
||||
}
|
||||
|
||||
const request = mutateAsync(params);
|
||||
documentIngestInFlight.set(key, request);
|
||||
const clearRequest = () => {
|
||||
if (documentIngestInFlight.get(key) === request) {
|
||||
documentIngestInFlight.delete(key);
|
||||
}
|
||||
};
|
||||
void request.then(clearRequest, clearRequest);
|
||||
return request;
|
||||
},
|
||||
[mutateAsync],
|
||||
);
|
||||
|
||||
return { runDocumentByIds, loading, data };
|
||||
};
|
||||
|
||||
export const useRemoveDocument = () => {
|
||||
|
||||
Reference in New Issue
Block a user