fix(view): restore per-cell kernel switch and Clean

Code cards again show a kernel selector and a Clean button. Clean calls /api/session/cell/clear for live sessions and clears local output in static snapshots, without restarting kernels.
This commit is contained in:
cflmy committed 2026-10-18 13:27:15 +08:00
1 parent 05d48f68a4
commit 15362cb048
6 files changed
+109 -13

No files matched your search

+9
View File
@@ -170,6 +170,15 @@ where
}
}
pub fn api_clear_cell(root: &Path, body: &str) -> serde_json::Value {
let v = body_value(body);
let cell = v.get("cell").and_then(|x| x.as_str()).unwrap_or("");
if cell.is_empty() {
return err("missing cell".into());
}
with_session(root, body, "cleared", |s| s.clear_cell(cell))
}
pub fn api_clear(root: &Path, body: &str) -> serde_json::Value {
with_session(root, body, "cleared", |s| Ok(s.clear_outputs()))
}