@iola_adm/iola-cli 0.2.3 → 0.2.4
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/package.json +1 -1
- package/src/cli.js +49 -10
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -701,6 +701,7 @@ async function startAgent() {
|
|
|
701
701
|
setTerminalTitle(`iola - ${path.basename(process.cwd()) || process.cwd()}`);
|
|
702
702
|
await showBanner();
|
|
703
703
|
await ensureAgentAiReady();
|
|
704
|
+
await printActiveAiModelLine();
|
|
704
705
|
console.log("Интерактивный режим. Введите /help для списка команд, /master чтобы запустить мастер настройки, /exit для выхода.");
|
|
705
706
|
await runHooks("SessionStart", { mode: "agent" });
|
|
706
707
|
|
|
@@ -714,6 +715,16 @@ async function startAgent() {
|
|
|
714
715
|
await runHooks("SessionEnd", { mode: "agent" });
|
|
715
716
|
}
|
|
716
717
|
|
|
718
|
+
async function printActiveAiModelLine() {
|
|
719
|
+
const config = await loadConfig();
|
|
720
|
+
const name = getActiveProfileName(config);
|
|
721
|
+
const profile = config.ai.profiles?.[name] || {
|
|
722
|
+
provider: config.ai.provider,
|
|
723
|
+
model: config.ai.model,
|
|
724
|
+
};
|
|
725
|
+
console.log(`Активная модель: ${name} (${profile.provider || "-"}, ${profile.model || "-"})`);
|
|
726
|
+
}
|
|
727
|
+
|
|
717
728
|
async function ensureAgentAiReady() {
|
|
718
729
|
const readiness = await getAiReadiness();
|
|
719
730
|
if (readiness.ready) return readiness;
|
|
@@ -4852,17 +4863,38 @@ function normalizeModelMenuTarget(value = "") {
|
|
|
4852
4863
|
}
|
|
4853
4864
|
|
|
4854
4865
|
async function chooseModelTarget() {
|
|
4866
|
+
const active = await getActiveAiSummary();
|
|
4855
4867
|
console.log("Выберите AI-подключение:");
|
|
4856
|
-
console.log(
|
|
4857
|
-
console.log(
|
|
4858
|
-
console.log(
|
|
4859
|
-
console.log(
|
|
4868
|
+
console.log(` 1. Локальные модели${active.group === "local" ? " [выбрано]" : ""}`);
|
|
4869
|
+
console.log(` 2. Российские AI (YandexGPT/GigaChat)${active.group === "russian" ? " [выбрано]" : ""}`);
|
|
4870
|
+
console.log(` 3. API (OpenAI/OpenRouter)${active.group === "api" ? " [выбрано]" : ""}`);
|
|
4871
|
+
console.log(` 4. Codex CLI${active.group === "codex" ? " [выбрано]" : ""}`);
|
|
4860
4872
|
console.log(" 0. Отмена");
|
|
4861
4873
|
|
|
4862
4874
|
const answer = await askText("Номер: ");
|
|
4863
4875
|
return { 1: "local", 2: "russian", 3: "api", 4: "codex" }[answer.trim()] || "";
|
|
4864
4876
|
}
|
|
4865
4877
|
|
|
4878
|
+
async function getActiveAiSummary() {
|
|
4879
|
+
const config = await loadConfig();
|
|
4880
|
+
const name = getActiveProfileName(config);
|
|
4881
|
+
const profile = config.ai.profiles?.[name] || {
|
|
4882
|
+
provider: config.ai.provider,
|
|
4883
|
+
model: config.ai.model,
|
|
4884
|
+
};
|
|
4885
|
+
const provider = profile.provider || "";
|
|
4886
|
+
const group = provider === "iola" || provider === "ollama"
|
|
4887
|
+
? "local"
|
|
4888
|
+
: provider === "yandexgpt" || provider === "gigachat"
|
|
4889
|
+
? "russian"
|
|
4890
|
+
: provider === "openai" || provider === "openrouter"
|
|
4891
|
+
? "api"
|
|
4892
|
+
: provider === "codex"
|
|
4893
|
+
? "codex"
|
|
4894
|
+
: "";
|
|
4895
|
+
return { name, provider, model: profile.model || "", group };
|
|
4896
|
+
}
|
|
4897
|
+
|
|
4866
4898
|
async function openModelTargetMenu(target) {
|
|
4867
4899
|
if (target === "local") {
|
|
4868
4900
|
const selection = await chooseLocalModel();
|
|
@@ -4904,9 +4936,10 @@ async function openModelTargetMenu(target) {
|
|
|
4904
4936
|
|
|
4905
4937
|
async function chooseApiProvider() {
|
|
4906
4938
|
const config = await loadConfig();
|
|
4939
|
+
const active = await getActiveAiSummary();
|
|
4907
4940
|
const apiProfiles = Object.entries(config.ai.profiles || {})
|
|
4908
4941
|
.filter(([, profile]) => profile.provider === "openai" || profile.provider === "openrouter")
|
|
4909
|
-
.map(([name, profile]) => ({ id: profile.provider, label: `${name}: ${profile.provider} (${profile.model || "-"})` }));
|
|
4942
|
+
.map(([name, profile]) => ({ id: profile.provider, label: `${name}: ${profile.provider} (${profile.model || "-"})${active.provider === profile.provider ? " [выбрано]" : ""}` }));
|
|
4910
4943
|
const choices = [
|
|
4911
4944
|
...apiProfiles,
|
|
4912
4945
|
{ id: "openai", label: "OpenAI API" },
|
|
@@ -4923,9 +4956,10 @@ async function chooseApiProvider() {
|
|
|
4923
4956
|
|
|
4924
4957
|
async function chooseRussianProvider() {
|
|
4925
4958
|
const config = await loadConfig();
|
|
4959
|
+
const active = await getActiveAiSummary();
|
|
4926
4960
|
const russianProfiles = Object.entries(config.ai.profiles || {})
|
|
4927
4961
|
.filter(([, profile]) => profile.provider === "yandexgpt" || profile.provider === "gigachat")
|
|
4928
|
-
.map(([name, profile]) => ({ id: profile.provider, label: `${name}: ${profile.provider} (${profile.model || "-"})` }));
|
|
4962
|
+
.map(([name, profile]) => ({ id: profile.provider, label: `${name}: ${profile.provider} (${profile.model || "-"})${active.provider === profile.provider ? " [выбрано]" : ""}` }));
|
|
4929
4963
|
const choices = [
|
|
4930
4964
|
...russianProfiles,
|
|
4931
4965
|
{ id: "yandexgpt", label: "YandexGPT API" },
|
|
@@ -4949,15 +4983,16 @@ async function getDefaultApiProviderForModelSwitch() {
|
|
|
4949
4983
|
}
|
|
4950
4984
|
|
|
4951
4985
|
async function chooseLocalModel() {
|
|
4986
|
+
const active = await getActiveAiSummary();
|
|
4952
4987
|
const models = await listAiModels("ollama");
|
|
4953
4988
|
const choices = [
|
|
4954
|
-
{ id: IOLA_LOCAL_MODEL, provider: "iola", label: `${IOLA_LOCAL_MODEL} - IOLA local router` },
|
|
4989
|
+
{ id: IOLA_LOCAL_MODEL, provider: "iola", label: `${IOLA_LOCAL_MODEL} - IOLA local router${active.provider === "iola" && active.model === IOLA_LOCAL_MODEL ? " [выбрано]" : ""}` },
|
|
4955
4990
|
...models
|
|
4956
4991
|
.filter((model) => model.id !== IOLA_LOCAL_MODEL)
|
|
4957
4992
|
.map((model) => ({
|
|
4958
4993
|
id: model.id,
|
|
4959
4994
|
provider: "ollama",
|
|
4960
|
-
label: `${model.id}${model.note ? ` - ${model.note}` : ""}`,
|
|
4995
|
+
label: `${model.id}${model.note ? ` - ${model.note}` : ""}${active.provider === "ollama" && active.model === model.id ? " [выбрано]" : ""}`,
|
|
4961
4996
|
})),
|
|
4962
4997
|
{ id: "__manual__", provider: "ollama", label: "Другая Ollama-модель: ввести имя вручную" },
|
|
4963
4998
|
].filter((item, index, array) => array.findIndex((candidate) => candidate.id === item.id) === index);
|
|
@@ -4980,6 +5015,7 @@ async function chooseLocalModel() {
|
|
|
4980
5015
|
}
|
|
4981
5016
|
|
|
4982
5017
|
async function chooseAiModel(provider) {
|
|
5018
|
+
const active = await getActiveAiSummary();
|
|
4983
5019
|
if (provider === "openrouter") {
|
|
4984
5020
|
return chooseOpenRouterModel();
|
|
4985
5021
|
}
|
|
@@ -5025,7 +5061,8 @@ async function chooseAiModel(provider) {
|
|
|
5025
5061
|
console.log("Выберите модель:");
|
|
5026
5062
|
filtered.forEach((model, index) => {
|
|
5027
5063
|
const date = model.releaseDate ? ` (${model.releaseDate})` : "";
|
|
5028
|
-
|
|
5064
|
+
const selected = active.provider === provider && active.model === model.id ? " [выбрано]" : "";
|
|
5065
|
+
console.log(` ${index + 1}. ${model.id}${date}${model.note ? ` - ${model.note}` : ""}${selected}`);
|
|
5029
5066
|
});
|
|
5030
5067
|
console.log(" 0. Отмена");
|
|
5031
5068
|
|
|
@@ -5034,6 +5071,7 @@ async function chooseAiModel(provider) {
|
|
|
5034
5071
|
}
|
|
5035
5072
|
|
|
5036
5073
|
async function chooseOpenRouterModel() {
|
|
5074
|
+
const active = await getActiveAiSummary();
|
|
5037
5075
|
const ready = await ensureApiKeyForModelSelection("openrouter");
|
|
5038
5076
|
if (!ready) return "";
|
|
5039
5077
|
|
|
@@ -5078,7 +5116,8 @@ async function chooseOpenRouterModel() {
|
|
|
5078
5116
|
filtered.forEach((model, index) => {
|
|
5079
5117
|
const date = model.releaseDate || "дата неизвестна";
|
|
5080
5118
|
const context = model.contextLength ? `, ctx ${formatCompactNumber(model.contextLength)}` : "";
|
|
5081
|
-
|
|
5119
|
+
const selected = active.provider === "openrouter" && active.model === model.id ? " [выбрано]" : "";
|
|
5120
|
+
console.log(` ${index + 1}. ${model.id} (${date}${context}) - ${model.note || model.id}${selected}`);
|
|
5082
5121
|
});
|
|
5083
5122
|
console.log(" 0. Назад");
|
|
5084
5123
|
|