hedgequantx 2.5.29 → 2.5.30

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hedgequantx",
3
- "version": "2.5.29",
3
+ "version": "2.5.30",
4
4
  "description": "HedgeQuantX - Prop Futures Trading CLI",
5
5
  "main": "src/app.js",
6
6
  "bin": {
@@ -934,20 +934,44 @@ const setupConnection = async (provider, option) => {
934
934
  return await selectProviderOption(provider);
935
935
  }
936
936
 
937
- // Add as new agent
937
+ spinner.text = 'FETCHING AVAILABLE MODELS...';
938
+
939
+ // Fetch models from real API
940
+ const { fetchAnthropicModels, fetchGeminiModels, fetchOpenAIModels } = require('../services/ai/client');
941
+
942
+ let models = null;
943
+ if (provider.id === 'anthropic') {
944
+ models = await fetchAnthropicModels(credentials.apiKey);
945
+ } else if (provider.id === 'gemini') {
946
+ models = await fetchGeminiModels(credentials.apiKey);
947
+ } else {
948
+ const endpoint = credentials.endpoint || provider.endpoint;
949
+ models = await fetchOpenAIModels(endpoint, credentials.apiKey);
950
+ }
951
+
952
+ if (!models || models.length === 0) {
953
+ spinner.fail('COULD NOT FETCH MODELS FROM API');
954
+ console.log(chalk.white(' Check your API key or network connection.'));
955
+ await prompts.waitForEnter();
956
+ return await selectProviderOption(provider);
957
+ }
958
+
959
+ spinner.succeed(`FOUND ${models.length} MODELS`);
960
+
961
+ // Let user select a model
962
+ const selectedModel = await selectModelFromList(models, provider.name);
963
+ if (!selectedModel) {
964
+ return await selectProviderOption(provider);
965
+ }
966
+
967
+ // Add as new agent with selected model
938
968
  try {
939
- const model = credentials.model || provider.defaultModel;
940
- await aiService.addAgent(provider.id, option.id, credentials, model, provider.name);
941
- spinner.succeed(`AGENT ADDED: ${provider.name}`);
942
-
943
- // Show available models for local providers
944
- if (validation.models && validation.models.length > 0) {
945
- console.log(chalk.white(` AVAILABLE MODELS: ${validation.models.slice(0, 5).join(', ')}`));
946
- }
969
+ await aiService.addAgent(provider.id, option.id, credentials, selectedModel, provider.name);
947
970
 
948
- console.log(chalk.white(` USING MODEL: ${model}`));
971
+ console.log(chalk.green(`\n AGENT ADDED: ${provider.name}`));
972
+ console.log(chalk.white(` MODEL: ${selectedModel}`));
949
973
  } catch (error) {
950
- spinner.fail(`FAILED TO SAVE: ${error.message}`);
974
+ console.log(chalk.red(`\n FAILED TO SAVE: ${error.message}`));
951
975
  }
952
976
 
953
977
  await prompts.waitForEnter();