Files
ragflow/web/src/hooks/use-memory-request.ts
balibabu 9c14e3f377 Fix: When adding a chat in the main interface, a warning will automatically pop up (#15685)
### What problem does this PR solve?

Fix: When adding a chat in the main interface, a warning will
automatically pop up (even if embedding and LLM model have already been
configured).
### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2026-06-05 19:09:22 +08:00

31 lines
747 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: 100, page: 1 },
data: {},
},
true,
);
return response.data.memory_list ?? [];
},
});
return {
data,
isLoading,
isError,
refetch,
};
};