navada-edge-cli 3.0.1 → 3.0.2
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/lib/agent.js +8 -2
- package/package.json +1 -1
package/lib/agent.js
CHANGED
|
@@ -536,7 +536,10 @@ async function openAIChat(key, userMessage, conversationHistory = []) {
|
|
|
536
536
|
response = await streamOpenAI(key, messages, model);
|
|
537
537
|
} catch (e) {
|
|
538
538
|
if (e.message.includes('401') || e.message.includes('429') || e.message.includes('billing')) {
|
|
539
|
-
|
|
539
|
+
if (!sessionState._openaiWarned) {
|
|
540
|
+
console.log(ui.warn('OpenAI API unavailable, using Grok free tier. /login with a valid key to switch.'));
|
|
541
|
+
sessionState._openaiWarned = true;
|
|
542
|
+
}
|
|
540
543
|
return grokChat(userMessage, conversationHistory);
|
|
541
544
|
}
|
|
542
545
|
throw e;
|
|
@@ -723,7 +726,10 @@ async function chat(userMessage, conversationHistory = []) {
|
|
|
723
726
|
const errMsg = e.message || '';
|
|
724
727
|
// If billing/rate limit/auth error, fall back to free tier
|
|
725
728
|
if (errMsg.includes('400') || errMsg.includes('401') || errMsg.includes('429') || errMsg.includes('usage limits')) {
|
|
726
|
-
|
|
729
|
+
if (!sessionState._anthropicWarned) {
|
|
730
|
+
console.log(ui.warn('Anthropic API unavailable, using Grok free tier. /login with a valid key to switch.'));
|
|
731
|
+
sessionState._anthropicWarned = true;
|
|
732
|
+
}
|
|
727
733
|
return grokChat(userMessage, conversationHistory);
|
|
728
734
|
}
|
|
729
735
|
throw e;
|
package/package.json
CHANGED