@voltagent/core 1.1.31 → 1.1.33
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 +19 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14280,6 +14280,23 @@ function toContextMap(context8) {
|
|
|
14280
14280
|
return context8 instanceof Map ? context8 : new Map(Object.entries(context8));
|
|
14281
14281
|
}
|
|
14282
14282
|
__name(toContextMap, "toContextMap");
|
|
14283
|
+
var convertToModelMessagesFix = /* @__PURE__ */ __name((uiMessages) => {
|
|
14284
|
+
return renameProviderOptions((0, import_ai4.convertToModelMessages)(uiMessages));
|
|
14285
|
+
}, "convertToModelMessagesFix");
|
|
14286
|
+
function renameProviderOptions(messages) {
|
|
14287
|
+
return messages.map((msg) => {
|
|
14288
|
+
if (!Array.isArray(msg.content)) return msg;
|
|
14289
|
+
const content = msg.content.map((part) => {
|
|
14290
|
+
if (part && typeof part === "object" && "providerOptions" in part) {
|
|
14291
|
+
const { providerOptions, ...rest } = part;
|
|
14292
|
+
return { ...rest, providerMetadata: providerOptions };
|
|
14293
|
+
}
|
|
14294
|
+
return part;
|
|
14295
|
+
});
|
|
14296
|
+
return { ...msg, content };
|
|
14297
|
+
});
|
|
14298
|
+
}
|
|
14299
|
+
__name(renameProviderOptions, "renameProviderOptions");
|
|
14283
14300
|
function cloneGenerateTextResultWithContext(result, overrides) {
|
|
14284
14301
|
const prototype = Object.getPrototypeOf(result);
|
|
14285
14302
|
const clone = Object.create(prototype);
|
|
@@ -15333,7 +15350,7 @@ var Agent = class {
|
|
|
15333
15350
|
const buffer = this.getConversationBuffer(oc);
|
|
15334
15351
|
const uiMessages = await this.prepareMessages(input, oc, options, buffer);
|
|
15335
15352
|
const hooks = this.getMergedHooks(options);
|
|
15336
|
-
let messages = (
|
|
15353
|
+
let messages = convertToModelMessagesFix(uiMessages);
|
|
15337
15354
|
if (hooks.onPrepareModelMessages) {
|
|
15338
15355
|
const result = await hooks.onPrepareModelMessages({
|
|
15339
15356
|
modelMessages: messages,
|
|
@@ -15968,7 +15985,7 @@ ${toolkit.instructions}`;
|
|
|
15968
15985
|
}
|
|
15969
15986
|
});
|
|
15970
15987
|
try {
|
|
15971
|
-
const retrieverInput = typeof input === "string" ? input : Array.isArray(input) && input[0]?.content !== void 0 ? input : (
|
|
15988
|
+
const retrieverInput = typeof input === "string" ? input : Array.isArray(input) && input[0]?.content !== void 0 ? input : convertToModelMessagesFix(input);
|
|
15972
15989
|
const retrievedContent = await oc.traceContext.withSpan(retrieverSpan, async () => {
|
|
15973
15990
|
if (!this.retriever) return null;
|
|
15974
15991
|
return await this.retriever.retrieve(retrieverInput, {
|