neoagent 1.4.4 → 1.4.5

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neoagent",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "Proactive personal AI agent with no limits",
5
5
  "license": "MIT",
6
6
  "main": "server/index.js",
@@ -81,7 +81,33 @@ class GoogleProvider extends BaseProvider {
81
81
  });
82
82
  }
83
83
 
84
- return { systemInstruction, history };
84
+ const normalizedHistory = [];
85
+ let currentRole = null;
86
+ let currentParts = [];
87
+
88
+ for (const msg of history) {
89
+ if (msg.role === currentRole) {
90
+ currentParts.push(...msg.parts);
91
+ } else {
92
+ if (currentRole) {
93
+ normalizedHistory.push({ role: currentRole, parts: currentParts });
94
+ }
95
+ currentRole = msg.role;
96
+ currentParts = [...msg.parts];
97
+ }
98
+ }
99
+ if (currentRole) {
100
+ normalizedHistory.push({ role: currentRole, parts: currentParts });
101
+ }
102
+
103
+ if (normalizedHistory.length > 0 && normalizedHistory[0].role !== 'user') {
104
+ normalizedHistory.unshift({
105
+ role: 'user',
106
+ parts: [{ text: '[Conversation Resumed]' }]
107
+ });
108
+ }
109
+
110
+ return { systemInstruction, history: normalizedHistory };
85
111
  }
86
112
 
87
113
  async chat(messages, tools = [], options = {}) {