Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: media console outputs from serialized notebook (#5388)

Akshay Agrawal7b278acd6123
diff --git a/frontend/src/core/cells/session.ts b/frontend/src/core/cells/session.ts
index badf525c8a..d27f91541c 100644
--- a/frontend/src/core/cells/session.ts
+++ b/frontend/src/core/cells/session.ts
@@ -214,12 +214,24 @@ function createCellRuntimeFromSession(
return {
...runtimeState,
outline: runtimeState.output ? parseOutline(runtimeState.output) : null,
- consoleOutputs: consoleOutputs.map((consoleOutput) => ({
- channel: consoleOutput.name === "stderr" ? "stderr" : "stdout",
- data: consoleOutput.text,
- mimetype: "text/plain",
- timestamp: DEFAULT_TIMESTAMP,
- })),
+ consoleOutputs: consoleOutputs.map((consoleOutput) => {
+ // Handle StreamMediaOutput (type: "streamMedia")
+ if (consoleOutput.type === "streamMedia") {
+ return {
+ channel: "media",
+ data: consoleOutput.data,
+ mimetype: consoleOutput.mimetype,
+ timestamp: DEFAULT_TIMESTAMP,
+ };
+ }
+ // Handle StreamOutput (type: "stream")
+ return {
+ channel: consoleOutput.name === "stderr" ? "stderr" : "stdout",
+ data: consoleOutput.text,
+ mimetype: "text/plain",
+ timestamp: DEFAULT_TIMESTAMP,
+ };
+ }),
};
}