ueberdosis / tiptap

The headless rich text editor framework for web artisans.
https://tiptap.dev
MIT License
26.93k stars 2.24k forks source link

[PRO]: Streaming for AI Write command #5301

Closed heymartinadams closed 1 month ago

heymartinadams commented 3 months ago

Affected Packages

extension-ai

Version(s)

2.9.2

Description of the Bug

For some reason, when selecting AI Writer, the results don’t get streamed.

https://github.com/ueberdosis/tiptap/assets/11673745/ae339847-108c-4786-a747-7a74ba2c6efc

Browser Used

Chrome

Code Example (Preferred)

No response

Expected Behavior

I’m assuming it will stream, not load and then print the output all at once.

Additional Context (Optional)

I’ve added stream: true to the codebase, but nothing changed:

export const AiWriter = Node.create({
    name: 'aiWriter',
...
    addOptions() {
        return {
            authorId: undefined,
            authorName: undefined,
            HTMLAttributes: {
                class: `node-${this.name}`
            },
            stream: true // ← Added this
        }
    },
...
})

Dependency Updates

nperez0111 commented 3 months ago

Streaming is a new feature so it is only available in the latest versions of @tiptap-pro/extension-ai@2.9.1 and higher. Can you confirm what version you are using?

This looks like the tiptap template, which we have not gotten around to integrating just yet.

nperez0111 commented 3 months ago

It also is not an option that would go on the AiWriter instance. It would be part of a text command that executes the AI op

heymartinadams commented 3 months ago

Using 2.9.2.

heymartinadams commented 3 months ago

It also is not an option that would go on the AiWriter instance. It would be part of a text command that executes the AI op

@nperez0111, how would I modify this text command to get it to stream?

nperez0111 commented 3 months ago

We have not updated that example since it actually goes around using the ai extension. But you can see the docs for the ai extension here: https://tiptap.dev/docs/content-ai/capabilities/text-generation/built-in-commands

Particularly this demo will probably be the most useful: https://tiptap.dev/docs/content-ai/capabilities/text-generation/format

nperez0111 commented 1 month ago

This is resolved on the templates repo