mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-29 16:03:45 +03:00
fix: provide user info for copilot (#6606)
This commit is contained in:
parent
ccb3bed91e
commit
10653eccbc
@ -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 => ({
|
||||
|
Loading…
Reference in New Issue
Block a user