natureco-cli 2.13.28 → 2.13.30
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 +7 -0
- package/src/utils/memory.js +22 -5
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.13.
|
|
214
|
+
<div class="version-badge" id="version-badge">v2.13.30</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.13.
|
|
344
|
+
version: 'v2.13.30',
|
|
345
345
|
bots: cfg.bots || [],
|
|
346
346
|
telegramToken: cfg.telegramToken || null,
|
|
347
347
|
whatsappConnected: cfg.whatsappConnected || false,
|
package/src/utils/api.js
CHANGED
|
@@ -784,6 +784,13 @@ TOOL SELECTION GUIDE:
|
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
786
|
|
|
787
|
+
// Add memory prompt
|
|
788
|
+
const { getMemoryPrompt } = require('./memory');
|
|
789
|
+
const memoryPrompt = getMemoryPrompt(botId);
|
|
790
|
+
if (memoryPrompt) {
|
|
791
|
+
systemPrompt += '\n\n' + memoryPrompt;
|
|
792
|
+
}
|
|
793
|
+
|
|
787
794
|
return sendMessageToProvider(apiKey, message, conversationId, systemPrompt);
|
|
788
795
|
}
|
|
789
796
|
|
package/src/utils/memory.js
CHANGED
|
@@ -46,12 +46,29 @@ function loadMemory(botId) {
|
|
|
46
46
|
lastSeen: data.lastSeen || null,
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
-
// Migrate old format to new format
|
|
50
|
-
if (Array.isArray(memory.preferences)
|
|
51
|
-
memory.preferences = memory.preferences.map(p =>
|
|
49
|
+
// Migrate old format to new format - check each item individually
|
|
50
|
+
if (Array.isArray(memory.preferences)) {
|
|
51
|
+
memory.preferences = memory.preferences.map(p => {
|
|
52
|
+
if (typeof p === 'string') return { value: p, score: 5, updatedAt: new Date().toISOString() };
|
|
53
|
+
return p; // already correct format
|
|
54
|
+
});
|
|
52
55
|
}
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
|
|
57
|
+
if (Array.isArray(memory.facts)) {
|
|
58
|
+
memory.facts = memory.facts.map(f => {
|
|
59
|
+
if (typeof f === 'string') {
|
|
60
|
+
return { value: f, score: 5, updatedAt: new Date().toISOString() };
|
|
61
|
+
}
|
|
62
|
+
if (f && typeof f === 'object' && typeof f.value === 'object') {
|
|
63
|
+
// Nested object: {value: {value: "...", score: 6}} → flatten
|
|
64
|
+
return {
|
|
65
|
+
value: f.value.value || '',
|
|
66
|
+
score: f.value.score || 5,
|
|
67
|
+
updatedAt: f.value.updatedAt || new Date().toISOString()
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
return f; // already correct format
|
|
71
|
+
}).filter(f => f && f.value && typeof f.value === 'string' && f.value.length > 0);
|
|
55
72
|
}
|
|
56
73
|
|
|
57
74
|
return memory;
|