mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-01 00:05:43 +08:00
### What problem does this PR solve? Feat: Add memory multi-select dropdown to recall and message operator forms. #4213 ### Type of change - [x] New Feature (non-breaking change which adds functionality)
31 lines
753 B
TypeScript
31 lines
753 B
TypeScript
import { IMemory } from '@/interfaces/database/memory';
|
|
import memoryService from '@/services/memory-service';
|
|
import { useQuery } from '@tanstack/react-query';
|
|
|
|
export const enum MemoryApiAction {
|
|
FetchMemoryList = 'fetchMemoryList',
|
|
}
|
|
|
|
export const useFetchAllMemoryList = () => {
|
|
const { data, isLoading, isError, refetch } = useQuery<IMemory[], Error>({
|
|
queryKey: [MemoryApiAction.FetchMemoryList],
|
|
queryFn: async () => {
|
|
const { data: response } = await memoryService.getMemoryList(
|
|
{
|
|
params: { page_size: 100000000, page: 1 },
|
|
data: {},
|
|
},
|
|
true,
|
|
);
|
|
return response.data.memory_list ?? [];
|
|
},
|
|
});
|
|
|
|
return {
|
|
data,
|
|
isLoading,
|
|
isError,
|
|
refetch,
|
|
};
|
|
};
|