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:
buua436
2026-07-23 20:48:39 +08:00
committed by GitHub
parent a84d2ae3d2
commit 0c5732108a
5 changed files with 125 additions and 51 deletions

View File

@@ -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 = () => {