Files
upstream-rocketchat/apps/meteor/client/views/admin/aiCenter/AICenterOverview.tsx
upstream-mirror 30810eecd7
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 2s
snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
2026-09-16 01:21:02 +05:00

89 lines
3.5 KiB
TypeScript

import { AI_LICENSE_MODULE } from '@rocket.chat/ai-search';
import { Box, Button, Callout, CardGrid, Tag } from '@rocket.chat/fuselage';
import { Page, PageHeader, PageScrollableContentWithShadow } from '@rocket.chat/ui-client';
import { useRouter, useSetting } from '@rocket.chat/ui-contexts';
import type { ReactElement, ReactNode } from 'react';
import { useTranslation } from 'react-i18next';
import AICenterCapabilityCard from './AICenterCapabilityCard';
import PageSkeleton from '../../../components/PageSkeleton';
import { useHasLicenseModule } from '../../../hooks/useHasLicenseModule';
const AICenterOverview = (): ReactElement => {
const { t } = useTranslation();
const router = useRouter();
const { data: hasAILicense, isPending } = useHasLicenseModule(AI_LICENSE_MODULE);
const intelligentSearchEnabled = useSetting('AI_Intelligent_Search_Enabled', false);
const mcpEnabled = useSetting('MCP_Enabled', false);
const searchSettingsHref = router.buildRoutePath({ name: 'admin-ai-center', params: { section: 'search' } });
const llmSettingsHref = router.buildRoutePath({ name: 'admin-ai-center', params: { section: 'llm-providers' } });
const mcpSettingsHref = router.buildRoutePath({ name: 'admin-ai-center', params: { section: 'mcp' } });
const subscriptionHref = router.buildRoutePath({ name: 'subscription' });
if (isPending) {
return <PageSkeleton />;
}
let aiSearchStatus: ReactNode;
let llmProviderStatus: ReactNode;
let mcpStatus: ReactNode;
if (hasAILicense === false) {
aiSearchStatus = <Tag variant='danger'>{t('Locked')}</Tag>;
llmProviderStatus = <Tag variant='danger'>{t('Locked')}</Tag>;
mcpStatus = <Tag variant='danger'>{t('Locked')}</Tag>;
} else if (hasAILicense) {
aiSearchStatus = intelligentSearchEnabled ? <Tag variant='primary'>{t('Enabled')}</Tag> : <Tag>{t('Disabled')}</Tag>;
llmProviderStatus = <Tag>{t('Available')}</Tag>;
mcpStatus = mcpEnabled ? <Tag variant='primary'>{t('Enabled')}</Tag> : <Tag>{t('Disabled')}</Tag>;
}
return (
<Page background='tint'>
<PageHeader title={t('AI_Center')} />
<PageScrollableContentWithShadow padding={24}>
<Box marginInline='auto' width='full'>
{hasAILicense === false && (
<Callout type='info' icon='stars' title={t('AI_Center_license_required_title')} marginBlockEnd={24}>
<Box>{t('AI_Center_license_required_description')}</Box>
<Button is='a' href={subscriptionHref} small marginBlockStart={12}>
{t('View_options')}
</Button>
</Callout>
)}
<Box is='h2' fontScale='h3' marginBlockEnd={16}>
{t('Capabilities')}
</Box>
<CardGrid breakpoints={{ xs: 4, sm: 4, md: 6, lg: 6, xl: 6 }}>
<AICenterCapabilityCard
icon='stars'
title={t('Intelligent_Search')}
description={t('AI_Center_Intelligent_Search_card_description')}
status={aiSearchStatus}
actionLabel={t('Configure')}
href={searchSettingsHref}
/>
<AICenterCapabilityCard
icon='smart'
title={t('AI_Center_LLM_Providers')}
description={t('AI_Center_LLM_Providers_card_description')}
status={llmProviderStatus}
actionLabel={t('Manage')}
href={llmSettingsHref}
/>
<AICenterCapabilityCard
icon='link'
title={t('MCP')}
description={t('AI_Center_MCP_card_description')}
status={mcpStatus}
actionLabel={t('Configure')}
href={mcpSettingsHref}
/>
</CardGrid>
</Box>
</PageScrollableContentWithShadow>
</Page>
);
};
export default AICenterOverview;