natureco-cli 2.1.1 → 2.2.0
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/commands/dashboard.js +2 -2
- package/src/utils/api.js +28 -11
package/package.json
CHANGED
|
@@ -211,7 +211,7 @@ body::before{
|
|
|
211
211
|
<div class="header-bot-name" id="header-bot-name">Nature Bot</div>
|
|
212
212
|
<div class="header-bot-model" id="header-bot-model">NatureCo</div>
|
|
213
213
|
</div>
|
|
214
|
-
<div class="version-badge" id="version-badge">v2.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.2.0</div>
|
|
215
215
|
</div>
|
|
216
216
|
<div class="messages" id="messages"></div>
|
|
217
217
|
<div class="input-area">
|
|
@@ -341,7 +341,7 @@ function dashboard(action) {
|
|
|
341
341
|
apiKey: cfg.apiKey,
|
|
342
342
|
defaultBot: cfg.defaultBot,
|
|
343
343
|
defaultBotId: cfg.defaultBotId,
|
|
344
|
-
version: 'v2.
|
|
344
|
+
version: 'v2.2.0',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/utils/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// NatureCo CLI v2.
|
|
1
|
+
// NatureCo CLI v2.2.0 - Universal LLM Provider Support
|
|
2
2
|
// Supports: OpenAI, Groq, Together, Fireworks, Perplexity, Mistral, DeepSeek, OpenRouter, Ollama, LM Studio, Anthropic
|
|
3
3
|
|
|
4
4
|
const { getConfig } = require('./config');
|
|
@@ -7,6 +7,23 @@ const { getToolDefinitions, executeToolCalls } = require('./tool-runner');
|
|
|
7
7
|
// Conversation history for multi-turn chat
|
|
8
8
|
const conversationHistory = new Map();
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Check if debug mode is enabled
|
|
12
|
+
*/
|
|
13
|
+
function isDebugEnabled() {
|
|
14
|
+
const config = getConfig();
|
|
15
|
+
return config.debug === true || config.debug === 'true';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Debug log (only if debug mode enabled)
|
|
20
|
+
*/
|
|
21
|
+
function debugLog(...args) {
|
|
22
|
+
if (isDebugEnabled()) {
|
|
23
|
+
console.log(...args);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
10
27
|
/**
|
|
11
28
|
* Get provider configuration from config
|
|
12
29
|
*/
|
|
@@ -184,12 +201,12 @@ async function sendMessageToProvider(apiKey, message, conversationId = null, sys
|
|
|
184
201
|
? formatToolsForAnthropic()
|
|
185
202
|
: formatToolsForOpenAI();
|
|
186
203
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
204
|
+
debugLog('\n[Provider] Sending request...');
|
|
205
|
+
debugLog('[Provider] URL:', providerConfig.url);
|
|
206
|
+
debugLog('[Provider] Model:', providerConfig.model);
|
|
207
|
+
debugLog('[Provider] Type:', providerConfig.isAnthropic ? 'Anthropic' : 'OpenAI-compatible');
|
|
208
|
+
debugLog('[Provider] Messages:', messages.length);
|
|
209
|
+
debugLog('[Provider] Tools:', tools.length);
|
|
193
210
|
|
|
194
211
|
// Tool execution loop (max 10 iterations)
|
|
195
212
|
let iteration = 0;
|
|
@@ -198,21 +215,21 @@ async function sendMessageToProvider(apiKey, message, conversationId = null, sys
|
|
|
198
215
|
|
|
199
216
|
while (iteration < maxIterations) {
|
|
200
217
|
iteration++;
|
|
201
|
-
|
|
218
|
+
debugLog(`\n[Provider] Iteration ${iteration}/${maxIterations}`);
|
|
202
219
|
|
|
203
220
|
// Call provider API
|
|
204
221
|
const assistantMessage = providerConfig.isAnthropic
|
|
205
222
|
? await sendMessageAnthropic(providerConfig, messages, tools)
|
|
206
223
|
: await sendMessageOpenAICompatible(providerConfig, messages, tools);
|
|
207
224
|
|
|
208
|
-
|
|
225
|
+
debugLog('[Provider] Response type:', assistantMessage.tool_calls ? 'tool_calls' : 'text');
|
|
209
226
|
|
|
210
227
|
// Add assistant message to history
|
|
211
228
|
messages.push(assistantMessage);
|
|
212
229
|
|
|
213
230
|
// Check for tool calls
|
|
214
231
|
if (assistantMessage.tool_calls && assistantMessage.tool_calls.length > 0) {
|
|
215
|
-
|
|
232
|
+
debugLog(`[Provider] Tool calls: ${assistantMessage.tool_calls.length}`);
|
|
216
233
|
|
|
217
234
|
// Execute tools locally
|
|
218
235
|
const toolCalls = assistantMessage.tool_calls.map(tc => ({
|
|
@@ -245,7 +262,7 @@ async function sendMessageToProvider(apiKey, message, conversationId = null, sys
|
|
|
245
262
|
}
|
|
246
263
|
|
|
247
264
|
if (iteration >= maxIterations) {
|
|
248
|
-
|
|
265
|
+
debugLog('\n[Provider] Max iterations reached');
|
|
249
266
|
finalResponse = finalResponse || 'Max tool execution iterations reached.';
|
|
250
267
|
}
|
|
251
268
|
|