@kognitivedev/vercel-ai-provider 0.1.4 → 0.1.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/dist/index.js +4 -1
- package/package.json +1 -1
- package/src/index.ts +3 -1
package/dist/index.js
CHANGED
|
@@ -103,7 +103,10 @@ function createCognitiveLayer(config) {
|
|
|
103
103
|
// 2) If first message is system, replace its content.
|
|
104
104
|
if (incomingMessages.length > 0 && ((_a = incomingMessages[0]) === null || _a === void 0 ? void 0 : _a.role) === "system") {
|
|
105
105
|
const updated = [...incomingMessages];
|
|
106
|
-
|
|
106
|
+
let systemMessage = updated[0];
|
|
107
|
+
if (typeof systemMessage.content === "string")
|
|
108
|
+
systemMessage.content = systemMessage + "\n\n" + memoryPrompt;
|
|
109
|
+
updated[0] = Object.assign(Object.assign({}, updated[0]), systemMessage);
|
|
107
110
|
return { nextParams, messages: updated, mode: "overwrite-first-system" };
|
|
108
111
|
}
|
|
109
112
|
// 3) Otherwise prepend a system message.
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -169,7 +169,9 @@ export function createCognitiveLayer(config: {
|
|
|
169
169
|
// 2) If first message is system, replace its content.
|
|
170
170
|
if (incomingMessages.length > 0 && incomingMessages[0]?.role === "system") {
|
|
171
171
|
const updated = [...incomingMessages];
|
|
172
|
-
|
|
172
|
+
let systemMessage = updated[0];
|
|
173
|
+
if(typeof systemMessage.content === "string") systemMessage.content = systemMessage + "\n\n" + memoryPrompt;
|
|
174
|
+
updated[0] = { ...updated[0], ...systemMessage };
|
|
173
175
|
return { nextParams, messages: updated, mode: "overwrite-first-system" };
|
|
174
176
|
}
|
|
175
177
|
|