yymaxapi 1.0.46 → 1.0.47
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/yymaxapi.js +34 -17
- package/package.json +1 -1
package/bin/yymaxapi.js
CHANGED
|
@@ -3217,30 +3217,31 @@ function getConfigStatusLine(paths) {
|
|
|
3217
3217
|
|
|
3218
3218
|
const providers = Object.keys(config.models.providers);
|
|
3219
3219
|
const primary = config?.agents?.defaults?.model?.primary || '';
|
|
3220
|
+
const primaryProvider = primary.split('/')[0] || '';
|
|
3220
3221
|
|
|
3221
|
-
const
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
const isActive = primary.includes('claude');
|
|
3227
|
-
parts.push(isActive ? chalk.green('Claude ✓') : chalk.yellow('Claude ○'));
|
|
3228
|
-
}
|
|
3222
|
+
const PROVIDER_LABELS = {
|
|
3223
|
+
'claude-yunyi': 'Claude(包月)',
|
|
3224
|
+
'yunyi': 'Codex(包月)',
|
|
3225
|
+
'heibai': 'MAXAPI(按量)',
|
|
3226
|
+
};
|
|
3229
3227
|
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
const isActive =
|
|
3234
|
-
parts.push(isActive ? chalk.green(
|
|
3228
|
+
const parts = [];
|
|
3229
|
+
for (const p of providers) {
|
|
3230
|
+
const label = PROVIDER_LABELS[p] || p;
|
|
3231
|
+
const isActive = p === primaryProvider;
|
|
3232
|
+
parts.push(isActive ? chalk.green(`${label} ✓`) : chalk.yellow(`${label} ○`));
|
|
3235
3233
|
}
|
|
3236
3234
|
|
|
3237
3235
|
if (parts.length === 0) {
|
|
3238
3236
|
return chalk.gray('当前状态: 未配置任何模型');
|
|
3239
3237
|
}
|
|
3240
3238
|
|
|
3239
|
+
const primaryModelId = primary.split('/')[1] || '';
|
|
3240
|
+
const modelTag = primaryModelId ? chalk.cyan(` [模型: ${primaryModelId}]`) : '';
|
|
3241
|
+
|
|
3241
3242
|
const gwEnv = detectGatewayEnv();
|
|
3242
3243
|
const envTag = gwEnv === 'wsl' ? chalk.cyan(' [WSL]') : '';
|
|
3243
|
-
return chalk.gray('当前状态: ') + parts.join(' ') + chalk.gray(' (✓ 主模型 ○ 已配置)') + envTag;
|
|
3244
|
+
return chalk.gray('当前状态: ') + parts.join(' ') + chalk.gray(' (✓ 主模型 ○ 已配置)') + modelTag + envTag;
|
|
3244
3245
|
} catch {
|
|
3245
3246
|
return null;
|
|
3246
3247
|
}
|
|
@@ -3501,10 +3502,26 @@ async function testConnection(paths, args = {}) {
|
|
|
3501
3502
|
}
|
|
3502
3503
|
|
|
3503
3504
|
// 检查当前激活的是哪个
|
|
3504
|
-
|
|
3505
|
+
let primary = config.agents?.defaults?.model?.primary || '';
|
|
3505
3506
|
if (!primary.includes('/')) {
|
|
3506
|
-
|
|
3507
|
-
|
|
3507
|
+
// primary 未设置,尝试从已有 provider 自动选择
|
|
3508
|
+
const providers = config.models?.providers || {};
|
|
3509
|
+
const providerNames = Object.keys(providers);
|
|
3510
|
+
if (providerNames.length === 0) {
|
|
3511
|
+
console.log(chalk.yellow('⚠️ 请先设置主模型'));
|
|
3512
|
+
return;
|
|
3513
|
+
}
|
|
3514
|
+
// 优先选 claude provider
|
|
3515
|
+
const claudeP = providerNames.find(n => n.includes('claude'));
|
|
3516
|
+
const firstP = claudeP || providerNames[0];
|
|
3517
|
+
const firstModels = providers[firstP]?.models || [];
|
|
3518
|
+
if (firstModels.length > 0) {
|
|
3519
|
+
primary = `${firstP}/${firstModels[0].id}`;
|
|
3520
|
+
console.log(chalk.yellow(`⚠️ 主模型未设置,自动使用: ${primary}`));
|
|
3521
|
+
} else {
|
|
3522
|
+
console.log(chalk.yellow('⚠️ 请先设置主模型'));
|
|
3523
|
+
return;
|
|
3524
|
+
}
|
|
3508
3525
|
}
|
|
3509
3526
|
|
|
3510
3527
|
const providerName = primary.split('/')[0];
|