Support displaying mime bundles in the chat#272
Merged
brichet merged 2 commits intojupyterlite:mainfrom Feb 23, 2026
Merged
Conversation
brichet
approved these changes
Feb 23, 2026
src/chat-model.ts
Outdated
| status: 'pending', | ||
| summary | ||
| summary, | ||
| commandId |
Collaborator
There was a problem hiding this comment.
Any advantage of sending the command id ?
Regarding the use case, it seems that we could send only the shouldAutoRenderMimeBundles.
| const outputAreaCompat = new RenderedMessageOutputAreaCompat({ | ||
| chatPanel: widget | ||
| }); | ||
|
|
Collaborator
There was a problem hiding this comment.
Do you think that every chat message should have the class jp-OutputArea ?
Is it something that could/should be fixed in Jupyterlab ?
Member
Author
There was a problem hiding this comment.
Not sure yet. For now it seems like jupyterlab-geojson relies on jp-OutputArea: https://github.com/jupyterlab/jupyter-renderers/blob/b89c093bce24c8d7394177f08a111b3895ed6870/packages/geojson-extension/style/base.css#L23-L26
But maybe it's only the case for some isolated extensions.
| - The chat UI can render rich MIME outputs as separate assistant messages. | ||
| - ${supportedMimeTypesInstruction} | ||
| - Use only MIME types from the supported list when creating MIME bundles. Do not invent MIME keys. | ||
| - Do not claim that you cannot display maps, images, or rich outputs in chat. |
Collaborator
|
Thanks, LGTM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Leverage jupyterlab/jupyter-chat#349
Mime bundle rendering logic
When the AI model executes a command that produces rich outputs (plots, JSON, HTML, etc.), those outputs are automatically rendered as chat messages right below the tool call widget.
This only happens for commands explicitly listed in the settings (default is
jupyterlab-ai-commands:execute-in-kernel), to avoid replaying unintended outputs from inspection commands (like getting information about an executed cell).MIME types listed in the settings for auto-render (default is
text/html) are rendered with full trust, enabling things like interactive HTML. Other MIME types (JSON, images, etc.) render without needing to be trusted.Changes
execute-in-kernelcommands to display them in the chatExamples
Plotly
jupyterlite-ai-plotly-graph.mp4
Maps
jupyterlite-ai-rich-map.mp4