Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

681 B
Raw Blame
import type {Dialog} from "../dialog";

const dialogs = new Map<Dialog, Set<string>>();

export const trackNotebookHistoryDialog = (dialog: Dialog, notebooks: string[]) => {
    dialogs.set(dialog, new Set(notebooks));
};

export const forgetNotebookHistoryDialog = (dialog: Dialog) => {
    dialogs.delete(dialog);
};

export const closeNotebookHistoryDialogs = (notebook: string) => {
    // 从上层详情开始关闭,避免焦点返回已经销毁的下层对话框。
    Array.from(dialogs.entries()).reverse().forEach(([dialog, notebooks]) => {
        if (notebooks.has(notebook)) {
            dialog.destroy();
            dialogs.delete(dialog);
        }
    });
};