yymaxapi 1.0.58 → 1.0.60
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 +7 -6
- package/package.json +1 -1
package/bin/yymaxapi.js
CHANGED
|
@@ -2602,13 +2602,19 @@ async function autoActivate(paths, args = {}) {
|
|
|
2602
2602
|
'OPENAI_API_KEY',
|
|
2603
2603
|
'OPENCLAW_API_KEY'
|
|
2604
2604
|
];
|
|
2605
|
+
const existingConfig = readConfig(paths.openclawConfig) || {};
|
|
2606
|
+
const existingProviders = existingConfig.models?.providers || {};
|
|
2607
|
+
const existingKey = existingProviders[claudeProviderName]?.apiKey
|
|
2608
|
+
|| existingProviders[codexProviderName]?.apiKey
|
|
2609
|
+
|| Object.values(existingProviders).find(p => p.apiKey)?.apiKey
|
|
2610
|
+
|| '';
|
|
2605
2611
|
const directKey = (args['api-key'] || args.apiKey || args.key || '').toString().trim();
|
|
2606
2612
|
let apiKey;
|
|
2607
2613
|
if (directKey) {
|
|
2608
2614
|
apiKey = directKey;
|
|
2609
2615
|
} else {
|
|
2610
2616
|
const envKey = getApiKeyFromArgs({}, apiKeyEnvFallbacks);
|
|
2611
|
-
apiKey = await promptApiKey('请输入 API Key:', envKey || '');
|
|
2617
|
+
apiKey = await promptApiKey('请输入 API Key:', envKey || existingKey || '');
|
|
2612
2618
|
}
|
|
2613
2619
|
if (!apiKey) { console.log(chalk.gray('已取消')); return; }
|
|
2614
2620
|
|
|
@@ -3142,8 +3148,6 @@ async function main() {
|
|
|
3142
3148
|
{ name: ' 测试连接', value: 'test_connection' },
|
|
3143
3149
|
{ name: ' 查看配置', value: 'view_config' },
|
|
3144
3150
|
{ name: ' 恢复默认', value: 'restore' },
|
|
3145
|
-
new inquirer.Separator(' -- 安装 --'),
|
|
3146
|
-
{ name: ' 安装/更新 OpenClaw', value: 'install_openclaw' },
|
|
3147
3151
|
new inquirer.Separator(''),
|
|
3148
3152
|
{ name: ' 退出', value: 'exit' }
|
|
3149
3153
|
]
|
|
@@ -3176,9 +3180,6 @@ async function main() {
|
|
|
3176
3180
|
case 'restore':
|
|
3177
3181
|
await restore(paths);
|
|
3178
3182
|
break;
|
|
3179
|
-
case 'install_openclaw':
|
|
3180
|
-
await installOrUpdateOpenClaw();
|
|
3181
|
-
break;
|
|
3182
3183
|
case 'activate_claude_code':
|
|
3183
3184
|
await activateClaudeCode(paths);
|
|
3184
3185
|
break;
|