diff --git a/scripts/install.mjs b/scripts/install.mjs index 857702b..02532a2 100755 --- a/scripts/install.mjs +++ b/scripts/install.mjs @@ -197,12 +197,10 @@ if (mode === "install") { ok("plugin configured"); step(5, 7, "configure no-reply provider"); - const providers = getJson("models.providers") || {}; - providers[NO_REPLY_PROVIDER_ID] = { + setJson(`models.providers.${NO_REPLY_PROVIDER_ID}`, { baseUrl: NO_REPLY_BASE_URL, apiKey: NO_REPLY_API_KEY, api: "openai-completions", models: [{ id: NO_REPLY_MODEL_ID, name: `${NO_REPLY_MODEL_ID} (Custom Provider)`, reasoning: false, input: ["text"], cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 }, contextWindow: 200000, maxTokens: 8192 }], - }; - setJson("models.providers", providers); + }); ok("provider configured"); step(6, 7, "add no-reply model to allowlist"); @@ -229,10 +227,8 @@ if (mode === "uninstall") { ok("removed plugin entry"); step(2, 4, "remove plugin load path"); - const plugins = getJson("plugins") || {}; - const paths = Array.isArray(plugins?.load?.paths) ? plugins.load.paths : []; - plugins.load = plugins.load || {}; plugins.load.paths = paths.filter((p) => p !== PLUGIN_INSTALL_DIR); - setJson("plugins", plugins); + const paths = getJson("plugins.load.paths") || []; + setJson("plugins.load.paths", paths.filter((p) => p !== PLUGIN_INSTALL_DIR)); ok("removed load path"); step(3, 4, "remove installed files");