fix: add missing require execFile + instant UI clear on mode toggle

This commit is contained in:
Research Assistant 2026-05-16 00:34:09 +08:00
parent 3e875e9634
commit bf7f71f3d7

View file

@ -3383,9 +3383,13 @@ class PaperForgeSettingTab extends PluginSettingTab {
.onChange(value => {
this.plugin.settings.vector_db_mode = value;
this.plugin.saveSettings();
// Regenerate vector-runtime-state.json for new mode
// Clear cache immediately — show "checking..." then refresh in background
this._vectorDepsOk = null;
this._embedStatusText = null;
this.display();
const vp = this.app.vault.adapter.basePath;
const py = memoryState.getCachedPython(vp, this.plugin.settings);
const { execFile } = require('node:child_process');
const args = [...py.extraArgs, '-m', 'paperforge', '--vault', vp, 'embed', 'status', '--json'];
execFile(py.path, args, { cwd: vp, timeout: 15000, windowsHide: true }, () => {
this._vectorDepsOk = null;