diff --git a/blocksuite/blocks/src/root-block/widgets/ai-panel/components/state/error.ts b/blocksuite/blocks/src/root-block/widgets/ai-panel/components/state/error.ts index 3ea8c75eae..995e6bc134 100644 --- a/blocksuite/blocks/src/root-block/widgets/ai-panel/components/state/error.ts +++ b/blocksuite/blocks/src/root-block/widgets/ai-panel/components/state/error.ts @@ -155,7 +155,7 @@ export class AIPanelError extends WithDisposable(LitElement) { Cancel
- login + Login
`, ], diff --git a/packages/frontend/core/src/blocksuite/presets/_common/components/text-renderer.ts b/packages/frontend/core/src/blocksuite/presets/_common/components/text-renderer.ts index de3080e4ee..50b30d67a4 100644 --- a/packages/frontend/core/src/blocksuite/presets/_common/components/text-renderer.ts +++ b/packages/frontend/core/src/blocksuite/presets/_common/components/text-renderer.ts @@ -100,6 +100,7 @@ export class TextRenderer extends WithDisposable(ShadowlessElement) { .ai-answer-text-editor .affine-page-root-block-container { padding: 0; + margin: 0; line-height: var(--affine-line-height); color: var(--affine-text-primary-color); font-weight: 400; diff --git a/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/copilot-client.ts b/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/copilot-client.ts index cfb7ee2674..46536f7547 100644 --- a/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/copilot-client.ts +++ b/packages/frontend/core/src/components/blocksuite/block-suite-editor/ai/copilot-client.ts @@ -72,57 +72,77 @@ export class CopilotClient { async createSession( options: OptionsField ) { - const res = await this.gql({ - query: createCopilotSessionMutation, - variables: { - options, - }, - }); - return res.createCopilotSession; + try { + const res = await this.gql({ + query: createCopilotSessionMutation, + variables: { + options, + }, + }); + return res.createCopilotSession; + } catch (err) { + throw resolveError(err); + } } async updateSession( options: OptionsField ) { - const res = await this.gql({ - query: updateCopilotSessionMutation, - variables: { - options, - }, - }); - return res.updateCopilotSession; + try { + const res = await this.gql({ + query: updateCopilotSessionMutation, + variables: { + options, + }, + }); + return res.updateCopilotSession; + } catch (err) { + throw resolveError(err); + } } async forkSession(options: OptionsField) { - const res = await this.gql({ - query: forkCopilotSessionMutation, - variables: { - options, - }, - }); - return res.forkCopilotSession; + try { + const res = await this.gql({ + query: forkCopilotSessionMutation, + variables: { + options, + }, + }); + return res.forkCopilotSession; + } catch (err) { + throw resolveError(err); + } } async createMessage( options: OptionsField ) { - const res = await this.gql({ - query: createCopilotMessageMutation, - variables: { - options, - }, - }); - return res.createCopilotMessage; + try { + const res = await this.gql({ + query: createCopilotMessageMutation, + variables: { + options, + }, + }); + return res.createCopilotMessage; + } catch (err) { + throw resolveError(err); + } } async getSessions(workspaceId: string) { - const res = await this.gql({ - query: getCopilotSessionsQuery, - variables: { - workspaceId, - }, - }); - return res.currentUser?.copilot; + try { + const res = await this.gql({ + query: getCopilotSessionsQuery, + variables: { + workspaceId, + }, + }); + return res.currentUser?.copilot; + } catch (err) { + throw resolveError(err); + } } async getHistories( @@ -132,16 +152,20 @@ export class CopilotClient { typeof getCopilotHistoriesQuery >['variables']['options'] ) { - const res = await this.gql({ - query: getCopilotHistoriesQuery, - variables: { - workspaceId, - docId, - options, - }, - }); + try { + const res = await this.gql({ + query: getCopilotHistoriesQuery, + variables: { + workspaceId, + docId, + options, + }, + }); - return res.currentUser?.copilot?.histories; + return res.currentUser?.copilot?.histories; + } catch (err) { + throw resolveError(err); + } } async getHistoryIds( @@ -151,16 +175,20 @@ export class CopilotClient { typeof getCopilotHistoriesQuery >['variables']['options'] ) { - const res = await this.gql({ - query: getCopilotHistoryIdsQuery, - variables: { - workspaceId, - docId, - options, - }, - }); + try { + const res = await this.gql({ + query: getCopilotHistoryIdsQuery, + variables: { + workspaceId, + docId, + options, + }, + }); - return res.currentUser?.copilot?.histories; + return res.currentUser?.copilot?.histories; + } catch (err) { + throw resolveError(err); + } } async cleanupSessions(input: { @@ -168,13 +196,17 @@ export class CopilotClient { docId: string; sessionIds: string[]; }) { - const res = await this.gql({ - query: cleanupCopilotSessionMutation, - variables: { - input, - }, - }); - return res.cleanupCopilotSession; + try { + const res = await this.gql({ + query: cleanupCopilotSessionMutation, + variables: { + input, + }, + }); + return res.cleanupCopilotSession; + } catch (err) { + throw resolveError(err); + } } async chatText({