teodor-new-chat-ui 4.3.605 → 4.3.606
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.
|
@@ -29,16 +29,12 @@ export declare function createArtifactPreviewFromSource({ base64, url, formatHin
|
|
|
29
29
|
export declare function createArtifactPreviewFromPlot(plot: PlotData): ArtifactPreview | null;
|
|
30
30
|
export declare function getToolProgress(message: ChatMessage): unknown[];
|
|
31
31
|
/**
|
|
32
|
-
* Check if an assistant message contains ONLY
|
|
33
|
-
* These messages should be hidden
|
|
34
|
-
* should be shown nested within the next assistant message with text.
|
|
32
|
+
* Check if an assistant message contains ONLY tool_calls (no meaningful text/media).
|
|
33
|
+
* These messages should be hidden and their logic hoisted into the next message.
|
|
35
34
|
*/
|
|
36
35
|
export declare function isAssistantMessageWithOnlyToolCalls(message: ChatMessage): boolean;
|
|
37
36
|
/**
|
|
38
37
|
* Check if a message should be hidden from the main message list.
|
|
39
|
-
* This includes:
|
|
40
|
-
* - Tool messages (role: "tool")
|
|
41
|
-
* - Assistant messages with only tool_call parts (no text)
|
|
42
38
|
*/
|
|
43
39
|
export declare function shouldHideMessageFromList(message: ChatMessage): boolean;
|
|
44
40
|
export type ToolExecutionEntry = {
|
package/dist/index.esm.js
CHANGED
|
@@ -3618,10 +3618,10 @@ function uu(e) {
|
|
|
3618
3618
|
return e.filter((t) => t.type === "text").map((t) => t.text).join("");
|
|
3619
3619
|
}
|
|
3620
3620
|
function ws(e) {
|
|
3621
|
-
const
|
|
3621
|
+
const n = (Array.isArray(e.content) ? e.content : Array.isArray(e.parts) ? e.parts : []).find((i) => i.type === "tool_call"), r = e.additionalKwargs ?? {}, o = typeof (n == null ? void 0 : n.id) == "string" && n.id || typeof r.toolCallId == "string" && r.toolCallId || (e.id.startsWith("tool-") ? e.id.slice(5) : void 0);
|
|
3622
3622
|
return {
|
|
3623
|
-
name: (typeof (
|
|
3624
|
-
toolCallId:
|
|
3623
|
+
name: (typeof (n == null ? void 0 : n.name) == "string" && n.name || typeof r.toolName == "string" && r.toolName || e.name && String(e.name)) ?? void 0,
|
|
3624
|
+
toolCallId: o ?? void 0
|
|
3625
3625
|
};
|
|
3626
3626
|
}
|
|
3627
3627
|
function du(e) {
|
|
@@ -3668,62 +3668,69 @@ function ki(e) {
|
|
|
3668
3668
|
return Array.isArray(t) ? t : [];
|
|
3669
3669
|
}
|
|
3670
3670
|
function fu(e) {
|
|
3671
|
-
|
|
3672
|
-
|
|
3671
|
+
if (e.role !== "assistant") return !1;
|
|
3672
|
+
const t = Array.isArray(e.content) ? e.content : Array.isArray(e.parts) ? e.parts : [], n = t.some((s) => s.type === "text" && s.text && s.text.trim().length > 0), r = t.some((s) => s.type === "image" || s.type === "image_url" || s.type === "file"), o = !!e.artifact;
|
|
3673
|
+
return !n && !r && !o;
|
|
3673
3674
|
}
|
|
3674
3675
|
function Bg(e) {
|
|
3675
|
-
return e.role === "tool" ? !0 : fu(e);
|
|
3676
|
+
return e.role === "tool" ? !0 : e.role === "assistant" ? fu(e) : !1;
|
|
3676
3677
|
}
|
|
3677
3678
|
function Hg(e, t) {
|
|
3678
|
-
|
|
3679
|
-
const n = [], r = e.findIndex((a) => a.id === t);
|
|
3679
|
+
const n = [], r = e.findIndex((s) => s.id === t);
|
|
3680
3680
|
if (r === -1) return n;
|
|
3681
3681
|
const o = /* @__PURE__ */ new Map();
|
|
3682
|
-
for (let
|
|
3683
|
-
const
|
|
3684
|
-
if (
|
|
3682
|
+
for (let s = r - 1; s >= 0; s--) {
|
|
3683
|
+
const i = e[s];
|
|
3684
|
+
if (i.role === "assistant" && !fu(i))
|
|
3685
3685
|
break;
|
|
3686
|
-
if (
|
|
3687
|
-
const
|
|
3688
|
-
|
|
3689
|
-
const
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
|
|
3686
|
+
if (i.role === "assistant") {
|
|
3687
|
+
const a = Array.isArray(i.content) ? i.content : Array.isArray(i.parts) ? i.parts : [];
|
|
3688
|
+
if (i.tool_calls)
|
|
3689
|
+
for (const l of i.tool_calls)
|
|
3690
|
+
l.id && l.name && o.set(l.id, {
|
|
3691
|
+
name: l.name,
|
|
3692
|
+
timestamp: i.createdAt
|
|
3693
|
+
});
|
|
3694
|
+
const c = a.filter((l) => l.type === "tool_call") || [];
|
|
3695
|
+
for (const l of c) {
|
|
3696
|
+
const u = l;
|
|
3697
|
+
u.id && u.name && o.set(u.id, {
|
|
3698
|
+
name: u.name,
|
|
3699
|
+
timestamp: i.createdAt
|
|
3693
3700
|
});
|
|
3694
3701
|
}
|
|
3695
3702
|
}
|
|
3696
|
-
if (
|
|
3697
|
-
const
|
|
3698
|
-
if (
|
|
3699
|
-
const
|
|
3703
|
+
if (i.role === "tool") {
|
|
3704
|
+
const a = ws(i), c = a.toolCallId, l = a.name || i.name || "tool";
|
|
3705
|
+
if (c && o.has(c)) {
|
|
3706
|
+
const u = o.get(c);
|
|
3700
3707
|
n.unshift({
|
|
3701
3708
|
type: "tool.start",
|
|
3702
|
-
toolName:
|
|
3703
|
-
toolCallId:
|
|
3704
|
-
content: `Starting ${
|
|
3705
|
-
timestamp:
|
|
3709
|
+
toolName: u.name,
|
|
3710
|
+
toolCallId: c,
|
|
3711
|
+
content: `Starting ${u.name}...`,
|
|
3712
|
+
timestamp: u.timestamp
|
|
3706
3713
|
});
|
|
3707
|
-
const
|
|
3714
|
+
const f = Array.isArray(i.content) ? i.content : Array.isArray(i.parts) ? i.parts : [], h = uu(f.filter((p) => p.type === "text"));
|
|
3708
3715
|
n.push({
|
|
3709
3716
|
type: "tool.end",
|
|
3710
|
-
toolName:
|
|
3711
|
-
toolCallId:
|
|
3712
|
-
content:
|
|
3713
|
-
timestamp:
|
|
3714
|
-
output:
|
|
3715
|
-
artifact:
|
|
3716
|
-
}), o.delete(
|
|
3717
|
+
toolName: l,
|
|
3718
|
+
toolCallId: c,
|
|
3719
|
+
content: h || `Finished ${l}`,
|
|
3720
|
+
timestamp: i.createdAt,
|
|
3721
|
+
output: h,
|
|
3722
|
+
artifact: i.artifact
|
|
3723
|
+
}), o.delete(c);
|
|
3717
3724
|
}
|
|
3718
3725
|
}
|
|
3719
3726
|
}
|
|
3720
|
-
for (const [
|
|
3727
|
+
for (const [s, i] of o.entries())
|
|
3721
3728
|
n.unshift({
|
|
3722
3729
|
type: "tool.start",
|
|
3723
|
-
toolName:
|
|
3724
|
-
toolCallId:
|
|
3725
|
-
content: `Starting ${
|
|
3726
|
-
timestamp:
|
|
3730
|
+
toolName: i.name,
|
|
3731
|
+
toolCallId: s,
|
|
3732
|
+
content: `Starting ${i.name}...`,
|
|
3733
|
+
timestamp: i.timestamp
|
|
3727
3734
|
});
|
|
3728
3735
|
return n;
|
|
3729
3736
|
}
|