natureco-cli 2.4.0 → 2.4.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/package.json +1 -1
- package/src/commands/dashboard.js +2 -2
- package/src/commands/gateway-server.js +15 -5
- package/src/utils/api.js +20 -2
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.4.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.4.2</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.4.
|
|
344
|
+
version: 'v2.4.2',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
|
@@ -128,7 +128,7 @@ async function startGateway() {
|
|
|
128
128
|
|
|
129
129
|
async function runGatewayWorker() {
|
|
130
130
|
// This runs in the background
|
|
131
|
-
log('gateway', 'Starting NatureCo Gateway v2.
|
|
131
|
+
log('gateway', 'Starting NatureCo Gateway v2.4.2...', 'green');
|
|
132
132
|
|
|
133
133
|
// Load config
|
|
134
134
|
const { getConfig } = require('../utils/config');
|
|
@@ -293,13 +293,23 @@ async function startWhatsAppProvider(sessionDir, config) {
|
|
|
293
293
|
try {
|
|
294
294
|
// v2.x: Send to universal provider (Groq/OpenAI/Anthropic)
|
|
295
295
|
const { sendMessage } = require('../utils/api');
|
|
296
|
+
const { getMemoryPrompt } = require('../utils/memory');
|
|
297
|
+
|
|
296
298
|
log('whatsapp', 'Sending to AI provider...', 'cyan');
|
|
297
299
|
|
|
298
|
-
// Use WhatsApp-specific conversation ID for
|
|
299
|
-
const conversationId = `whatsapp_${sender}`;
|
|
300
|
+
// Use WhatsApp-specific conversation ID for persistent history
|
|
301
|
+
const conversationId = `whatsapp_${sender.replace(/\D/g, '')}`;
|
|
302
|
+
|
|
303
|
+
// Use same botId as terminal for shared memory
|
|
304
|
+
const botId = 'universal-provider';
|
|
305
|
+
const memoryPrompt = getMemoryPrompt(botId);
|
|
300
306
|
|
|
301
|
-
// WhatsApp system prompt
|
|
302
|
-
|
|
307
|
+
// WhatsApp system prompt with memory
|
|
308
|
+
let systemPrompt = `You are a helpful WhatsApp assistant. Keep responses concise and friendly. Use emojis when appropriate. If users ask for file operations or system commands, politely explain that those features are available in the terminal version.`;
|
|
309
|
+
|
|
310
|
+
if (memoryPrompt) {
|
|
311
|
+
systemPrompt += '\n\n' + memoryPrompt;
|
|
312
|
+
}
|
|
303
313
|
|
|
304
314
|
const response = await sendMessage(null, null, messageText, conversationId, systemPrompt);
|
|
305
315
|
const reply = response?.reply || response?.message || '';
|
package/src/utils/api.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// NatureCo CLI v2.4.
|
|
1
|
+
// NatureCo CLI v2.4.2 - Universal LLM Provider Support
|
|
2
2
|
// Supports: OpenAI, Groq, Together, Fireworks, Perplexity, Mistral, DeepSeek, OpenRouter, Ollama, LM Studio, Anthropic
|
|
3
3
|
|
|
4
4
|
const fs = require('fs');
|
|
@@ -13,6 +13,23 @@ const CONV_DIR = path.join(os.homedir(), '.natureco', 'conversations');
|
|
|
13
13
|
// Conversation history for multi-turn chat (deprecated - now using disk storage)
|
|
14
14
|
const conversationHistory = new Map();
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Generate default conversation ID based on provider config
|
|
18
|
+
*/
|
|
19
|
+
function generateDefaultConvId() {
|
|
20
|
+
const config = getConfig();
|
|
21
|
+
|
|
22
|
+
// Use provider URL + model as base for consistent ID
|
|
23
|
+
const providerUrl = config.providerUrl || 'default';
|
|
24
|
+
const model = config.providerModel || 'default';
|
|
25
|
+
|
|
26
|
+
// Create simple hash-like ID from provider + model
|
|
27
|
+
const base = `${providerUrl}_${model}`.replace(/[^a-z0-9]/gi, '_').toLowerCase();
|
|
28
|
+
|
|
29
|
+
// Return consistent ID (e.g., "groq_llama_3_1_8b_instant")
|
|
30
|
+
return base.slice(0, 50); // Limit length
|
|
31
|
+
}
|
|
32
|
+
|
|
16
33
|
/**
|
|
17
34
|
* Load conversation from disk
|
|
18
35
|
*/
|
|
@@ -218,7 +235,8 @@ async function sendMessageToProvider(apiKey, message, conversationId = null, sys
|
|
|
218
235
|
}
|
|
219
236
|
|
|
220
237
|
// Get or create conversation history (load from disk)
|
|
221
|
-
|
|
238
|
+
// Use consistent ID based on provider config instead of timestamp
|
|
239
|
+
const convId = conversationId || generateDefaultConvId();
|
|
222
240
|
const history = loadConversation(convId);
|
|
223
241
|
|
|
224
242
|
// Build messages
|