Skip to content

Commit af1f6cd

Browse files
committed
Revert "Merge branch 'main' of github.com:TypeCellOS/BlockNote"
This reverts commit 86887fa, reversing changes made to 7d223de.
1 parent 86887fa commit af1f6cd

File tree

340 files changed

+5328
-5428
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

340 files changed

+5328
-5428
lines changed

CHANGELOG.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,3 @@
1-
## 0.44.0 (2025-12-02)
2-
3-
### 🚀 Features
4-
5-
- **ai:** Abort requests ([#2213](https://github.com/TypeCellOS/BlockNote/pull/2213))
6-
7-
### ❤️ Thank You
8-
9-
- Yousef
10-
111
## 0.43.0 (2025-12-01)
122

133
### 🚀 Features

docs/app/(home)/hero/DemoEditor.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
import {
22
BlockNoteSchema,
33
combineByGroup,
4+
filterSuggestionItems,
45
uploadToTmpFilesDotOrg_DEV_ONLY,
56
} from "@blocknote/core";
6-
import { filterSuggestionItems } from "@blocknote/core/extensions";
7-
import "@blocknote/core/fonts/inter.css";
87
import * as locales from "@blocknote/core/locales";
9-
import { BlockNoteView } from "@blocknote/mantine";
10-
import "@blocknote/mantine/style.css";
8+
import "@blocknote/core/fonts/inter.css";
119
import {
1210
getDefaultReactSlashMenuItems,
1311
SuggestionMenuController,
1412
useCreateBlockNote,
1513
} from "@blocknote/react";
14+
import { BlockNoteView } from "@blocknote/mantine";
1615
import {
1716
getMultiColumnSlashMenuItems,
18-
multiColumnDropCursor,
1917
locales as multiColumnLocales,
18+
multiColumnDropCursor,
2019
withMultiColumn,
2120
} from "@blocknote/xl-multi-column";
21+
import "@blocknote/mantine/style.css";
2222
import { useTheme } from "next-themes";
2323
import { useCallback, useMemo, useState } from "react";
2424
import YPartyKitProvider from "y-partykit/provider";

docs/content/docs/features/ai/backend-integration.mdx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,12 @@ The most common (and recommended) setup to integrate BlockNote AI with an LLM is
1111
## Default setup (Vercel AI SDK)
1212

1313
The example below closely follows the [basic example from the Vercel AI SDK](https://ai-sdk.dev/docs/ai-sdk-ui/chatbot#example) for Next.js.
14-
The only difference is that we're retrieving the BlockNote tools from the request body and using the `toolDefinitionsToToolSet` function to convert them to AI SDK tools. We also forward the serialized document state (selection, cursor, block IDs) that BlockNote adds to every user message by calling `injectDocumentStateMessages`. The LLM will now be able to invoke these tools to make modifications to the BlockNote document as requested by the user. The tool calls are forwarded to the client application where they're handled automatically by the AI Extension.
14+
The only difference is that we're retrieving the BlockNote tools from the request body and using the `toolDefinitionsToToolSet` function to convert them to AI SDK tools. The LLM will now be able to invoke these tools to make modifications to the BlockNote document as requested by the user. The tool calls are forwarded to the client application where they're handled automatically by the AI Extension.
1515

1616
```ts app/api/chat/route.ts
1717
import { openai } from "@ai-sdk/openai";
1818
import { convertToModelMessages, streamText } from "ai";
19-
import {
20-
aiDocumentFormats,
21-
injectDocumentStateMessages,
22-
toolDefinitionsToToolSet,
23-
} from "@blocknote/xl-ai/server";
19+
import { toolDefinitionsToToolSet } from "@blocknote/xl-ai";
2420

2521
// Allow streaming responses up to 30 seconds
2622
export const maxDuration = 30;
@@ -30,8 +26,7 @@ export async function POST(req: Request) {
3026

3127
const result = streamText({
3228
model: openai("gpt-4.1"), // see https://ai-sdk.dev/docs/foundations/providers-and-models
33-
system: aiDocumentFormats.html.systemPrompt,
34-
messages: convertToModelMessages(injectDocumentStateMessages(messages)),
29+
messages: convertToModelMessages(messages),
3530
tools: toolDefinitionsToToolSet(toolDefinitions),
3631
toolChoice: "required",
3732
});
@@ -70,7 +65,7 @@ const model = createOpenAICompatible({
7065
})('model-id');
7166

7267
// ...
73-
AIExtension({
68+
createAIExtension({
7469
transport: new ClientSideTransport({
7570
model,
7671
}),
@@ -108,4 +103,4 @@ You can connect BlockNote AI features with more advanced AI pipelines. You can i
108103
with BlockNote AI, [get in touch](/about).
109104
</Callout>
110105

111-
- By default, BlockNote AI sends the entire LLM chat history to the backend. See [the server persistence example](https://github.com/TypeCellOS/BlockNote/tree/main/examples/09-ai/07-server-persistence) for a pattern where the backend stores chat and only the latest message is sent to the backend.
106+
- By default, BlockNote AI composes the LLM request (messages) based on the user's prompt and passes these to your backend. See [this example](https://github.com/TypeCellOS/BlockNote/blob/main/examples/09-ai/07-server-promptbuilder/src/App.tsx) for an example where composing the LLM request (prompt building) is delegated to the server.

docs/content/docs/features/ai/getting-started.mdx

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { createBlockNoteEditor } from "@blocknote/core";
2525
import { BlockNoteAIExtension } from "@blocknote/xl-ai";
2626
import { en } from "@blocknote/core/locales";
2727
import { en as aiEn } from "@blocknote/xl-ai/locales";
28-
import { AIExtension } from "@blocknote/xl-ai";
28+
import { createAIExtension } from "@blocknote/xl-ai";
2929
import "@blocknote/xl-ai/style.css"; // add the AI stylesheet
3030

3131
const editor = createBlockNoteEditor({
@@ -34,7 +34,7 @@ const editor = createBlockNoteEditor({
3434
ai: aiEn, // add default translations for the AI extension
3535
},
3636
extensions: [
37-
AIExtension({
37+
createAIExtension({
3838
transport: new DefaultChatTransport({
3939
api: `/api/chat`,
4040
}),
@@ -44,7 +44,7 @@ const editor = createBlockNoteEditor({
4444
});
4545
```
4646

47-
See the [API Reference](/docs/features/ai/reference) for more information on the `AIExtension` options.
47+
See the [API Reference](/docs/features/ai/reference) for more information on the `createAIExtension` method.
4848

4949
## Adding AI UI elements
5050

@@ -85,11 +85,7 @@ This example follows the [basic example from the AI SDK](https://ai-sdk.dev/docs
8585
```ts app/api/chat/route.ts
8686
import { openai } from "@ai-sdk/openai";
8787
import { convertToModelMessages, streamText } from "ai";
88-
import {
89-
aiDocumentFormats,
90-
injectDocumentStateMessages,
91-
toolDefinitionsToToolSet,
92-
} from "@blocknote/xl-ai/server";
88+
import { toolDefinitionsToToolSet } from "@blocknote/xl-ai";
9389

9490
// Allow streaming responses up to 30 seconds
9591
export const maxDuration = 30;
@@ -99,8 +95,7 @@ export async function POST(req: Request) {
9995

10096
const result = streamText({
10197
model: openai("gpt-4.1"), // see https://ai-sdk.dev/docs/foundations/providers-and-models
102-
system: aiDocumentFormats.html.systemPrompt,
103-
messages: convertToModelMessages(injectDocumentStateMessages(messages)),
98+
messages: convertToModelMessages(messages),
10499
tools: toolDefinitionsToToolSet(toolDefinitions),
105100
toolChoice: "required",
106101
});
@@ -109,12 +104,6 @@ export async function POST(req: Request) {
109104
}
110105
```
111106

112-
This follows the regular `streamText` pattern of the AI SDK, with 3 exceptions:
113-
114-
- the BlockNote document state is extracted from message metadata and injected into the messages, using `injectDocumentStateMessages`
115-
- BlockNote client-side tool definitions are extracted from the request body and passed to the LLM using `toolDefinitionsToToolSet`
116-
- The system prompt is set to the default BlockNote system prompt (`aiDocumentFormats.html.systemPrompt`). You can override or extend the system prompt. If you do so, make sure your modified system prompt still explains the AI on how to modify the BlockNote document.
117-
118107
See [Backend integrations](/docs/features/ai/backend-integration) for more information on how to integrate BlockNote AI with your backend.
119108

120109
# Full Example

0 commit comments

Comments
 (0)