duojie-helper 0.2.18 → 0.2.19
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/cli.js +7 -3
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -48,8 +48,9 @@ program
|
|
|
48
48
|
type: 'input',
|
|
49
49
|
name: 'apiKey',
|
|
50
50
|
message: '请输入你的 Duojie API Key (Ctrl+C 退出):',
|
|
51
|
+
filter: (input) => input.trim(),
|
|
51
52
|
validate: (input) => {
|
|
52
|
-
if (!input || input.
|
|
53
|
+
if (!input || input.length < 10) {
|
|
53
54
|
return 'API Key 不能为空且长度至少 10 位';
|
|
54
55
|
}
|
|
55
56
|
return true;
|
|
@@ -217,18 +218,21 @@ program
|
|
|
217
218
|
type: 'input',
|
|
218
219
|
name: 'apiKey',
|
|
219
220
|
message: '请输入你的 Duojie API Key:',
|
|
221
|
+
filter: (input) => input.trim(),
|
|
220
222
|
}
|
|
221
223
|
]);
|
|
222
224
|
apiKey = answer.apiKey;
|
|
225
|
+
} else {
|
|
226
|
+
apiKey = apiKey.trim();
|
|
223
227
|
}
|
|
224
228
|
|
|
225
229
|
// 获取模型列表
|
|
226
230
|
const spinner = ora('正在验证 API Key...').start();
|
|
227
|
-
await fetchModels(apiKey
|
|
231
|
+
await fetchModels(apiKey);
|
|
228
232
|
spinner.succeed('验证成功');
|
|
229
233
|
|
|
230
234
|
const configSpinner = ora(`正在配置 ${tool}...`).start();
|
|
231
|
-
const result = await configureTool(tool, apiKey
|
|
235
|
+
const result = await configureTool(tool, apiKey);
|
|
232
236
|
|
|
233
237
|
if (result.success) {
|
|
234
238
|
configSpinner.succeed(result.message);
|