orquesta-cli 0.2.86 → 0.2.87
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.
|
@@ -322,22 +322,23 @@ export class ConfigManager {
|
|
|
322
322
|
added++;
|
|
323
323
|
}
|
|
324
324
|
}
|
|
325
|
+
const serverDefaultId = orquestaEndpoints.find((e) => e.is_default === true)?.id;
|
|
326
|
+
const serverDefault = serverDefaultId ? config.endpoints.find((e) => e.id === serverDefaultId) : undefined;
|
|
327
|
+
const batuta = config.endpoints.find((e) => e.provider === 'batuta' || e.id === 'batuta-proxy');
|
|
325
328
|
const currentExists = !!config.currentEndpoint && config.endpoints.some((e) => e.id === config.currentEndpoint);
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
config.currentModel = enabledModel.id;
|
|
329
|
+
const preferred = serverDefault || batuta || (!currentExists ? config.endpoints[0] : undefined);
|
|
330
|
+
if (preferred) {
|
|
331
|
+
config.currentEndpoint = preferred.id;
|
|
332
|
+
const m = preferred.models.find((x) => x.enabled) || preferred.models[0];
|
|
333
|
+
if (m)
|
|
334
|
+
config.currentModel = m.id;
|
|
333
335
|
}
|
|
334
336
|
else if (currentExists) {
|
|
335
337
|
const ep = config.endpoints.find((e) => e.id === config.currentEndpoint);
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
config.currentModel = enabledModel.id;
|
|
338
|
+
if (!ep.models.some((m) => m.id === config.currentModel)) {
|
|
339
|
+
const m = ep.models.find((x) => x.enabled) || ep.models[0];
|
|
340
|
+
if (m)
|
|
341
|
+
config.currentModel = m.id;
|
|
341
342
|
}
|
|
342
343
|
}
|
|
343
344
|
await this.saveConfig();
|