|
@@ -7,11 +7,10 @@ import {
|
|
|
|
|
|
|
|
import { AiAssistantShareScope, AiAssistantAccessScope } from '~/features/openai/interfaces/ai-assistant';
|
|
import { AiAssistantShareScope, AiAssistantAccessScope } from '~/features/openai/interfaces/ai-assistant';
|
|
|
import type { PopulatedGrantedGroup } from '~/interfaces/page-grant';
|
|
import type { PopulatedGrantedGroup } from '~/interfaces/page-grant';
|
|
|
-import { useCurrentUser } from '~/stores-universal/context';
|
|
|
|
|
|
|
+import { useCurrentUser, useLimitLearnablePageCount } from '~/stores-universal/context';
|
|
|
|
|
|
|
|
import type { SelectedPage } from '../../../../interfaces/selected-page';
|
|
import type { SelectedPage } from '../../../../interfaces/selected-page';
|
|
|
import { determineShareScope } from '../../../../utils/determine-share-scope';
|
|
import { determineShareScope } from '../../../../utils/determine-share-scope';
|
|
|
-import { isLearnablePageLimitExceeded } from '../../../../utils/is-learnable-page-limit-exceeded';
|
|
|
|
|
import { useAiAssistantManagementModal, AiAssistantManagementModalPageMode } from '../../../stores/ai-assistant';
|
|
import { useAiAssistantManagementModal, AiAssistantManagementModalPageMode } from '../../../stores/ai-assistant';
|
|
|
|
|
|
|
|
import { ShareScopeWarningModal } from './ShareScopeWarningModal';
|
|
import { ShareScopeWarningModal } from './ShareScopeWarningModal';
|
|
@@ -49,6 +48,7 @@ export const AiAssistantManagementHome = (props: Props): JSX.Element => {
|
|
|
|
|
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
|
const { data: currentUser } = useCurrentUser();
|
|
const { data: currentUser } = useCurrentUser();
|
|
|
|
|
+ const { data: limitLearnablePageCount } = useLimitLearnablePageCount();
|
|
|
const { close: closeAiAssistantManagementModal, changePageMode } = useAiAssistantManagementModal();
|
|
const { close: closeAiAssistantManagementModal, changePageMode } = useAiAssistantManagementModal();
|
|
|
|
|
|
|
|
const [isShareScopeWarningModalOpen, setIsShareScopeWarningModalOpen] = useState(false);
|
|
const [isShareScopeWarningModalOpen, setIsShareScopeWarningModalOpen] = useState(false);
|
|
@@ -70,7 +70,7 @@ export const AiAssistantManagementHome = (props: Props): JSX.Element => {
|
|
|
: t(baseLabel);
|
|
: t(baseLabel);
|
|
|
}, [currentUser?.username, t]);
|
|
}, [currentUser?.username, t]);
|
|
|
|
|
|
|
|
- const canUpsert = name !== '' && selectedPages.length !== 0 && !isLearnablePageLimitExceeded(totalSelectedPageCount);
|
|
|
|
|
|
|
+ const canUpsert = name !== '' && selectedPages.length !== 0 && (limitLearnablePageCount ?? 3000) >= totalSelectedPageCount;
|
|
|
|
|
|
|
|
const upsertAiAssistantHandler = useCallback(async() => {
|
|
const upsertAiAssistantHandler = useCallback(async() => {
|
|
|
const shouldWarning = () => {
|
|
const shouldWarning = () => {
|