teodor-new-chat-ui 4.0.2 → 4.0.4
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.esm.js +22 -11
- package/dist/index.umd.js +17 -17
- package/dist/types/api.d.ts +20 -11
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -2840,28 +2840,39 @@ function pl(e, t) {
|
|
|
2840
2840
|
return e;
|
|
2841
2841
|
}
|
|
2842
2842
|
if (t.type === "tool_start") {
|
|
2843
|
-
const r =
|
|
2844
|
-
if (
|
|
2843
|
+
const r = t.id ?? t.call_id, o = t.name ?? t.tool;
|
|
2844
|
+
if (!r)
|
|
2845
|
+
return e;
|
|
2846
|
+
const s = `tool-${r}`, i = { type: "tool_call", id: r, name: o, args: t.args };
|
|
2847
|
+
if (e.messages.find((u) => u.id === s))
|
|
2845
2848
|
return {
|
|
2846
2849
|
...e,
|
|
2847
|
-
toolIndex: { ...e.toolIndex, [
|
|
2850
|
+
toolIndex: { ...e.toolIndex, [r]: s }
|
|
2848
2851
|
};
|
|
2849
|
-
const
|
|
2850
|
-
id:
|
|
2852
|
+
const c = {
|
|
2853
|
+
id: s,
|
|
2851
2854
|
role: "tool",
|
|
2852
|
-
name:
|
|
2855
|
+
name: o,
|
|
2853
2856
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2854
|
-
content: [
|
|
2857
|
+
content: [i]
|
|
2855
2858
|
};
|
|
2856
2859
|
return {
|
|
2857
2860
|
...e,
|
|
2858
|
-
messages: [...e.messages,
|
|
2859
|
-
toolIndex: { ...e.toolIndex, [
|
|
2861
|
+
messages: [...e.messages, c],
|
|
2862
|
+
toolIndex: { ...e.toolIndex, [r]: s }
|
|
2860
2863
|
};
|
|
2861
2864
|
}
|
|
2862
2865
|
if (t.type === "tool_result") {
|
|
2863
|
-
const r =
|
|
2864
|
-
|
|
2866
|
+
const r = t.id ?? t.call_id;
|
|
2867
|
+
if (!r)
|
|
2868
|
+
return e;
|
|
2869
|
+
const o = e.toolIndex[r] ?? `tool-${r}`, s = {
|
|
2870
|
+
type: "tool_result",
|
|
2871
|
+
toolCallId: r,
|
|
2872
|
+
output: t.output,
|
|
2873
|
+
error: t.error
|
|
2874
|
+
}, i = e.messages.find((u) => u.id === o), a = { id: o, role: "tool", content: [s], createdAt: (/* @__PURE__ */ new Date()).toISOString() }, c = i ? Hs(e.messages, o, [s]) : [...e.messages, a];
|
|
2875
|
+
return { ...e, messages: c };
|
|
2865
2876
|
}
|
|
2866
2877
|
if (t.type === "checkpoint") {
|
|
2867
2878
|
const r = t.checkpointNs ?? e.lastCheckpointNs ?? null, o = Wg(e.messages, t.checkpointId, r);
|