Yuki Takei 7 месяцев назад
Родитель
Сommit
0199f3f7fc

+ 3 - 2
apps/app/src/features/openai/client/components/AiAssistant/AiAssistantManagementModal/AiAssistantManagementEditPages.tsx

@@ -1,10 +1,11 @@
 import React, { useCallback, type JSX } from 'react';
 
+import { useAtomValue } from 'jotai';
 import { useTranslation } from 'react-i18next';
 import { ModalBody } from 'reactstrap';
 import SimpleBar from 'simplebar-react';
 
-import { useLimitLearnablePageCountPerAssistant } from '~/states/server-configurations';
+import { limitLearnablePageCountPerAssistantAtom } from '~/states/server-configurations';
 
 import type { SelectablePage } from '../../../../interfaces/selectable-page';
 
@@ -19,7 +20,7 @@ type Props = {
 
 export const AiAssistantManagementEditPages = (props: Props): JSX.Element => {
   const { t } = useTranslation();
-  const [limitLearnablePageCountPerAssistant] = useLimitLearnablePageCountPerAssistant();
+  const limitLearnablePageCountPerAssistant = useAtomValue(limitLearnablePageCountPerAssistantAtom);
 
   const { selectedPages, onRemove } = props;
 

+ 4 - 3
apps/app/src/features/openai/client/components/AiAssistant/AiAssistantManagementModal/AiAssistantManagementHome.tsx

@@ -2,6 +2,7 @@ import React, {
   useCallback, useState, useMemo, useRef, useEffect, type JSX,
 } from 'react';
 
+import { useAtomValue } from 'jotai';
 import { useTranslation } from 'react-i18next';
 import {
   ModalBody, ModalFooter, Input,
@@ -10,7 +11,7 @@ import {
 import { AiAssistantShareScope, AiAssistantAccessScope } from '~/features/openai/interfaces/ai-assistant';
 import type { PopulatedGrantedGroup } from '~/interfaces/page-grant';
 import { useCurrentUser } from '~/states/global';
-import { useLimitLearnablePageCountPerAssistant } from '~/states/server-configurations';
+import { limitLearnablePageCountPerAssistantAtom } from '~/states/server-configurations';
 
 import type { SelectablePage } from '../../../../interfaces/selectable-page';
 import { determineShareScope } from '../../../../utils/determine-share-scope';
@@ -53,8 +54,8 @@ export const AiAssistantManagementHome = (props: Props): JSX.Element => {
   } = props;
 
   const { t } = useTranslation();
-  const [currentUser] = useCurrentUser();
-  const [limitLearnablePageCountPerAssistant] = useLimitLearnablePageCountPerAssistant();
+  const currentUser = useCurrentUser();
+  const limitLearnablePageCountPerAssistant = useAtomValue(limitLearnablePageCountPerAssistantAtom);
   const { close: closeAiAssistantManagementModal, changePageMode } = useAiAssistantManagementModal();
 
   const [isShareScopeWarningModalOpen, setIsShareScopeWarningModalOpen] = useState(false);