base_parts_ai 1.0.35 → 1.0.36

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.
@@ -9,6 +9,7 @@ var fs = require('fs');
9
9
  var path = require('path');
10
10
  var http = require('http');
11
11
  var { execSync } = require('child_process');
12
+ var { select } = require('@inquirer/prompts');
12
13
 
13
14
  // ============================================================
14
15
  // AI 渠道列表(运行时由 fetchConfig 从服务端拉取填充)
@@ -55,7 +56,6 @@ function fetchConfig(buildCfg) {
55
56
  if (newVer && newVer !== currentVer) {
56
57
  console.log('[fetchConfig] 检测到新版本 jcc: ' + newVer + '(当前 ' + currentVer + ')');
57
58
  // 用 select 上下选,默认高亮"立即升级"
58
- var { select } = require('@inquirer/prompts');
59
59
  var confirmed = await select({
60
60
  message: '是否立即升级?',
61
61
  default: 'yes',
package/lib/setapi.js CHANGED
@@ -104,36 +104,28 @@ module.exports = async function (cmd, buildCfg) {
104
104
  console.log(' BASE_URL: ' + settings.env.ANTHROPIC_BASE_URL);
105
105
  console.log(' Token: ' + utils.maskKey(settings.env.ANTHROPIC_AUTH_TOKEN));
106
106
  } else {
107
- // 查询该渠道是否有缓存的 Key
107
+ // 查询该渠道是否有缓存的 Key,作为输入框默认值(方便用户确认或修改)
108
108
  var savedKey = (jccJson.keys && jccJson.keys[selected.id]) || '';
109
- if (savedKey) {
110
- // 已有缓存 Key,直接切换
111
- settings.env.ANTHROPIC_AUTH_TOKEN = savedKey;
112
- utils.writeJsonFile(buildCfg.claudeSettingsPath, settings);
113
- console.log('✅ 已切换到渠道: ' + selected.name);
114
- console.log(' Key: ' + utils.maskKey(savedKey));
115
- } else {
116
- // 无缓存 Key,提示用户输入
117
- // console.log('⚠️ 渠道 [' + selected.name + '] 尚未设置 Key,请输入:');
118
- var newKey = await input({
119
- message: '请输入 ANTHROPIC_AUTH_TOKEN:',
120
- validate: function (v) {
121
- return v.trim().length > 0 ? true : 'Key 不能为空';
122
- },
123
- });
124
- newKey = newKey.trim();
125
-
126
- // 写入 settings.json
127
- settings.env.ANTHROPIC_AUTH_TOKEN = newKey;
128
- utils.writeJsonFile(buildCfg.claudeSettingsPath, settings);
129
-
130
- // 缓存到 jcc.json
131
- if (!jccJson.keys) { jccJson.keys = {}; }
132
- jccJson.keys[selected.id] = newKey;
133
- utils.writeJsonFile(buildCfg.jccJsonPath, jccJson);
134
-
135
- console.log('✅ 已切换到渠道: ' + selected.name + ',Key 已保存到本地缓存。');
136
- }
109
+ var newKey = await input({
110
+ message: '请输入 ANTHROPIC_AUTH_TOKEN:',
111
+ default: savedKey,
112
+ validate: function (v) {
113
+ return v.trim().length > 0 ? true : 'Key 不能为空';
114
+ },
115
+ });
116
+ newKey = newKey.trim();
117
+
118
+ // 写入 settings.json
119
+ settings.env.ANTHROPIC_AUTH_TOKEN = newKey;
120
+ utils.writeJsonFile(buildCfg.claudeSettingsPath, settings);
121
+
122
+ // 缓存到 jcc.json
123
+ if (!jccJson.keys) { jccJson.keys = {}; }
124
+ jccJson.keys[selected.id] = newKey;
125
+ utils.writeJsonFile(buildCfg.jccJsonPath, jccJson);
126
+
127
+ console.log('✅ 已切换到渠道: ' + selected.name + ',Key 已保存到本地缓存。');
128
+ console.log(' Key: ' + utils.maskKey(newKey));
137
129
  }
138
130
 
139
131
  // 从 ccVersionList 对象中确定目标版本号
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "base_parts_ai",
3
- "version": "1.0.35",
3
+ "version": "1.0.36",
4
4
  "description": "jaskle base_parts_ai",
5
5
  "main": "./main.js",
6
6
  "registry": true,