Develop #16

Merged
tao.chen merged 273 commits from develop into main 2026-08-21 10:42:09 +08:00
Showing only changes of commit 1ef9961307 - Show all commits
@@ -184,6 +184,15 @@ function AuthenticatedModelPlatformApp() {
selectedIdRef.current = nextSelectedId;
return nextSelectedId;
});
// 同时更新打开的标签页
setOpenTabIds((current) => {
const firstNotebook = items.find((item) => item.script_type === "notebook")?.script_id
?? items[0]?.script_id;
if (!firstNotebook) return [];
// 如果当前标签页已经包含,则保持不变
if (current.includes(firstNotebook)) return current;
return [firstNotebook];
});
} catch (error) {
setApiOnline(false);
setToast({
@@ -200,6 +209,20 @@ function AuthenticatedModelPlatformApp() {
void load();
}, []);
// 切换 Workspace 时重置状态并重新加载
useEffect(() => {
setScripts([]);
setDirectories([]);
setSelectedId(null);
setOpenTabIds([]);
setLatestVersion(null);
setEmbeddedJupyterUrl(null);
setEditSession(null);
editSessionRef.current = null;
selectedIdRef.current = null;
void load();
}, [currentWorkspace.workspace_id]);
useEffect(() => {
if (!toast) return;
const timer = window.setTimeout(() => setToast(null), 3200);