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.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
feat(core): handle copilot errors (#8546)
darkskygit6f1535014dfa
diff --git a/packages/frontend/core/src/blocksuite/presets/ai/provider.ts b/packages/frontend/core/src/blocksuite/presets/ai/provider.tsindex 9ddcbd5e12..bb7d801b2d 100644--- a/packages/frontend/core/src/blocksuite/presets/ai/provider.ts+++ b/packages/frontend/core/src/blocksuite/presets/ai/provider.ts@@ -4,6 +4,7 @@ import {UnauthorizedError,} from '@blocksuite/affine/blocks';import { Slot } from '@blocksuite/affine/store';+import { captureException } from '@sentry/react';export interface AIUserInfo {id: string;@@ -171,7 +172,9 @@ export class AIProvider {if (isTextStream(result)) {return {[Symbol.asyncIterator]: async function* () {+ let user = null;try {+ user = await AIProvider.userInfo;yield* result;slots.actions.emit({action: id,@@ -202,14 +205,23 @@ export class AIProvider {options,event: 'aborted:server-error',});+ captureException(err, {+ user: { id: user?.id },+ extra: {+ action: id,+ session: AIProvider.LAST_ACTION_SESSIONID,+ },+ });}throw err;}},};} else {+ let user: any = null;return result- .then(result => {+ .then(async result => {+ user = await AIProvider.userInfo;slots.actions.emit({action: id,options,@@ -229,6 +241,14 @@ export class AIProvider {options,event: 'aborted:paywall',});+ } else {+ captureException(err, {+ user: { id: user?.id },+ extra: {+ action: id,+ session: AIProvider.LAST_ACTION_SESSIONID,+ },+ });}throw err;});