hedgequantx 2.7.38 → 2.7.39
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/pages/ai-agents.js +15 -34
package/package.json
CHANGED
package/src/pages/ai-agents.js
CHANGED
|
@@ -243,48 +243,30 @@ const handleCliProxyConnection = async (provider, config, boxWidth) => {
|
|
|
243
243
|
// Restart CLIProxyAPI to load new tokens
|
|
244
244
|
const restartSpinner = ora({ text: 'RESTARTING CLIPROXYAPI...', color: 'yellow' }).start();
|
|
245
245
|
await cliproxy.stop();
|
|
246
|
-
await new Promise(r => setTimeout(r,
|
|
246
|
+
await new Promise(r => setTimeout(r, 2000));
|
|
247
247
|
await cliproxy.start();
|
|
248
248
|
|
|
249
|
-
// Wait for CLIProxyAPI to be fully ready
|
|
250
|
-
restartSpinner.text = 'WAITING FOR CLIPROXYAPI TO
|
|
251
|
-
let
|
|
252
|
-
|
|
253
|
-
|
|
249
|
+
// Wait for CLIProxyAPI to be fully ready with models loaded
|
|
250
|
+
restartSpinner.text = 'WAITING FOR CLIPROXYAPI TO LOAD TOKENS...';
|
|
251
|
+
let modelsResult = { success: false, models: [] };
|
|
252
|
+
|
|
253
|
+
for (let i = 0; i < 15; i++) {
|
|
254
|
+
await new Promise(r => setTimeout(r, 2000));
|
|
255
|
+
restartSpinner.text = `LOADING MODELS (${i + 1}/15)...`;
|
|
256
|
+
|
|
254
257
|
const status = await cliproxy.isRunning();
|
|
255
258
|
if (status.running) {
|
|
256
|
-
//
|
|
257
|
-
|
|
258
|
-
if (
|
|
259
|
-
|
|
259
|
+
// Check if models are available (tokens loaded)
|
|
260
|
+
modelsResult = await cliproxy.fetchProviderModels(provider.id);
|
|
261
|
+
if (modelsResult.success && modelsResult.models.length > 0) {
|
|
262
|
+
restartSpinner.succeed(`CLIPROXYAPI READY - ${modelsResult.models.length} MODELS FOUND`);
|
|
260
263
|
break;
|
|
261
264
|
}
|
|
262
265
|
}
|
|
263
|
-
restartSpinner.text = `WAITING FOR CLIPROXYAPI (${i + 1}/10)...`;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
if (!ready) {
|
|
267
|
-
restartSpinner.warn('CLIPROXYAPI SLOW TO START - CONTINUING...');
|
|
268
|
-
} else {
|
|
269
|
-
restartSpinner.succeed('CLIPROXYAPI READY');
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
// Fetch models (with retry for provider-specific)
|
|
273
|
-
const modelSpinner = ora({ text: 'FETCHING AVAILABLE MODELS...', color: 'yellow' }).start();
|
|
274
|
-
|
|
275
|
-
let modelsResult = { success: false, models: [] };
|
|
276
|
-
for (let attempt = 1; attempt <= 5; attempt++) {
|
|
277
|
-
modelsResult = await cliproxy.fetchProviderModels(provider.id);
|
|
278
|
-
if (modelsResult.success && modelsResult.models.length > 0) break;
|
|
279
|
-
if (attempt < 5) {
|
|
280
|
-
modelSpinner.text = `FETCHING MODELS (ATTEMPT ${attempt + 1}/5)...`;
|
|
281
|
-
await new Promise(r => setTimeout(r, 1500));
|
|
282
|
-
}
|
|
283
266
|
}
|
|
284
267
|
|
|
268
|
+
// Show model selection or fallback to auto
|
|
285
269
|
if (modelsResult.success && modelsResult.models.length > 0) {
|
|
286
|
-
modelSpinner.succeed(`FOUND ${modelsResult.models.length} MODELS`);
|
|
287
|
-
|
|
288
270
|
const selectedModel = await selectModelFromList(provider, modelsResult.models, boxWidth);
|
|
289
271
|
if (selectedModel) {
|
|
290
272
|
activateProvider(config, provider.id, {
|
|
@@ -298,7 +280,6 @@ const handleCliProxyConnection = async (provider, config, boxWidth) => {
|
|
|
298
280
|
}
|
|
299
281
|
}
|
|
300
282
|
} else {
|
|
301
|
-
modelSpinner.warn('NO MODELS FOUND - USING AUTO MODE');
|
|
302
283
|
// No models but auth might have worked
|
|
303
284
|
activateProvider(config, provider.id, {
|
|
304
285
|
connectionType: 'cliproxy',
|
|
@@ -306,7 +287,7 @@ const handleCliProxyConnection = async (provider, config, boxWidth) => {
|
|
|
306
287
|
modelName: 'AUTO'
|
|
307
288
|
});
|
|
308
289
|
if (saveConfig(config)) {
|
|
309
|
-
console.log(chalk.green(`\n ✓ ${provider.name.toUpperCase()} CONNECTED VIA PAID PLAN`));
|
|
290
|
+
console.log(chalk.green(`\n ✓ ${provider.name.toUpperCase()} CONNECTED VIA PAID PLAN (AUTO MODE)`));
|
|
310
291
|
}
|
|
311
292
|
}
|
|
312
293
|
|