@dudousxd/nestjs-agent-react 0.12.0 → 0.13.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/dist/index.cjs +20 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +20 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -542,6 +542,9 @@ var AgentChatTransport = class {
|
|
|
542
542
|
props: event.props,
|
|
543
543
|
...event.version !== void 0 ? {
|
|
544
544
|
version: event.version
|
|
545
|
+
} : {},
|
|
546
|
+
...event.toolCallId !== void 0 ? {
|
|
547
|
+
toolCallId: event.toolCallId
|
|
545
548
|
} : {}
|
|
546
549
|
}
|
|
547
550
|
});
|
|
@@ -1898,7 +1901,8 @@ function readUiComponent(part) {
|
|
|
1898
1901
|
id,
|
|
1899
1902
|
component: data.component,
|
|
1900
1903
|
props: isRecord2(data.props) ? data.props : {},
|
|
1901
|
-
version: typeof data.version === "number" ? data.version : null
|
|
1904
|
+
version: typeof data.version === "number" ? data.version : null,
|
|
1905
|
+
toolCallId: typeof data.toolCallId === "string" ? data.toolCallId : null
|
|
1902
1906
|
};
|
|
1903
1907
|
}
|
|
1904
1908
|
__name(readUiComponent, "readUiComponent");
|
|
@@ -3336,8 +3340,10 @@ function storedMessageToUiMessage(message) {
|
|
|
3336
3340
|
url: attachment.url
|
|
3337
3341
|
});
|
|
3338
3342
|
}
|
|
3343
|
+
const toolCallIds = new Set((message.toolCalls ?? []).map((call) => call.id));
|
|
3344
|
+
const pushedByCall = /* @__PURE__ */ new Map();
|
|
3339
3345
|
for (const component of message.ui ?? []) {
|
|
3340
|
-
|
|
3346
|
+
const part = {
|
|
3341
3347
|
type: "data-ui",
|
|
3342
3348
|
id: component.id,
|
|
3343
3349
|
data: {
|
|
@@ -3346,9 +3352,19 @@ function storedMessageToUiMessage(message) {
|
|
|
3346
3352
|
props: component.props,
|
|
3347
3353
|
...component.version !== void 0 ? {
|
|
3348
3354
|
version: component.version
|
|
3355
|
+
} : {},
|
|
3356
|
+
...component.toolCallId !== void 0 ? {
|
|
3357
|
+
toolCallId: component.toolCallId
|
|
3349
3358
|
} : {}
|
|
3350
3359
|
}
|
|
3351
|
-
}
|
|
3360
|
+
};
|
|
3361
|
+
if (component.toolCallId !== void 0 && toolCallIds.has(component.toolCallId)) {
|
|
3362
|
+
const list = pushedByCall.get(component.toolCallId) ?? [];
|
|
3363
|
+
list.push(part);
|
|
3364
|
+
pushedByCall.set(component.toolCallId, list);
|
|
3365
|
+
} else {
|
|
3366
|
+
parts.push(part);
|
|
3367
|
+
}
|
|
3352
3368
|
}
|
|
3353
3369
|
for (const approval of message.approvals ?? []) {
|
|
3354
3370
|
parts.push({
|
|
@@ -3419,6 +3435,7 @@ function storedMessageToUiMessage(message) {
|
|
|
3419
3435
|
input: call.input
|
|
3420
3436
|
}
|
|
3421
3437
|
});
|
|
3438
|
+
parts.push(...pushedByCall.get(call.id) ?? []);
|
|
3422
3439
|
}
|
|
3423
3440
|
return {
|
|
3424
3441
|
id: message.id,
|