@tokenaut/opentoken 1.4.12 → 1.4.13
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/tools/codex.js +23 -0
package/package.json
CHANGED
package/src/tools/codex.js
CHANGED
|
@@ -343,6 +343,29 @@ async function test() {
|
|
|
343
343
|
return;
|
|
344
344
|
}
|
|
345
345
|
|
|
346
|
+
const OPENTOKEN_URLS = ['https://cn2.gw.opentoken.io', 'https://gw.opentoken.io'];
|
|
347
|
+
const baseUrlClean = config.baseUrl.replace(/\/+$/, '').replace(/\/v1$/, '');
|
|
348
|
+
const isOpenTokenUrl = OPENTOKEN_URLS.some((u) => baseUrlClean === u);
|
|
349
|
+
|
|
350
|
+
if (!isOpenTokenUrl) {
|
|
351
|
+
console.log('');
|
|
352
|
+
console.log(chalk.yellow(' ⚠ 当前调用地址不是 opentoken 的地址,是否继续检查?'));
|
|
353
|
+
console.log(chalk.gray(' 当前 URL : ') + config.baseUrl);
|
|
354
|
+
console.log('');
|
|
355
|
+
const { confirm } = await inquirer.prompt([
|
|
356
|
+
{
|
|
357
|
+
type: 'input',
|
|
358
|
+
name: 'confirm',
|
|
359
|
+
message: ' 继续测试?(y/n)',
|
|
360
|
+
default: 'n',
|
|
361
|
+
},
|
|
362
|
+
]);
|
|
363
|
+
if (confirm.toLowerCase() !== 'y') {
|
|
364
|
+
console.log(chalk.gray(' 已取消测试'));
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
346
369
|
console.log('');
|
|
347
370
|
console.log(chalk.bold(chalk.cyan('正在测试 Codex 连接...')));
|
|
348
371
|
console.log(chalk.gray(' Base URL : ') + config.baseUrl);
|