Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for streaming messages #52

Open
jtpio opened this issue Jun 10, 2024 · 3 comments
Open

Support for streaming messages #52

jtpio opened this issue Jun 10, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@jtpio
Copy link
Member

jtpio commented Jun 10, 2024

Problem

Currently messages are added to the chat in one go. See this screencast as an example:

jupyterlab-codestral-demo-lite.webm

However most of the AI chat UIs stream responses to the user, for example:

mistral-ai-chat.webm

Proposed Solution

Add optional support for streaming messages, which could be enabled via the settings editor or by extensions.

Additional context

This would be useful for AI extensions using jupyter-chat for interacting with some online AI providers, such as https://github.com/jtpio/jupyterlab-codestral

@jtpio jtpio added the enhancement New feature or request label Jun 10, 2024
@jtpio
Copy link
Member Author

jtpio commented Jun 11, 2024

This might already be possible in some way by a plugin, by calling the updateMessage method:

/**
* Optional, to update a message from the chat panel.
*
* @param id - the unique ID of the message.
* @param message - the updated message.
*/
updateMessage?(
id: string,
message: IChatMessage
): Promise<boolean | void> | boolean | void;

@brichet
Copy link
Collaborator

brichet commented Jun 11, 2024

This might already be possible in some way by a plugin, by calling the updateMessage method:

Yes, this is possible but will call the RendermimeMarkdown for the whole content on every update.

To avoid this, we could find a way to tell the message component to append the new content to the DOM, using the appendContent flag:

(appendContent ? (
<div ref={node => node && node.appendChild(renderedContent)} />
) : (

@jtpio
Copy link
Member Author

jtpio commented Jun 17, 2024

Linking to jupyterlab/jupyter-ai#228 as related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants