mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 14:27:02 +08:00
fix: provide user info for copilot (#6606)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { apis } from '@affine/electron-api';
|
import { apis } from '@affine/electron-api';
|
||||||
import type { OAuthProviderType } from '@affine/graphql';
|
import type { OAuthProviderType } from '@affine/graphql';
|
||||||
|
import { AIProvider } from '@blocksuite/presets';
|
||||||
import {
|
import {
|
||||||
ApplicationFocused,
|
ApplicationFocused,
|
||||||
ApplicationStarted,
|
ApplicationStarted,
|
||||||
@@ -34,6 +35,17 @@ export class AuthService extends Service {
|
|||||||
) {
|
) {
|
||||||
super();
|
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$
|
this.session.account$
|
||||||
.pipe(
|
.pipe(
|
||||||
map(a => ({
|
map(a => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user