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: should not swallow copilot errors (#6609)

pengx17e232b0b285d2
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 a6fa5ad93c..1982e64364 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
@@ -84,7 +84,7 @@ export class CopilotClient {
return res.currentUser?.copilot?.histories;
}
- chatText({
+ async chatText({
sessionId,
messageId,
message,
@@ -113,13 +113,8 @@ export class CopilotClient {
});
}
- return new Promise(resolve => {
- fetch(url.toString())
- .then(res => {
- resolve(res.text());
- })
- .catch(console.error);
- });
+ const response = await fetch(url.toString());
+ return response.text();
}
// Text or image to text