hedgequantx 2.6.99 → 2.6.100
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 +33 -37
package/package.json
CHANGED
package/src/menus/ai-agent.js
CHANGED
|
@@ -900,20 +900,27 @@ const setupRemoteOAuth = async (provider, config) => {
|
|
|
900
900
|
const { fetchModelsWithOAuth } = require('../services/ai/client');
|
|
901
901
|
models = await fetchModelsWithOAuth(provider.id, result.access);
|
|
902
902
|
} catch (e) {
|
|
903
|
-
//
|
|
903
|
+
// API failed - will prompt for manual input
|
|
904
904
|
}
|
|
905
905
|
|
|
906
|
-
|
|
907
|
-
if (!models || models.length === 0) {
|
|
908
|
-
models = getDefaultModelsForProvider(provider.id);
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
spinner.succeed(`Found ${models.length} models`);
|
|
906
|
+
let selectedModel;
|
|
912
907
|
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
908
|
+
if (!models || models.length === 0) {
|
|
909
|
+
spinner.warn('Could not fetch models from API');
|
|
910
|
+
|
|
911
|
+
// Prompt user to enter model name manually
|
|
912
|
+
selectedModel = await promptForModelName(config.name);
|
|
913
|
+
if (!selectedModel) {
|
|
914
|
+
return await selectProviderOption(provider);
|
|
915
|
+
}
|
|
916
|
+
} else {
|
|
917
|
+
spinner.succeed(`Found ${models.length} models`);
|
|
918
|
+
|
|
919
|
+
// Let user select model from list
|
|
920
|
+
selectedModel = await selectModelFromList(models, config.name);
|
|
921
|
+
if (!selectedModel) {
|
|
922
|
+
return await selectProviderOption(provider);
|
|
923
|
+
}
|
|
917
924
|
}
|
|
918
925
|
|
|
919
926
|
// Add agent
|
|
@@ -932,33 +939,22 @@ const setupRemoteOAuth = async (provider, config) => {
|
|
|
932
939
|
};
|
|
933
940
|
|
|
934
941
|
/**
|
|
935
|
-
*
|
|
942
|
+
* Prompt user to enter model name manually when API doesn't return models
|
|
936
943
|
*/
|
|
937
|
-
const
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
'gpt-4-turbo',
|
|
952
|
-
'o1-preview',
|
|
953
|
-
'o1-mini'
|
|
954
|
-
],
|
|
955
|
-
gemini: [
|
|
956
|
-
'gemini-2.0-flash-exp',
|
|
957
|
-
'gemini-1.5-pro',
|
|
958
|
-
'gemini-1.5-flash'
|
|
959
|
-
]
|
|
960
|
-
};
|
|
961
|
-
return models[providerId] || [];
|
|
944
|
+
const promptForModelName = async (providerName) => {
|
|
945
|
+
console.log();
|
|
946
|
+
console.log(chalk.yellow(' Could not fetch models from API.'));
|
|
947
|
+
console.log(chalk.white(' Please enter the model name manually.'));
|
|
948
|
+
console.log(chalk.gray(' (Check provider docs for available models)'));
|
|
949
|
+
console.log();
|
|
950
|
+
|
|
951
|
+
const modelName = await prompts.textInput(chalk.cyan('MODEL NAME:'));
|
|
952
|
+
|
|
953
|
+
if (!modelName || modelName.trim() === '' || modelName.trim() === '<') {
|
|
954
|
+
return null;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
return modelName.trim();
|
|
962
958
|
};
|
|
963
959
|
|
|
964
960
|
/**
|