mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 00:36:31 +02:00
27 lines
889 B
TypeScript
27 lines
889 B
TypeScript
import { atomWithQuery } from "jotai-tanstack-query";
|
|
import { visionLLMConfigApiService } from "@/lib/apis/vision-llm-config-api.service";
|
|
import { cacheKeys } from "@/lib/query-client/cache-keys";
|
|
import { activeSearchSpaceIdAtom } from "../search-spaces/search-space-query.atoms";
|
|
|
|
export const visionLLMConfigsAtom = atomWithQuery((get) => {
|
|
const searchSpaceId = get(activeSearchSpaceIdAtom);
|
|
|
|
return {
|
|
queryKey: cacheKeys.visionLLMConfigs.all(Number(searchSpaceId)),
|
|
enabled: !!searchSpaceId,
|
|
staleTime: 5 * 60 * 1000,
|
|
queryFn: async () => {
|
|
return visionLLMConfigApiService.getConfigs(Number(searchSpaceId));
|
|
},
|
|
};
|
|
});
|
|
|
|
export const globalVisionLLMConfigsAtom = atomWithQuery(() => {
|
|
return {
|
|
queryKey: cacheKeys.visionLLMConfigs.global(),
|
|
staleTime: 10 * 60 * 1000,
|
|
queryFn: async () => {
|
|
return visionLLMConfigApiService.getGlobalConfigs();
|
|
},
|
|
};
|
|
});
|