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: provide user info for copilot (#6606)

Peng Xiao10653eccbceb
diff --git a/packages/frontend/core/src/modules/cloud/services/auth.ts b/packages/frontend/core/src/modules/cloud/services/auth.ts
index 49248abc17..8f955c0a3d 100644
--- a/packages/frontend/core/src/modules/cloud/services/auth.ts
+++ b/packages/frontend/core/src/modules/cloud/services/auth.ts
@@ -1,5 +1,6 @@
import { apis } from '@affine/electron-api';
import type { OAuthProviderType } from '@affine/graphql';
+import { AIProvider } from '@blocksuite/presets';
import {
ApplicationFocused,
ApplicationStarted,
@@ -34,6 +35,17 @@ export class AuthService extends Service {
) {
super();
+ AIProvider.provide('userInfo', () => {
+ const account = this.session.account$.value;
+ if (!account) return null;
+ return {
+ avatarUrl: account.avatar ?? '',
+ email: account.email ?? '',
+ id: account.id,
+ name: account.label,
+ };
+ });
+
this.session.account$
.pipe(
map(a => ({