@iola_adm/iola-cli 0.1.113 → 0.2.0

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/README.md CHANGED
@@ -133,6 +133,14 @@ CLI использует модель `iola-router:qwen3-1.7b-v4-q8` из GGUF-
133
133
 
134
134
  В интерактивном CLI команда `/model` переключает локальную модель IOLA, API-профили OpenAI/OpenRouter и Codex CLI. Для OpenRouter выбор устроен так: сначала выбирается разработчик моделей, затем CLI показывает до 30 самых свежих моделей для текстовой работы с датой релиза и размером контекста. В списке моделей `0` возвращает к выбору разработчика.
135
135
 
136
+ В локальном выборе доступны:
137
+
138
+ - штатная модель IOLA `iola-router:qwen3-1.7b-v4-q8`;
139
+ - установленные и рекомендуемые модели Ollama;
140
+ - ручной ввод имени любой Ollama-модели, например `qwen3:4b` или `llama3.2:3b`.
141
+
142
+ Если выбранная Ollama-модель еще не скачана, CLI предложит выполнить `ollama pull`.
143
+
136
144
  Ollama остается опциональным runtime:
137
145
 
138
146
  ```bash
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iola_adm/iola-cli",
3
- "version": "0.1.113",
3
+ "version": "0.2.0",
4
4
  "description": "CLI и AI-агент городского округа Йошкар-Ола.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/adm-iola/iola-cli#readme",
package/src/cli.js CHANGED
@@ -4795,8 +4795,8 @@ async function chooseModelTarget() {
4795
4795
 
4796
4796
  async function openModelTargetMenu(target) {
4797
4797
  if (target === "local") {
4798
- const model = await chooseAiModel("iola");
4799
- if (model) await switchModelTarget("local", model);
4798
+ const selection = await chooseLocalModel();
4799
+ if (selection?.model) await switchModelTarget(selection.provider, selection.model);
4800
4800
  return;
4801
4801
  }
4802
4802
 
@@ -4845,6 +4845,37 @@ async function getDefaultApiProviderForModelSwitch() {
4845
4845
  return apiProfile?.provider || "openai";
4846
4846
  }
4847
4847
 
4848
+ async function chooseLocalModel() {
4849
+ const models = await listAiModels("ollama");
4850
+ const choices = [
4851
+ { id: IOLA_LOCAL_MODEL, provider: "iola", label: `${IOLA_LOCAL_MODEL} - IOLA local router` },
4852
+ ...models
4853
+ .filter((model) => model.id !== IOLA_LOCAL_MODEL)
4854
+ .map((model) => ({
4855
+ id: model.id,
4856
+ provider: "ollama",
4857
+ label: `${model.id}${model.note ? ` - ${model.note}` : ""}`,
4858
+ })),
4859
+ { id: "__manual__", provider: "ollama", label: "Другая Ollama-модель: ввести имя вручную" },
4860
+ ].filter((item, index, array) => array.findIndex((candidate) => candidate.id === item.id) === index);
4861
+
4862
+ console.log("Выберите локальную модель:");
4863
+ choices.forEach((choice, index) => console.log(` ${index + 1}. ${choice.label}`));
4864
+ console.log(" 0. Отмена");
4865
+
4866
+ const answer = Number(await askText("Номер: "));
4867
+ const selected = choices[answer - 1];
4868
+ if (!selected) return null;
4869
+
4870
+ if (selected.id === "__manual__") {
4871
+ const model = (await askText("Имя Ollama-модели, например qwen3:4b: ")).trim();
4872
+ if (!model) return null;
4873
+ return { provider: "ollama", model };
4874
+ }
4875
+
4876
+ return { provider: selected.provider, model: selected.id };
4877
+ }
4878
+
4848
4879
  async function chooseAiModel(provider) {
4849
4880
  if (provider === "openrouter") {
4850
4881
  return chooseOpenRouterModel();
@@ -4988,7 +5019,9 @@ async function switchModelTarget(target, model) {
4988
5019
  if (!ready) return;
4989
5020
  }
4990
5021
  const profileName = provider === "ollama" || provider === "iola" ? "local" : provider;
4991
- const currentProfile = config.ai.profiles?.[profileName] || buildProfileFromOptions(provider, { model });
5022
+ const currentProfile = (provider === "ollama" || provider === "iola")
5023
+ ? buildProfileFromOptions(provider, { model })
5024
+ : (config.ai.profiles?.[profileName] || buildProfileFromOptions(provider, { model }));
4992
5025
  const profile = {
4993
5026
  ...currentProfile,
4994
5027
  provider,
@@ -55,6 +55,8 @@ assertIncludes(cliSource, "\\x1b[1m$1\\x1b[22m", "AI answer renderer should supp
55
55
  assertIncludes(cliSource, "ensureApiKeyForModelSelection", "API model selection should prompt for missing provider keys");
56
56
  assertIncludes(cliSource, "isOpenAiTextGenerationModel", "OpenAI model selection should filter technical and legacy models");
57
57
  assertIncludes(cliSource, "dedupeDatedOpenAiModels", "OpenAI model selection should hide dated duplicates when aliases exist");
58
+ assertIncludes(cliSource, "chooseLocalModel", "Local model selection should support IOLA and Ollama models");
59
+ assertIncludes(cliSource, "Другая Ollama-модель", "Local model selection should allow manual Ollama model names");
58
60
 
59
61
  const commands = await runCli(["commands"]);
60
62
  assertIncludes(commands, "iola browser status|install|open|text|html|screenshot|pdf|click|type|eval", "commands");
@@ -10,6 +10,14 @@ iola ai profile use local
10
10
  iola ask "найди школы на Петрова"
11
11
  ```
12
12
 
13
+ В интерактивном агенте команда `/model` открывает выбор локальной модели. В локальном меню доступны:
14
+
15
+ - штатная модель IOLA `iola-router:qwen3-1.7b-v4-q8`;
16
+ - установленные и рекомендуемые модели Ollama;
17
+ - ручной ввод имени любой Ollama-модели.
18
+
19
+ Если выбранная Ollama-модель еще не установлена, CLI предложит скачать ее через `ollama pull`. При выборе сторонней Ollama-модели профиль `local` сохраняется как `provider: ollama`; при выборе штатной модели IOLA профиль `local` возвращается к `provider: iola`.
20
+
13
21
  ## OpenAI
14
22
 
15
23
  ```bash
@@ -28,6 +28,8 @@ iola master
28
28
 
29
29
  Если модель уже скачана и доступна, пункт показывается как `готово`.
30
30
 
31
+ После настройки локальную модель можно менять в интерактивном агенте через `/model`. Помимо штатной IOLA-модели можно выбрать установленную или рекомендуемую Ollama-модель, либо вручную ввести имя любой модели из библиотеки Ollama.
32
+
31
33
  ### 4. OpenAI API
32
34
 
33
35
  Настраивает профиль OpenAI и сохраняет API-ключ локально у пользователя.