yymaxapi 1.0.58 → 1.0.59
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 -1
- 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
|
|