@autotask/atools-tool 0.1.4 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/install.mjs +5 -3
- package/package.json +1 -1
package/lib/install.mjs
CHANGED
|
@@ -249,9 +249,10 @@ function patchOpenclawConfig(openclawHome, provider, model, port, dryRun) {
|
|
|
249
249
|
|
|
250
250
|
function patchAgentModels(openclawHome, provider, model, port, apiKey, dryRun) {
|
|
251
251
|
const modelsPath = path.join(openclawHome, 'agents/main/agent/models.json');
|
|
252
|
-
const models = readJsonIfExists(modelsPath);
|
|
253
|
-
|
|
254
|
-
|
|
252
|
+
const models = readJsonIfExists(modelsPath) || { providers: {} };
|
|
253
|
+
const creatingNewModelsFile = !fs.existsSync(modelsPath);
|
|
254
|
+
if (creatingNewModelsFile) {
|
|
255
|
+
info(`agent models config not found, will create: ${modelsPath}`);
|
|
255
256
|
}
|
|
256
257
|
|
|
257
258
|
const baseUrl = `http://127.0.0.1:${port}/v1`;
|
|
@@ -293,6 +294,7 @@ function patchAgentModels(openclawHome, provider, model, port, apiKey, dryRun) {
|
|
|
293
294
|
info(`dry-run: would patch ${modelsPath}`);
|
|
294
295
|
return;
|
|
295
296
|
}
|
|
297
|
+
ensureDir(path.dirname(modelsPath));
|
|
296
298
|
const bak = backup(modelsPath);
|
|
297
299
|
if (bak) info(`backup created: ${bak}`);
|
|
298
300
|
writeJson(modelsPath, models);
|