natureco-cli 2.2.8 → 2.3.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
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.3.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.3.0',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
|
@@ -136,14 +136,14 @@ async function startGateway() {
|
|
|
136
136
|
|
|
137
137
|
async function runGatewayWorker() {
|
|
138
138
|
// This runs in the background
|
|
139
|
-
log('gateway', 'Starting NatureCo Gateway...', 'green');
|
|
139
|
+
log('gateway', 'Starting NatureCo Gateway v2.3.0...', 'green');
|
|
140
140
|
|
|
141
141
|
// Load config
|
|
142
142
|
const { getConfig } = require('../utils/config');
|
|
143
143
|
const config = getConfig();
|
|
144
144
|
|
|
145
|
-
if (!config || !config.
|
|
146
|
-
log('gateway', '
|
|
145
|
+
if (!config || !config.providerUrl) {
|
|
146
|
+
log('gateway', 'Setup yapılmamış. Run "natureco setup" first.', 'red');
|
|
147
147
|
process.exit(1);
|
|
148
148
|
}
|
|
149
149
|
|
|
@@ -293,10 +293,17 @@ async function startWhatsAppProvider(sessionDir, config) {
|
|
|
293
293
|
log('whatsapp', `Inbound message +${sender} -> +${ownNumber} (${messageText.length} chars)`, 'cyan');
|
|
294
294
|
|
|
295
295
|
try {
|
|
296
|
+
// v2.x: Send to universal provider (Groq/OpenAI/Anthropic)
|
|
296
297
|
const { sendMessage } = require('../utils/api');
|
|
297
|
-
log('whatsapp', 'Sending to
|
|
298
|
+
log('whatsapp', 'Sending to AI provider...', 'cyan');
|
|
298
299
|
|
|
299
|
-
|
|
300
|
+
// Use WhatsApp-specific conversation ID for context
|
|
301
|
+
const conversationId = `whatsapp_${sender}`;
|
|
302
|
+
|
|
303
|
+
// WhatsApp system prompt
|
|
304
|
+
const 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.`;
|
|
305
|
+
|
|
306
|
+
const response = await sendMessage(null, null, messageText, conversationId, systemPrompt);
|
|
300
307
|
const reply = response?.reply || response?.message || '';
|
|
301
308
|
|
|
302
309
|
if (reply) {
|
|
@@ -309,10 +316,10 @@ async function startWhatsAppProvider(sessionDir, config) {
|
|
|
309
316
|
|
|
310
317
|
log('whatsapp', `Reply sent (${reply.length} chars)`, 'green');
|
|
311
318
|
} else {
|
|
312
|
-
log('whatsapp', 'No reply from
|
|
319
|
+
log('whatsapp', 'No reply from provider', 'yellow');
|
|
313
320
|
}
|
|
314
321
|
} catch (err) {
|
|
315
|
-
log('whatsapp', `
|
|
322
|
+
log('whatsapp', `Provider error: ${err.message}`, 'red');
|
|
316
323
|
}
|
|
317
324
|
}
|
|
318
325
|
});
|
package/src/utils/api.js
CHANGED
|
@@ -302,8 +302,14 @@ function clearConversation(conversationId) {
|
|
|
302
302
|
|
|
303
303
|
/**
|
|
304
304
|
* Legacy function for compatibility
|
|
305
|
+
* Now supports custom system prompts for different platforms (terminal, WhatsApp, etc.)
|
|
305
306
|
*/
|
|
306
307
|
async function sendMessage(apiKey, botId, message, conversationId = null, skillPrompts = '') {
|
|
308
|
+
// If skillPrompts is actually a system prompt (string), use it directly
|
|
309
|
+
if (typeof skillPrompts === 'string' && skillPrompts.includes('assistant')) {
|
|
310
|
+
return sendMessageToProvider(apiKey, message, conversationId, skillPrompts);
|
|
311
|
+
}
|
|
312
|
+
|
|
307
313
|
// Get user's home directory
|
|
308
314
|
const homeDir = os.homedir();
|
|
309
315
|
|