Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): show toast for requestRunInEdgeless (#6715)

pengx175c861939a51f
diff --git a/packages/frontend/component/src/ui/notification/types.ts b/packages/frontend/component/src/ui/notification/types.ts
index f7b7bf8d22..adbc59deab 100644
--- a/packages/frontend/component/src/ui/notification/types.ts
+++ b/packages/frontend/component/src/ui/notification/types.ts
@@ -14,7 +14,7 @@ export interface Notification {
foreground?: string;
alignMessage?: 'title' | 'icon';
action?: {
- label: string;
+ label: ReactNode;
onClick: (() => void) | (() => Promise<void>);
buttonProps?: ButtonProps;
/**
diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.ts b/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.tsx
similarity index 97%
rename from packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.ts
rename to packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.tsx
index 373ed2047a..275ce2f5c2 100644
--- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.ts
+++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/provider.tsx
@@ -1,6 +1,8 @@
+import { notify } from '@affine/component';
import { authAtom, openSettingModalAtom } from '@affine/core/atoms';
import { mixpanel } from '@affine/core/utils';
import { getBaseUrl } from '@affine/graphql';
+import { Trans } from '@affine/i18n';
import { assertExists } from '@blocksuite/global/utils';
import { AIProvider } from '@blocksuite/presets';
import { getCurrentStore } from '@toeverything/infra';
@@ -388,4 +390,12 @@ export function setupAIProvider() {
openModal: true,
}));
});
+
+ AIProvider.slots.requestRunInEdgeless.on(() => {
+ notify.warning({
+ title: (
+ <Trans i18nKey="com.affine.ai.action.edgeless-only.dialog-title" />
+ ),
+ });
+ });
}
diff --git a/packages/frontend/i18n/src/resources/en.json b/packages/frontend/i18n/src/resources/en.json
index d629a09dcf..77fdc68bc5 100644
--- a/packages/frontend/i18n/src/resources/en.json
+++ b/packages/frontend/i18n/src/resources/en.json
@@ -1311,5 +1311,6 @@
"com.affine.ai.login-required.dialog-title": "Sign in to Continue",
"com.affine.ai.login-required.dialog-content": "To use AFFiNE AI, please sign in to your AFFiNE Cloud account.",
"com.affine.ai.login-required.dialog-confirm": "Sign in",
- "com.affine.ai.login-required.dialog-cancel": "Cancel"
+ "com.affine.ai.login-required.dialog-cancel": "Cancel",
+ "com.affine.ai.action.edgeless-only.dialog-title": "Please switch to edgeless mode"
}