hedgequantx 2.6.91 → 2.6.93
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/menus/ai-agent.js +7 -10
- package/src/services/ai/client.js +26 -1
package/package.json
CHANGED
package/src/menus/ai-agent.js
CHANGED
|
@@ -954,17 +954,14 @@ const setupBrowserOAuth = async (provider, config) => {
|
|
|
954
954
|
// Fallback to default models if fetch fails
|
|
955
955
|
}
|
|
956
956
|
|
|
957
|
-
//
|
|
958
|
-
|
|
959
|
-
anthropic: ['claude-sonnet-4-20250514', 'claude-opus-4-20250514', 'claude-3-5-sonnet-20241022', 'claude-3-5-haiku-20241022'],
|
|
960
|
-
openai: ['gpt-4o', 'gpt-4o-mini', 'gpt-4-turbo', 'o1', 'o1-mini', 'o3-mini'],
|
|
961
|
-
gemini: ['gemini-2.5-pro', 'gemini-2.5-flash', 'gemini-2.0-flash', 'gemini-1.5-pro'],
|
|
962
|
-
iflow: ['deepseek-v3', 'deepseek-chat', 'kimi', 'glm-4']
|
|
963
|
-
};
|
|
964
|
-
|
|
957
|
+
// NO hardcoded fallback - models MUST come from API
|
|
958
|
+
// Rule: ZERO fake/mock data - API only
|
|
965
959
|
if (!models || models.length === 0) {
|
|
966
|
-
|
|
967
|
-
|
|
960
|
+
spinner.fail('NO MODELS AVAILABLE FROM API');
|
|
961
|
+
console.log(chalk.red('\n Could not fetch models from provider API'));
|
|
962
|
+
console.log(chalk.gray(' Please check your OAuth credentials or try again'));
|
|
963
|
+
await prompts.waitForEnter();
|
|
964
|
+
return await selectProviderOption(provider);
|
|
968
965
|
} else {
|
|
969
966
|
spinner.succeed(`FOUND ${models.length} MODELS`);
|
|
970
967
|
}
|
|
@@ -541,6 +541,14 @@ const fetchGeminiModels = async (apiKey) => {
|
|
|
541
541
|
*
|
|
542
542
|
* Data source: {endpoint}/models (GET)
|
|
543
543
|
*/
|
|
544
|
+
/**
|
|
545
|
+
* Fetch available models from OpenAI-compatible API
|
|
546
|
+
* @param {string} endpoint - API endpoint base URL
|
|
547
|
+
* @param {string} apiKey - API key or OAuth token
|
|
548
|
+
* @returns {Promise<Array|null>} Array of model IDs from API, null if unavailable
|
|
549
|
+
*
|
|
550
|
+
* Data source: {endpoint}/models (GET)
|
|
551
|
+
*/
|
|
544
552
|
const fetchOpenAIModels = async (endpoint, apiKey) => {
|
|
545
553
|
if (!endpoint) return null;
|
|
546
554
|
|
|
@@ -557,7 +565,24 @@ const fetchOpenAIModels = async (endpoint, apiKey) => {
|
|
|
557
565
|
try {
|
|
558
566
|
const response = await makeRequest(url, { method: 'GET', headers, timeout: 10000 });
|
|
559
567
|
if (response.data && Array.isArray(response.data)) {
|
|
560
|
-
|
|
568
|
+
// Return models from API - filter to chat models only
|
|
569
|
+
const chatModels = response.data
|
|
570
|
+
.map(m => m.id)
|
|
571
|
+
.filter(id => id && (
|
|
572
|
+
id.includes('gpt') ||
|
|
573
|
+
id.includes('o1') ||
|
|
574
|
+
id.includes('o3') ||
|
|
575
|
+
id.includes('claude') ||
|
|
576
|
+
id.includes('gemini')
|
|
577
|
+
))
|
|
578
|
+
.filter(id =>
|
|
579
|
+
!id.includes('embedding') &&
|
|
580
|
+
!id.includes('whisper') &&
|
|
581
|
+
!id.includes('tts') &&
|
|
582
|
+
!id.includes('dall-e')
|
|
583
|
+
);
|
|
584
|
+
|
|
585
|
+
return chatModels.length > 0 ? chatModels : null;
|
|
561
586
|
}
|
|
562
587
|
return null;
|
|
563
588
|
} catch (error) {
|