srpllm 1.2.0 → 1.2.2

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/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import cac from 'cac';
3
3
  import ansis from 'ansis';
4
- import { i as init, u as uninstall, O as version } from './shared/srpllm.p7w-TznV.mjs';
4
+ import { i as init, u as uninstall, O as version } from './shared/srpllm.DULEAbvf.mjs';
5
5
  import 'node:fs';
6
6
  import 'node:os';
7
7
  import 'node:process';
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { C as CLAUDE_DIR, b as CLAUDE_SETTINGS_FILE, f as CODEX_AUTH_FILE, e as CODEX_CONFIG_FILE, d as CODEX_DIR, j as CODE_TOOL_ALIASES, k as CODE_TOOL_LABELS, h as CODE_TOOL_TYPES, D as DEFAULT_CODE_TOOL_TYPE, M as MODEL_PREFIX, n as RELAY_PROVIDER_ID, R as RELAY_TOOL_TYPES, L as buildModelsChoices, s as clearClaudeApiConfig, y as clearCodexApiConfig, c as commandExists, B as detectInstalledVersion, t as displayClaudeConfig, z as displayCodexConfig, o as ensureClaudeDir, K as fetchModels, N as filterByPrefix, q as getExistingClaudeApiConfig, v as getExistingCodexConfig, g as getPlatform, i as init, F as installTool, m as isCliTool, l as isCodeToolType, A as isToolInstalled, a as isWindows, p as readClaudeSettings, H as readLocalConfig, r as resolveCodeToolType, E as selectInstallMethod, u as uninstall, G as uninstallTool, J as updateLocalConfig, w as writeClaudeApiConfig, x as writeCodexApiConfig, I as writeLocalConfig } from './shared/srpllm.p7w-TznV.mjs';
1
+ export { C as CLAUDE_DIR, b as CLAUDE_SETTINGS_FILE, f as CODEX_AUTH_FILE, e as CODEX_CONFIG_FILE, d as CODEX_DIR, j as CODE_TOOL_ALIASES, k as CODE_TOOL_LABELS, h as CODE_TOOL_TYPES, D as DEFAULT_CODE_TOOL_TYPE, M as MODEL_PREFIX, n as RELAY_PROVIDER_ID, R as RELAY_TOOL_TYPES, L as buildModelsChoices, s as clearClaudeApiConfig, y as clearCodexApiConfig, c as commandExists, B as detectInstalledVersion, t as displayClaudeConfig, z as displayCodexConfig, o as ensureClaudeDir, K as fetchModels, N as filterByPrefix, q as getExistingClaudeApiConfig, v as getExistingCodexConfig, g as getPlatform, i as init, F as installTool, m as isCliTool, l as isCodeToolType, A as isToolInstalled, a as isWindows, p as readClaudeSettings, H as readLocalConfig, r as resolveCodeToolType, E as selectInstallMethod, u as uninstall, G as uninstallTool, J as updateLocalConfig, w as writeClaudeApiConfig, x as writeCodexApiConfig, I as writeLocalConfig } from './shared/srpllm.DULEAbvf.mjs';
2
2
  import 'node:fs';
3
3
  import 'node:os';
4
4
  import 'node:process';
@@ -550,7 +550,7 @@ async function fetchModels(baseUrl, token) {
550
550
  console.log(ansis.yellow(" \u2139 \u8FD9\u901A\u5E38\u8868\u793A\u8BE5 key/team \u672A\u88AB\u5206\u914D\u5177\u4F53\u6A21\u578B\uFF0C\u8BF7\u8054\u7CFB\u4E2D\u8F6C\u7AD9\u7BA1\u7406\u5458\u4E3A\u8BE5 key \u663E\u5F0F\u914D\u7F6E models \u5217\u8868"));
551
551
  throw new Error("\u6A21\u578B\u5217\u8868\u4E3A\u7A7A");
552
552
  }
553
- spinner.succeed(`\u2714 \u5DF2\u83B7\u53D6 ${models.length} \u4E2A\u53EF\u7528\u6A21\u578B`);
553
+ spinner.succeed("\u2714 \u5DF2\u83B7\u53D6\u6A21\u578B\u5217\u8868");
554
554
  return models;
555
555
  } catch (error) {
556
556
  spinner.fail(`\u2716 \u62C9\u53D6\u6A21\u578B\u5217\u8868\u5931\u8D25\uFF1A${error instanceof Error ? error.message : String(error)}`);
@@ -568,7 +568,7 @@ function filterByPrefix(models, prefix) {
568
568
  return models.filter((m) => m.id.toLowerCase().startsWith(p));
569
569
  }
570
570
 
571
- const version = "1.2.0";
571
+ const version = "1.2.2";
572
572
 
573
573
  function displayBanner(codeTool) {
574
574
  const tool = codeTool ? ` ${ansis.gray(`\xB7 ${CODE_TOOL_LABELS[codeTool]}`)}` : "";
@@ -594,7 +594,7 @@ async function inputBaseUrl(defaultUrl) {
594
594
  const { url } = await inquirer.prompt({
595
595
  type: "input",
596
596
  name: "url",
597
- message: "\u8BF7\u8F93\u5165\u4E2D\u8F6C\u7AD9 base_url\uFF08\u4F8B\u5982 https://api.srpllm.com\uFF09\uFF1A",
597
+ message: "\u8BF7\u8F93\u5165\u4E2D\u8F6C\u7AD9 base_url\uFF1A",
598
598
  default: defaultUrl,
599
599
  validate: (value) => {
600
600
  const v = value.trim();
@@ -650,6 +650,18 @@ async function fetchModelList(baseUrl, token) {
650
650
  return null;
651
651
  }
652
652
  }
653
+ async function fetchFilteredModels(baseUrl, token, prefix) {
654
+ const allModels = await fetchModelList(baseUrl, token);
655
+ if (!allModels)
656
+ return null;
657
+ const filtered = filterByPrefix(allModels, prefix);
658
+ if (filtered.length === 0) {
659
+ console.log(ansis.yellow(`\u2139 \u5DF2\u83B7\u53D6 ${allModels.length} \u4E2A\u6A21\u578B\uFF0C\u4F46\u65E0 ${prefix}* \u524D\u7F00\u7684\u6A21\u578B\uFF0C\u53EF\u624B\u52A8\u8F93\u5165`));
660
+ return null;
661
+ }
662
+ console.log(ansis.gray(`\u2139 \u5DF2\u83B7\u53D6 ${allModels.length} \u4E2A\u6A21\u578B\uFF0C\u8FC7\u6EE4\u540E\u5269\u4F59 ${filtered.length} \u4E2A ${prefix}* \u6A21\u578B`));
663
+ return filtered;
664
+ }
653
665
  async function promptModelFromList(models, message, preset, skipPrompt, defaultModel) {
654
666
  if (preset && preset.trim())
655
667
  return preset.trim();
@@ -697,8 +709,7 @@ async function configureClaudeCode(options, baseUrl, token, memory) {
697
709
  return;
698
710
  }
699
711
  }
700
- const allModels = await fetchModelList(baseUrl, token);
701
- const models = allModels ? filterByPrefix(allModels, MODEL_PREFIX["claude-code"]) : allModels;
712
+ const models = await fetchFilteredModels(baseUrl, token, MODEL_PREFIX["claude-code"]);
702
713
  const m = memory.claude;
703
714
  const model = await promptModelFromList(models, "\u8BF7\u9009\u62E9\u4E3B\u6A21\u578B (ANTHROPIC_MODEL)\uFF1A", options.model, options.skipPrompt, m?.model);
704
715
  const opusModel = await promptModelFromList(models, "\u8BF7\u9009\u62E9 Opus \u6863\u6A21\u578B (ANTHROPIC_DEFAULT_OPUS_MODEL)\uFF1A", options.opusModel, options.skipPrompt, m?.opusModel);
@@ -724,8 +735,7 @@ async function configureCodex(options, baseUrl, token, memory) {
724
735
  return;
725
736
  }
726
737
  }
727
- const allModels = await fetchModelList(baseUrl, token);
728
- const models = allModels ? filterByPrefix(allModels, MODEL_PREFIX.codex) : allModels;
738
+ const models = await fetchFilteredModels(baseUrl, token, MODEL_PREFIX.codex);
729
739
  const model = await promptModelFromList(models, "\u8BF7\u9009\u62E9\u9ED8\u8BA4\u4F7F\u7528\u7684\u6A21\u578B\uFF1A", options.model, options.skipPrompt, memory.codex?.model);
730
740
  const config = { baseUrl, token, model };
731
741
  writeCodexApiConfig(config);
@@ -748,8 +758,7 @@ function getDownloadsDir() {
748
758
  return fallback;
749
759
  }
750
760
  async function configureChatbox(options, baseUrl, token, memory) {
751
- const allModels = await fetchModelList(baseUrl, token);
752
- const models = allModels ? filterByPrefix(allModels, MODEL_PREFIX.chatbox) : allModels;
761
+ const models = await fetchFilteredModels(baseUrl, token, MODEL_PREFIX.chatbox);
753
762
  const model = await promptModelFromList(models, "\u8BF7\u9009\u62E9\u9ED8\u8BA4\u6A21\u578B\uFF08chat- \u524D\u7F00\uFF09\uFF1A", options.model, options.skipPrompt, memory.chatbox?.model);
754
763
  const downloads = getDownloadsDir();
755
764
  const filePath = join(downloads, "srpllm-chatbox-config.yaml");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srpllm",
3
3
  "type": "module",
4
- "version": "1.2.0",
4
+ "version": "1.2.2",
5
5
  "packageManager": "pnpm@10.17.1",
6
6
  "description": "SrP-LLM 中转站客户端一键配置工具:安装 Claude Code / Codex 并引导填写 base_url、api_token 与模型",
7
7
  "author": {
@@ -45,21 +45,21 @@
45
45
  "lint:fix": "eslint --fix"
46
46
  },
47
47
  "dependencies": {
48
- "ansis": "catalog:cli",
49
- "cac": "catalog:cli",
50
- "inquirer": "catalog:cli",
51
- "ora": "catalog:cli",
52
- "pathe": "catalog:runtime",
53
- "tinyexec": "catalog:runtime"
48
+ "ansis": "catalog:",
49
+ "cac": "catalog:",
50
+ "inquirer": "catalog:",
51
+ "ora": "catalog:",
52
+ "pathe": "catalog:",
53
+ "tinyexec": "catalog:"
54
54
  },
55
55
  "devDependencies": {
56
- "@antfu/eslint-config": "catalog:build",
57
- "@types/inquirer": "catalog:types",
58
- "@types/node": "catalog:types",
59
- "eslint": "catalog:build",
60
- "eslint-plugin-format": "catalog:build",
61
- "tsx": "catalog:build",
62
- "typescript": "catalog:build",
63
- "unbuild": "catalog:build"
56
+ "@antfu/eslint-config": "catalog:",
57
+ "@types/inquirer": "catalog:",
58
+ "@types/node": "catalog:",
59
+ "eslint": "catalog:",
60
+ "eslint-plugin-format": "catalog:",
61
+ "tsx": "catalog:",
62
+ "typescript": "catalog:",
63
+ "unbuild": "catalog:"
64
64
  }
65
65
  }