Skip to content

Commit 5c7bb42

Browse files
fix: doLLMRequest fails when deleting a non-existent block (#1982)
1 parent d41a572 commit 5c7bb42

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/xl-ai/src/api/LLMRequest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ export async function doLLMRequest(
231231
...rest,
232232
},
233233
() => {
234-
if (deleteCursorBlock) {
234+
if (deleteCursorBlock && editor.getBlock(deleteCursorBlock)) {
235235
editor.removeBlocks([deleteCursorBlock]);
236236
}
237237
onStart?.();
@@ -242,7 +242,7 @@ export async function doLLMRequest(
242242
messages,
243243
...rest,
244244
});
245-
if (deleteCursorBlock) {
245+
if (deleteCursorBlock && editor.getBlock(deleteCursorBlock)) {
246246
editor.removeBlocks([deleteCursorBlock]);
247247
}
248248
onStart?.();

0 commit comments

Comments
 (0)