🚩(frontend) add Analytics feature flag on Blocknote AI

We want to have a fine grained control over the
Blocknote AI feature.
By adding the feature Analytics feature flag,
we can enable or disable this feature for specific
users or groups without deploying new code.
This allows us to test the feature in a controlled
environment and gather feedback before a full rollout.
This commit is contained in:
Anthony LC
2026-02-26 12:25:43 +01:00
parent 1070b91d2f
commit a51ceeb409
3 changed files with 6 additions and 0 deletions

View File

@@ -19,6 +19,7 @@ and this project adheres to
- ✨(backend) allow the duplication of subpages #1893
- ✨(backend) Onboarding docs for new users #1891
- 🩺(trivy) add trivyignore file and add minimatch CVE #1915
- 🚩 Add feature flags for the AI feature #1922
### Changed

View File

@@ -24,7 +24,9 @@ import { useConfig } from '@/core';
import { useCunninghamTheme } from '@/cunningham';
import { Doc, useProviderStore } from '@/docs/doc-management';
import { avatarUrlFromName, useAuth } from '@/features/auth';
import { useAnalytics } from '@/libs/Analytics';
import { AI_FEATURE_FLAG } from '../conf';
import {
useHeadings,
useSaveDoc,
@@ -105,9 +107,11 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => {
const { uploadFile, errorAttachment } = useUploadFile(doc.id);
const conf = useConfig().data;
const { isFeatureFlagActivated } = useAnalytics();
const aiBlockNoteAllowed = !!(
conf?.AI_FEATURE_ENABLED &&
conf?.AI_FEATURE_BLOCKNOTE_ENABLED &&
isFeatureFlagActivated(AI_FEATURE_FLAG) &&
doc.abilities?.ai_proxy
);
const aiExtension = useAI?.(doc.id, aiBlockNoteAllowed);

View File

@@ -1 +1,2 @@
export const ANALYZE_URL = 'media-check';
export const AI_FEATURE_FLAG = 'ai_blocknote';