diff --git a/apps/web/components/AI/Hooks/useGetAIFeatures.tsx b/apps/web/components/AI/Hooks/useGetAIFeatures.tsx index fcd65ca0..0639aa81 100644 --- a/apps/web/components/AI/Hooks/useGetAIFeatures.tsx +++ b/apps/web/components/AI/Hooks/useGetAIFeatures.tsx @@ -11,7 +11,13 @@ function useGetAIFeatures(props: UseGetAIFeatures) { const [isEnabled, setisEnabled] = React.useState(false) function checkAvailableAIFeaturesOnOrg(feature: string) { - const config = org.config.config.AIConfig; + const config = org?.config?.config?.AIConfig; + + if (!config) { + console.log("AI or Organization config is not defined."); + return false; + } + if (!config.enabled) { console.log("AI is not enabled for this Organization."); return false;