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

This commit is contained in:
pengx17
2024-04-29 11:14:07 +00:00
parent 7c5a259e84
commit 5c861939a5
3 changed files with 13 additions and 2 deletions
@@ -14,7 +14,7 @@ export interface Notification {
foreground?: string;
alignMessage?: 'title' | 'icon';
action?: {
label: string;
label: ReactNode;
onClick: (() => void) | (() => Promise<void>);
buttonProps?: ButtonProps;
/**
@@ -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" />
),
});
});
}
+2 -1
View File
@@ -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"
}