feat: async snapshot refresh after heavy operations complete

This commit is contained in:
Research Assistant 2026-05-15 23:38:01 +08:00
parent 871a1574db
commit f612b191fc

View file

@ -2734,6 +2734,7 @@ class PaperForgeSettingTab extends PluginSettingTab {
}
// Refresh status regardless
this._memoryStatusText = memoryState.getMemoryStatusText(vp);
this._refreshSnapshots(vp);
}
});
};
@ -2774,11 +2775,29 @@ class PaperForgeSettingTab extends PluginSettingTab {
this._lastSyncTime = new Date().toLocaleTimeString();
this.plugin._lastSyncTime = this._lastSyncTime;
}
this.display(); // re-render
this.display();
this._refreshSnapshots(vp);
}
});
}
_refreshSnapshots(vp) {
const py = memoryState.getCachedPython(vp, this.plugin.settings);
const { execFile } = require('node:child_process');
const args = [...py.extraArgs, '-m', 'paperforge', '--vault', vp, 'runtime-health', '--json'];
this._refreshPending = true;
execFile(py.path, args, { cwd: vp, timeout: 30000, windowsHide: true },
(err, stdout, stderr) => {
this._refreshPending = false;
this._memoryStatusText = memoryState.getMemoryStatusText(vp);
this._embedStatusText = memoryState.getVectorStatusText(vp);
this.display();
}
);
}
_renderFeaturesTab(containerEl) {
// --- Section: Skills ---
containerEl.createEl('h3', { text: 'Skills' });
@ -3443,6 +3462,7 @@ class PaperForgeSettingTab extends PluginSettingTab {
}
this._embedStderr = '';
this.display();
this._refreshSnapshots(vp);
}
});