feat(llm-config): add llmPreferencesAtom query atom for fetching LLM preferences

This commit is contained in:
CREDO23 2025-12-10 09:39:58 +00:00
parent 194b17500e
commit 3a65277e8b

View file

@ -29,3 +29,18 @@ export const globalLLMConfigsAtom = atomWithQuery(() => {
},
};
});
export const llmPreferencesAtom = atomWithQuery((get) => {
const searchSpaceId = get(activeSearchSpaceIdAtom);
return {
queryKey: cacheKeys.llmConfigs.preferences(String(searchSpaceId)),
enabled: !!searchSpaceId,
staleTime: 5 * 60 * 1000, // 5 minutes
queryFn: async () => {
return llmConfigApiService.getLLMPreferences({
search_space_id: Number(searchSpaceId),
});
},
};
});