hedgequantx 2.6.92 → 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 -22
- package/src/services/ai/client.js +25 -34
package/package.json
CHANGED
package/src/menus/ai-agent.js
CHANGED
|
@@ -954,29 +954,14 @@ const setupBrowserOAuth = async (provider, config) => {
|
|
|
954
954
|
// Fallback to default models if fetch fails
|
|
955
955
|
}
|
|
956
956
|
|
|
957
|
-
//
|
|
958
|
-
//
|
|
959
|
-
const defaultModels = {
|
|
960
|
-
anthropic: ['claude-sonnet-4-20250514', 'claude-opus-4-20250514', 'claude-3-5-sonnet-20241022', 'claude-3-5-haiku-20241022'],
|
|
961
|
-
openai: [
|
|
962
|
-
'gpt-4.5-preview', // NEW: GPT-4.5 (latest)
|
|
963
|
-
'gpt-4.5', // NEW: GPT-4.5
|
|
964
|
-
'o3', // NEW: o3 (latest reasoning)
|
|
965
|
-
'o3-mini', // o3-mini
|
|
966
|
-
'o1', // o1
|
|
967
|
-
'o1-mini', // o1-mini
|
|
968
|
-
'gpt-4o', // GPT-4o
|
|
969
|
-
'gpt-4o-mini', // GPT-4o mini
|
|
970
|
-
'gpt-4-turbo', // GPT-4 Turbo
|
|
971
|
-
],
|
|
972
|
-
gemini: ['gemini-2.5-pro', 'gemini-2.5-flash', 'gemini-2.0-flash', 'gemini-1.5-pro'],
|
|
973
|
-
iflow: ['deepseek-v3', 'deepseek-chat', 'kimi', 'glm-4'],
|
|
974
|
-
qwen: ['qwen-max', 'qwen-plus', 'qwen-turbo', 'qwen2.5-72b-instruct']
|
|
975
|
-
};
|
|
976
|
-
|
|
957
|
+
// NO hardcoded fallback - models MUST come from API
|
|
958
|
+
// Rule: ZERO fake/mock data - API only
|
|
977
959
|
if (!models || models.length === 0) {
|
|
978
|
-
|
|
979
|
-
|
|
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);
|
|
980
965
|
} else {
|
|
981
966
|
spinner.succeed(`FOUND ${models.length} MODELS`);
|
|
982
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
|
|
|
@@ -554,44 +562,27 @@ const fetchOpenAIModels = async (endpoint, apiKey) => {
|
|
|
554
562
|
headers['Authorization'] = `Bearer ${apiKey}`;
|
|
555
563
|
}
|
|
556
564
|
|
|
557
|
-
// Priority order for OpenAI models (newest/best first)
|
|
558
|
-
const modelPriority = [
|
|
559
|
-
'gpt-4.5-preview', 'gpt-4.5',
|
|
560
|
-
'o3', 'o3-mini', 'o3-mini-high',
|
|
561
|
-
'o1', 'o1-pro', 'o1-mini',
|
|
562
|
-
'gpt-4o', 'gpt-4o-mini', 'gpt-4o-audio-preview',
|
|
563
|
-
'gpt-4-turbo', 'gpt-4-turbo-preview',
|
|
564
|
-
'gpt-4', 'gpt-3.5-turbo'
|
|
565
|
-
];
|
|
566
|
-
|
|
567
565
|
try {
|
|
568
566
|
const response = await makeRequest(url, { method: 'GET', headers, timeout: 10000 });
|
|
569
567
|
if (response.data && Array.isArray(response.data)) {
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
const aIdx = modelPriority.findIndex(p => a.includes(p));
|
|
587
|
-
const bIdx = modelPriority.findIndex(p => b.includes(p));
|
|
588
|
-
if (aIdx === -1 && bIdx === -1) return 0;
|
|
589
|
-
if (aIdx === -1) return 1;
|
|
590
|
-
if (bIdx === -1) return -1;
|
|
591
|
-
return aIdx - bIdx;
|
|
592
|
-
});
|
|
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
|
+
);
|
|
593
584
|
|
|
594
|
-
return chatModels.length > 0 ? chatModels :
|
|
585
|
+
return chatModels.length > 0 ? chatModels : null;
|
|
595
586
|
}
|
|
596
587
|
return null;
|
|
597
588
|
} catch (error) {
|