@iola_adm/iola-cli 0.2.9 → 0.2.10
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/bin/postinstall.js +1 -1
- package/package.json +1 -1
- package/src/cli.js +47 -20
package/bin/postinstall.js
CHANGED
|
@@ -19,7 +19,7 @@ const steps = [
|
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
21
|
title: "Проверка локальной модели IOLA",
|
|
22
|
-
args: [cliPath, "ai", "setup", "iola", "--yes", "--quiet", "--optional"],
|
|
22
|
+
args: [cliPath, "ai", "setup", "iola", "--yes", "--quiet", "--optional", "--preserve-active"],
|
|
23
23
|
},
|
|
24
24
|
];
|
|
25
25
|
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -1961,9 +1961,10 @@ async function doctor(args = []) {
|
|
|
1961
1961
|
printKeyValue(report.ai);
|
|
1962
1962
|
console.log("");
|
|
1963
1963
|
console.log("Skills/Toolsets/Daemon");
|
|
1964
|
-
|
|
1964
|
+
printKeyValueFull({ ...report.skills, toolsets: report.toolsets.enabled, daemon: report.daemon.status });
|
|
1965
1965
|
console.log("");
|
|
1966
|
-
|
|
1966
|
+
const isLocalAi = ["iola", "ollama"].includes(activeAiProfile.provider);
|
|
1967
|
+
printDiagnostics(diagnostics, isLocalAi ? recommendOllamaModel(diagnostics) : null);
|
|
1967
1968
|
if (options.all) {
|
|
1968
1969
|
console.log("");
|
|
1969
1970
|
console.log("Фичи");
|
|
@@ -7838,25 +7839,32 @@ async function setupIolaLocal(args) {
|
|
|
7838
7839
|
}
|
|
7839
7840
|
|
|
7840
7841
|
const config = await loadConfig();
|
|
7842
|
+
const localProfile = {
|
|
7843
|
+
provider: "iola",
|
|
7844
|
+
model,
|
|
7845
|
+
runtime,
|
|
7846
|
+
baseUrl: "http://127.0.0.1:11434",
|
|
7847
|
+
repo,
|
|
7848
|
+
ggufRepo,
|
|
7849
|
+
ggufFile,
|
|
7850
|
+
modelDir,
|
|
7851
|
+
};
|
|
7852
|
+
const shouldActivate = !options["preserve-active"];
|
|
7853
|
+
const previousActiveProfile = getActiveProfileName(config);
|
|
7854
|
+
const nextActiveProfile = shouldActivate ? profileName : previousActiveProfile;
|
|
7855
|
+
const nextActiveConfig = nextActiveProfile === profileName
|
|
7856
|
+
? localProfile
|
|
7857
|
+
: (config.ai.profiles?.[nextActiveProfile] || config.ai.profiles?.[previousActiveProfile] || localProfile);
|
|
7841
7858
|
await saveConfig({
|
|
7842
7859
|
ai: {
|
|
7843
7860
|
...config.ai,
|
|
7844
|
-
activeProfile:
|
|
7845
|
-
provider:
|
|
7846
|
-
model,
|
|
7847
|
-
baseUrl:
|
|
7861
|
+
activeProfile: nextActiveProfile,
|
|
7862
|
+
provider: nextActiveConfig.provider,
|
|
7863
|
+
model: nextActiveConfig.model,
|
|
7864
|
+
baseUrl: nextActiveConfig.baseUrl || config.ai.baseUrl,
|
|
7848
7865
|
profiles: {
|
|
7849
7866
|
...(config.ai.profiles || {}),
|
|
7850
|
-
[profileName]:
|
|
7851
|
-
provider: "iola",
|
|
7852
|
-
model,
|
|
7853
|
-
runtime,
|
|
7854
|
-
baseUrl: "http://127.0.0.1:11434",
|
|
7855
|
-
repo,
|
|
7856
|
-
ggufRepo,
|
|
7857
|
-
ggufFile,
|
|
7858
|
-
modelDir,
|
|
7859
|
-
},
|
|
7867
|
+
[profileName]: localProfile,
|
|
7860
7868
|
},
|
|
7861
7869
|
},
|
|
7862
7870
|
});
|
|
@@ -10707,7 +10715,7 @@ function parseOptions(args) {
|
|
|
10707
10715
|
|
|
10708
10716
|
for (let index = 0; index < args.length; index += 1) {
|
|
10709
10717
|
const arg = args[index];
|
|
10710
|
-
if (arg === "--json" || arg === "--yes" || arg === "--silent" || arg === "--events" || arg === "--stream-json" || arg === "--stdio" || arg === "--system" || arg === "--headed" || arg === "--headless" || arg === "--no-history" || arg === "--summary" || arg === "--all" || arg === "--full" || arg === "--unread" || arg === "--once" || arg === "--local" || arg === "--cache" || arg === "--tools" || arg === "--files" || arg === "--plan" || arg === "--trace" || arg === "--diff" || arg === "--stage" || arg === "--fts" || arg === "--bare" || arg === "--quiet" || arg === "--optional" || arg === "--project" || arg === "--dry-run" || arg === "--no-color" || arg === "--fail-on-empty" || arg === "--debug" || arg === "--fix" || arg === "--append") {
|
|
10718
|
+
if (arg === "--json" || arg === "--yes" || arg === "--silent" || arg === "--events" || arg === "--stream-json" || arg === "--stdio" || arg === "--system" || arg === "--headed" || arg === "--headless" || arg === "--no-history" || arg === "--summary" || arg === "--all" || arg === "--full" || arg === "--unread" || arg === "--once" || arg === "--local" || arg === "--cache" || arg === "--tools" || arg === "--files" || arg === "--plan" || arg === "--trace" || arg === "--diff" || arg === "--stage" || arg === "--fts" || arg === "--bare" || arg === "--quiet" || arg === "--optional" || arg === "--project" || arg === "--dry-run" || arg === "--no-color" || arg === "--fail-on-empty" || arg === "--debug" || arg === "--fix" || arg === "--append" || arg === "--preserve-active") {
|
|
10711
10719
|
result[arg.slice(2)] = true;
|
|
10712
10720
|
} else if (arg === "--check" || arg === "--upgrade-node") {
|
|
10713
10721
|
result.check = true;
|
|
@@ -12404,8 +12412,8 @@ async function executeRpc(method, options = {}) {
|
|
|
12404
12412
|
|
|
12405
12413
|
async function getLatestNpmVersion(packageName) {
|
|
12406
12414
|
try {
|
|
12407
|
-
const response = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`, {
|
|
12408
|
-
headers: { accept: "application/json" },
|
|
12415
|
+
const response = await fetch(`https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest?t=${Date.now()}`, {
|
|
12416
|
+
headers: { accept: "application/json", "cache-control": "no-cache" },
|
|
12409
12417
|
});
|
|
12410
12418
|
|
|
12411
12419
|
if (!response.ok) {
|
|
@@ -12480,8 +12488,11 @@ function printDiagnostics(diagnostics, recommendation) {
|
|
|
12480
12488
|
vram: diagnostics.gpu.vramGb ? `${diagnostics.gpu.vramGb} GB` : "-",
|
|
12481
12489
|
ollama: diagnostics.ollama.installed ? diagnostics.ollama.version : "не установлен",
|
|
12482
12490
|
});
|
|
12491
|
+
if (!recommendation) {
|
|
12492
|
+
return;
|
|
12493
|
+
}
|
|
12483
12494
|
console.log("");
|
|
12484
|
-
console.log("Рекомендация");
|
|
12495
|
+
console.log("Рекомендация локальной модели");
|
|
12485
12496
|
printKeyValue({
|
|
12486
12497
|
profile: recommendation.profile,
|
|
12487
12498
|
model: recommendation.model,
|
|
@@ -12666,6 +12677,9 @@ function sanitizeConfig(config) {
|
|
|
12666
12677
|
if (Array.isArray(next.skills?.enabled) && next.skills.enabled.includes("open-data") && !next.skills.enabled.includes("education")) {
|
|
12667
12678
|
next.skills.enabled = ["education", ...next.skills.enabled];
|
|
12668
12679
|
}
|
|
12680
|
+
if (Array.isArray(next.skills?.enabled) && next.skills.enabled.includes("open-data") && !next.skills.enabled.includes("geo")) {
|
|
12681
|
+
next.skills.enabled = [...next.skills.enabled, "geo"];
|
|
12682
|
+
}
|
|
12669
12683
|
if (Array.isArray(next.skills?.enabled) && next.skills.enabled.includes("local-files") && !next.skills.enabled.includes("personal-docs")) {
|
|
12670
12684
|
next.skills.enabled = [...next.skills.enabled, "personal-docs"];
|
|
12671
12685
|
}
|
|
@@ -13052,6 +13066,19 @@ function printKeyValue(value) {
|
|
|
13052
13066
|
]);
|
|
13053
13067
|
}
|
|
13054
13068
|
|
|
13069
|
+
function printKeyValueFull(value) {
|
|
13070
|
+
const rows = Object.entries(value).map(([key, raw]) => ({
|
|
13071
|
+
key,
|
|
13072
|
+
value: raw == null || raw === "" ? "-" : String(raw),
|
|
13073
|
+
}));
|
|
13074
|
+
const keyWidth = Math.max(4, ...rows.map((row) => visibleLength(row.key)));
|
|
13075
|
+
console.log(`${padCell("Поле", keyWidth)} Значение`);
|
|
13076
|
+
console.log(`${"-".repeat(keyWidth)} ${"-".repeat(8)}`);
|
|
13077
|
+
for (const row of rows) {
|
|
13078
|
+
console.log(`${padCell(row.key, keyWidth)} ${row.value}`);
|
|
13079
|
+
}
|
|
13080
|
+
}
|
|
13081
|
+
|
|
13055
13082
|
function printTable(rows, columns) {
|
|
13056
13083
|
if (rows.length === 0) {
|
|
13057
13084
|
console.log("Нет данных.");
|