@rpcbase/agents-sdk 0.3.0 → 0.5.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/agents-sdk.css +1 -1
- package/dist/client-routes.browser.js +31 -17
- package/dist/client-routes.d.ts +4 -1
- package/dist/client-routes.d.ts.map +1 -1
- package/dist/client-routes.js +31 -17
- package/dist/components/ai-elements/model-selector.d.ts.map +1 -1
- package/dist/components/artifact.d.ts +2 -1
- package/dist/components/artifact.d.ts.map +1 -1
- package/dist/components/chat.d.ts +4 -1
- package/dist/components/chat.d.ts.map +1 -1
- package/dist/components/greeting.d.ts +6 -1
- package/dist/components/greeting.d.ts.map +1 -1
- package/dist/components/messages.d.ts +3 -1
- package/dist/components/messages.d.ts.map +1 -1
- package/dist/components/multimodal-input.d.ts +2 -1
- package/dist/components/multimodal-input.d.ts.map +1 -1
- package/dist/components/suggested-actions.d.ts +2 -1
- package/dist/components/suggested-actions.d.ts.map +1 -1
- package/dist/components/ui/dialog.d.ts +1 -4
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/{data-stream-handler-CTBOlLdZ.js → data-stream-handler-COHb5rm3.js} +274 -268
- package/dist/{data-stream-handler-LGFXl3Kj.js → data-stream-handler-YDybFA4k.js} +273 -267
- package/dist/{handler-5D9tLMpX.js → handler-CmhA4mQ1.js} +1 -1
- package/dist/index.browser.js +1 -1
- package/dist/index.js +1 -1
- package/dist/pages/ChatNewPage.d.ts +7 -1
- package/dist/pages/ChatNewPage.d.ts.map +1 -1
- package/dist/pages/ChatPage.d.ts +7 -1
- package/dist/pages/ChatPage.d.ts.map +1 -1
- package/dist/routes.js +1 -1
- package/dist/runtime.js +1 -1
- package/dist/tailwind-source.js +1 -1
- package/package.json +1 -1
|
@@ -52947,7 +52947,7 @@ var LL = _(FL, IL), RL = ep, zL = Sd, BL = c.forwardRef(({ className: e, ...t },
|
|
|
52947
52947
|
let { resolvedTheme: r, theme: i } = hf();
|
|
52948
52948
|
return /* @__PURE__ */ B(qu, {
|
|
52949
52949
|
ref: n,
|
|
52950
|
-
className: W("agents-sdk fixed inset-0 z-50 bg-foreground/50 opacity-
|
|
52950
|
+
className: W("agents-sdk fixed inset-0 z-50 bg-foreground/50 opacity-0 transition-opacity duration-150 data-open:opacity-100 data-closed:opacity-0 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0", e),
|
|
52951
52951
|
"data-agents-sdk-resolved-theme": r,
|
|
52952
52952
|
"data-agents-sdk-theme": i,
|
|
52953
52953
|
...t
|
|
@@ -52968,15 +52968,15 @@ var HL = c.forwardRef(({ asChild: e = !1, children: t, ...n }, r) => /* @__PURE_
|
|
|
52968
52968
|
children: t
|
|
52969
52969
|
}));
|
|
52970
52970
|
HL.displayName = "DialogClose";
|
|
52971
|
-
var UL = c.forwardRef(({
|
|
52972
|
-
let { resolvedTheme:
|
|
52973
|
-
return /* @__PURE__ */ V(zL, { children: [/* @__PURE__ */ B(BL, {
|
|
52974
|
-
ref:
|
|
52975
|
-
className: W("agents-sdk fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-open:
|
|
52976
|
-
"data-agents-sdk-resolved-theme":
|
|
52977
|
-
"data-agents-sdk-theme":
|
|
52978
|
-
...
|
|
52979
|
-
children: [
|
|
52971
|
+
var UL = c.forwardRef(({ className: e, children: t, ...n }, r) => {
|
|
52972
|
+
let { resolvedTheme: i, theme: a } = hf();
|
|
52973
|
+
return /* @__PURE__ */ V(zL, { children: [/* @__PURE__ */ B(BL, {}), /* @__PURE__ */ V(yd, {
|
|
52974
|
+
ref: r,
|
|
52975
|
+
className: W("agents-sdk fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 opacity-0 shadow-lg transition-opacity duration-200 data-open:opacity-100 data-closed:opacity-0 data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 sm:rounded-lg", e),
|
|
52976
|
+
"data-agents-sdk-resolved-theme": i,
|
|
52977
|
+
"data-agents-sdk-theme": a,
|
|
52978
|
+
...n,
|
|
52979
|
+
children: [t, /* @__PURE__ */ V(nd, {
|
|
52980
52980
|
className: "absolute right-4 top-4 cursor-pointer rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-disabled:pointer-events-none",
|
|
52981
52981
|
children: [/* @__PURE__ */ B(Xf, { className: "h-4 w-4" }), /* @__PURE__ */ B("span", {
|
|
52982
52982
|
className: "sr-only",
|
|
@@ -53237,7 +53237,6 @@ oR.displayName = "CommandShortcut";
|
|
|
53237
53237
|
//#endregion
|
|
53238
53238
|
//#region src/components/ai-elements/model-selector.tsx
|
|
53239
53239
|
var sR = (e) => /* @__PURE__ */ B(RL, { ...e }), cR = (e) => /* @__PURE__ */ B(VL, { ...e }), lR = ({ className: e, children: t, title: n = "Model Selector", ...r }) => /* @__PURE__ */ V(UL, {
|
|
53240
|
-
backdropClassName: "!bg-transparent",
|
|
53241
53240
|
className: W("p-0", e),
|
|
53242
53241
|
...r,
|
|
53243
53242
|
children: [/* @__PURE__ */ B(KL, {
|
|
@@ -55584,17 +55583,12 @@ var UB = ({ className: e, ...t }) => /* @__PURE__ */ B("form", {
|
|
|
55584
55583
|
});
|
|
55585
55584
|
//#endregion
|
|
55586
55585
|
//#region src/components/suggested-actions.tsx
|
|
55587
|
-
function YB({ chatId: e, sendMessage: t }) {
|
|
55588
|
-
let { getChatPath:
|
|
55589
|
-
|
|
55590
|
-
"Write code to demonstrate Dijkstra's algorithm",
|
|
55591
|
-
"Help me write an essay about Silicon Valley",
|
|
55592
|
-
"What is the weather in San Francisco?"
|
|
55593
|
-
];
|
|
55594
|
-
return /* @__PURE__ */ B("div", {
|
|
55586
|
+
function YB({ chatId: e, sendMessage: t, suggestedActions: n }) {
|
|
55587
|
+
let { getChatPath: r } = lt(), i = n.map((e) => e.trim()).filter(Boolean);
|
|
55588
|
+
return i.length === 0 ? null : /* @__PURE__ */ B("div", {
|
|
55595
55589
|
className: "grid w-full gap-2 sm:grid-cols-2",
|
|
55596
55590
|
"data-testid": "suggested-actions",
|
|
55597
|
-
children:
|
|
55591
|
+
children: i.map((n, i) => /* @__PURE__ */ B(Dj.div, {
|
|
55598
55592
|
animate: {
|
|
55599
55593
|
opacity: 1,
|
|
55600
55594
|
y: 0
|
|
@@ -55610,22 +55604,22 @@ function YB({ chatId: e, sendMessage: t }) {
|
|
|
55610
55604
|
transition: { delay: .05 * i },
|
|
55611
55605
|
children: /* @__PURE__ */ B(JB, {
|
|
55612
55606
|
className: "h-auto w-full whitespace-normal p-3 text-left",
|
|
55613
|
-
onClick: (
|
|
55614
|
-
window.history.pushState({}, "",
|
|
55607
|
+
onClick: (n) => {
|
|
55608
|
+
window.history.pushState({}, "", r(e)), t({
|
|
55615
55609
|
role: "user",
|
|
55616
55610
|
parts: [{
|
|
55617
55611
|
type: "text",
|
|
55618
|
-
text:
|
|
55612
|
+
text: n
|
|
55619
55613
|
}]
|
|
55620
55614
|
});
|
|
55621
55615
|
},
|
|
55622
|
-
suggestion:
|
|
55623
|
-
children:
|
|
55616
|
+
suggestion: n,
|
|
55617
|
+
children: n
|
|
55624
55618
|
})
|
|
55625
|
-
},
|
|
55619
|
+
}, `${i}-${n}`))
|
|
55626
55620
|
});
|
|
55627
55621
|
}
|
|
55628
|
-
var XB = _(YB, (e, t) => e.chatId
|
|
55622
|
+
var XB = _(YB, (e, t) => !(e.chatId !== t.chatId || !_e(e.suggestedActions, t.suggestedActions)));
|
|
55629
55623
|
//#endregion
|
|
55630
55624
|
//#region src/components/multimodal-input.tsx
|
|
55631
55625
|
function ZB(e, t) {
|
|
@@ -55664,37 +55658,37 @@ function iV(e, t) {
|
|
|
55664
55658
|
let r = tV(t.scrollArea);
|
|
55665
55659
|
r && (r.scrollTop = 0);
|
|
55666
55660
|
}
|
|
55667
|
-
function aV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments: a, setAttachments: o, messages: c, setMessages: l, sendMessage: u, className: d, selectedModelId: f, onModelChange: p, openaiReasoningEffort: m = s, onOpenAIReasoningEffortChange: h }) {
|
|
55668
|
-
let
|
|
55661
|
+
function aV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments: a, setAttachments: o, messages: c, setMessages: l, sendMessage: u, className: d, selectedModelId: f, onModelChange: p, openaiReasoningEffort: m = s, onOpenAIReasoningEffortChange: h, suggestedActions: g }) {
|
|
55662
|
+
let _ = O(null), y = O(null), [b, S] = k($B), { width: C } = vM(), { getChatPath: w } = lt();
|
|
55669
55663
|
x(() => {
|
|
55670
|
-
rV(
|
|
55671
|
-
scrollArea:
|
|
55672
|
-
setScrollAreaHeight:
|
|
55664
|
+
rV(_.current, {
|
|
55665
|
+
scrollArea: y.current,
|
|
55666
|
+
setScrollAreaHeight: S
|
|
55673
55667
|
});
|
|
55674
|
-
}, [t,
|
|
55675
|
-
let
|
|
55668
|
+
}, [t, C]);
|
|
55669
|
+
let T = O(!1);
|
|
55676
55670
|
x(() => {
|
|
55677
|
-
if (!
|
|
55671
|
+
if (!T.current && C) {
|
|
55678
55672
|
let e = setTimeout(() => {
|
|
55679
|
-
|
|
55673
|
+
_.current?.focus(), T.current = !0;
|
|
55680
55674
|
}, 100);
|
|
55681
55675
|
return () => clearTimeout(e);
|
|
55682
55676
|
}
|
|
55683
|
-
}, [
|
|
55684
|
-
let [
|
|
55677
|
+
}, [C]);
|
|
55678
|
+
let [E, D] = pM("input", "");
|
|
55685
55679
|
x(() => {
|
|
55686
|
-
|
|
55687
|
-
}, [
|
|
55688
|
-
|
|
55689
|
-
}, [t,
|
|
55690
|
-
let
|
|
55680
|
+
_.current && n(_.current.value || E || "");
|
|
55681
|
+
}, [E, n]), x(() => {
|
|
55682
|
+
D(t);
|
|
55683
|
+
}, [t, D]);
|
|
55684
|
+
let A = (e) => {
|
|
55691
55685
|
n(e.target.value), rV(e.currentTarget, {
|
|
55692
|
-
scrollArea:
|
|
55693
|
-
setScrollAreaHeight:
|
|
55686
|
+
scrollArea: y.current,
|
|
55687
|
+
setScrollAreaHeight: S
|
|
55694
55688
|
});
|
|
55695
|
-
},
|
|
55689
|
+
}, j = O(null), [M, N] = k([]), P = v(() => {
|
|
55696
55690
|
let r = Yd();
|
|
55697
|
-
window.history.pushState({}, "", $d(
|
|
55691
|
+
window.history.pushState({}, "", $d(w(e), r)), u({
|
|
55698
55692
|
role: "user",
|
|
55699
55693
|
parts: [...a.map((e) => ({
|
|
55700
55694
|
type: "file",
|
|
@@ -55705,21 +55699,21 @@ function aV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
55705
55699
|
type: "text",
|
|
55706
55700
|
text: t
|
|
55707
55701
|
}]
|
|
55708
|
-
}), o([]),
|
|
55709
|
-
scrollArea:
|
|
55710
|
-
setScrollAreaHeight:
|
|
55711
|
-
}),
|
|
55702
|
+
}), o([]), D(""), n(""), iV(_.current, {
|
|
55703
|
+
scrollArea: y.current,
|
|
55704
|
+
setScrollAreaHeight: S
|
|
55705
|
+
}), C && C > 768 && _.current?.focus();
|
|
55712
55706
|
}, [
|
|
55713
55707
|
t,
|
|
55714
55708
|
n,
|
|
55715
55709
|
a,
|
|
55716
55710
|
u,
|
|
55717
55711
|
o,
|
|
55718
|
-
|
|
55719
|
-
|
|
55712
|
+
D,
|
|
55713
|
+
C,
|
|
55720
55714
|
e,
|
|
55721
|
-
|
|
55722
|
-
]),
|
|
55715
|
+
w
|
|
55716
|
+
]), F = v(async (e) => {
|
|
55723
55717
|
try {
|
|
55724
55718
|
let t = Yd(), n = await fetch("/api/rb/file-uploads", {
|
|
55725
55719
|
method: "POST",
|
|
@@ -55780,48 +55774,49 @@ function aV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
55780
55774
|
} catch {
|
|
55781
55775
|
se.error("Failed to upload file, please try again!");
|
|
55782
55776
|
}
|
|
55783
|
-
}, []),
|
|
55777
|
+
}, []), I = v(async (e) => {
|
|
55784
55778
|
let t = Array.from(e.target.files || []);
|
|
55785
|
-
|
|
55779
|
+
N(t.map((e) => e.name));
|
|
55786
55780
|
try {
|
|
55787
|
-
let e = t.map((e) =>
|
|
55781
|
+
let e = t.map((e) => F(e)), n = (await Promise.all(e)).filter((e) => e !== void 0);
|
|
55788
55782
|
o((e) => [...e, ...n]);
|
|
55789
55783
|
} catch (e) {
|
|
55790
55784
|
console.error("Error uploading files!", e);
|
|
55791
55785
|
} finally {
|
|
55792
|
-
|
|
55786
|
+
N([]);
|
|
55793
55787
|
}
|
|
55794
|
-
}, [o,
|
|
55788
|
+
}, [o, F]), L = v(async (e) => {
|
|
55795
55789
|
let t = e.clipboardData?.items;
|
|
55796
55790
|
if (!t) return;
|
|
55797
55791
|
let n = Array.from(t).filter((e) => e.type.startsWith("image/"));
|
|
55798
55792
|
if (n.length !== 0) {
|
|
55799
|
-
e.preventDefault(),
|
|
55793
|
+
e.preventDefault(), N((e) => [...e, "Pasted image"]);
|
|
55800
55794
|
try {
|
|
55801
|
-
let e = n.map((e) => e.getAsFile()).filter((e) => e !== null).map((e) =>
|
|
55795
|
+
let e = n.map((e) => e.getAsFile()).filter((e) => e !== null).map((e) => F(e)), t = (await Promise.all(e)).filter((e) => e !== void 0 && e.url !== void 0 && e.contentType !== void 0);
|
|
55802
55796
|
o((e) => [...e, ...t]);
|
|
55803
55797
|
} catch (e) {
|
|
55804
55798
|
console.error("Error uploading pasted images:", e), se.error("Failed to upload pasted image(s)");
|
|
55805
55799
|
} finally {
|
|
55806
|
-
|
|
55800
|
+
N([]);
|
|
55807
55801
|
}
|
|
55808
55802
|
}
|
|
55809
|
-
}, [o,
|
|
55803
|
+
}, [o, F]);
|
|
55810
55804
|
return x(() => {
|
|
55811
|
-
let e =
|
|
55812
|
-
if (e) return e.addEventListener("paste",
|
|
55813
|
-
}, [
|
|
55805
|
+
let e = _.current;
|
|
55806
|
+
if (e) return e.addEventListener("paste", L), () => e.removeEventListener("paste", L);
|
|
55807
|
+
}, [L]), /* @__PURE__ */ V("div", {
|
|
55814
55808
|
className: W("relative flex w-full flex-col gap-4", d),
|
|
55815
55809
|
children: [
|
|
55816
|
-
c.length === 0 && a.length === 0 &&
|
|
55810
|
+
c.length === 0 && a.length === 0 && M.length === 0 && g && g.length > 0 && /* @__PURE__ */ B(XB, {
|
|
55817
55811
|
chatId: e,
|
|
55818
|
-
sendMessage: u
|
|
55812
|
+
sendMessage: u,
|
|
55813
|
+
suggestedActions: g
|
|
55819
55814
|
}),
|
|
55820
55815
|
/* @__PURE__ */ B("input", {
|
|
55821
55816
|
className: "-top-4 -left-4 pointer-events-none fixed size-0.5 opacity-0",
|
|
55822
55817
|
multiple: !0,
|
|
55823
|
-
onChange:
|
|
55824
|
-
ref:
|
|
55818
|
+
onChange: I,
|
|
55819
|
+
ref: j,
|
|
55825
55820
|
tabIndex: -1,
|
|
55826
55821
|
type: "file"
|
|
55827
55822
|
}),
|
|
@@ -55829,23 +55824,23 @@ function aV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
55829
55824
|
className: "rounded-xl border border-border bg-background p-3 shadow-xs transition-all duration-200 focus-within:border-border hover:border-muted-foreground/50",
|
|
55830
55825
|
onSubmit: (e) => {
|
|
55831
55826
|
if (e.preventDefault(), !(!t.trim() && a.length === 0)) {
|
|
55832
|
-
if (
|
|
55827
|
+
if (M.length > 0) {
|
|
55833
55828
|
se.error("Please wait for uploads to finish!");
|
|
55834
55829
|
return;
|
|
55835
55830
|
}
|
|
55836
|
-
r === "ready" ?
|
|
55831
|
+
r === "ready" ? P() : se.error("Please wait for the model to finish its response!");
|
|
55837
55832
|
}
|
|
55838
55833
|
},
|
|
55839
55834
|
children: [
|
|
55840
|
-
(a.length > 0 ||
|
|
55835
|
+
(a.length > 0 || M.length > 0) && /* @__PURE__ */ V("div", {
|
|
55841
55836
|
className: "flex flex-row items-end gap-2 overflow-x-scroll",
|
|
55842
55837
|
"data-testid": "attachments-preview",
|
|
55843
55838
|
children: [a.map((e) => /* @__PURE__ */ B(vL, {
|
|
55844
55839
|
attachment: e,
|
|
55845
55840
|
onRemove: () => {
|
|
55846
|
-
o((t) => t.filter((t) => t.url !== e.url)),
|
|
55841
|
+
o((t) => t.filter((t) => t.url !== e.url)), j.current && (j.current.value = "");
|
|
55847
55842
|
}
|
|
55848
|
-
}, e.url)),
|
|
55843
|
+
}, e.url)), M.map((e) => /* @__PURE__ */ B(vL, {
|
|
55849
55844
|
attachment: {
|
|
55850
55845
|
url: "",
|
|
55851
55846
|
name: e,
|
|
@@ -55858,15 +55853,15 @@ function aV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
55858
55853
|
className: "flex flex-row items-start gap-1 sm:gap-2",
|
|
55859
55854
|
children: /* @__PURE__ */ B(QR, {
|
|
55860
55855
|
className: "grow rounded-md",
|
|
55861
|
-
ref:
|
|
55862
|
-
style: { height:
|
|
55856
|
+
ref: y,
|
|
55857
|
+
style: { height: b },
|
|
55863
55858
|
children: /* @__PURE__ */ B(WB, {
|
|
55864
55859
|
className: "min-h-10 w-full resize-none overflow-y-hidden border-0! border-none! bg-transparent p-2 text-base outline-none ring-0 placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-0 focus-visible:ring-offset-0",
|
|
55865
55860
|
"data-testid": "multimodal-input",
|
|
55866
55861
|
disableAutoResize: !0,
|
|
55867
|
-
onChange:
|
|
55862
|
+
onChange: A,
|
|
55868
55863
|
placeholder: "Send a message...",
|
|
55869
|
-
ref:
|
|
55864
|
+
ref: _,
|
|
55870
55865
|
rows: 1,
|
|
55871
55866
|
value: t
|
|
55872
55867
|
})
|
|
@@ -55878,12 +55873,12 @@ function aV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
55878
55873
|
className: "gap-0 sm:gap-0.5",
|
|
55879
55874
|
children: [
|
|
55880
55875
|
/* @__PURE__ */ B(cV, {
|
|
55881
|
-
fileInputRef:
|
|
55876
|
+
fileInputRef: j,
|
|
55882
55877
|
selectedModelId: f,
|
|
55883
55878
|
status: r
|
|
55884
55879
|
}),
|
|
55885
55880
|
/* @__PURE__ */ B(uV, {
|
|
55886
|
-
focusTargetRef:
|
|
55881
|
+
focusTargetRef: _,
|
|
55887
55882
|
idScope: e,
|
|
55888
55883
|
onModelChange: p,
|
|
55889
55884
|
selectedModelId: f
|
|
@@ -55902,7 +55897,7 @@ function aV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
55902
55897
|
}) : /* @__PURE__ */ B(qB, {
|
|
55903
55898
|
className: "size-8 rounded-full bg-primary text-primary-foreground transition-colors duration-200 hover:bg-primary/90 disabled:bg-muted disabled:text-muted-foreground",
|
|
55904
55899
|
"data-testid": "send-button",
|
|
55905
|
-
disabled: !t.trim() ||
|
|
55900
|
+
disabled: !t.trim() || M.length > 0,
|
|
55906
55901
|
status: r,
|
|
55907
55902
|
children: /* @__PURE__ */ B(yt, { size: 14 })
|
|
55908
55903
|
})]
|
|
@@ -55912,7 +55907,7 @@ function aV({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
55912
55907
|
]
|
|
55913
55908
|
});
|
|
55914
55909
|
}
|
|
55915
|
-
var oV = _(aV, (e, t) => !(e.input !== t.input || e.status !== t.status || !_e(e.attachments, t.attachments) || e.selectedModelId !== t.selectedModelId || e.openaiReasoningEffort !== t.openaiReasoningEffort));
|
|
55910
|
+
var oV = _(aV, (e, t) => !(e.input !== t.input || e.status !== t.status || !_e(e.attachments, t.attachments) || e.selectedModelId !== t.selectedModelId || e.openaiReasoningEffort !== t.openaiReasoningEffort || !_e(e.suggestedActions, t.suggestedActions)));
|
|
55916
55911
|
function sV({ fileInputRef: e, status: t, selectedModelId: n }) {
|
|
55917
55912
|
let r = n.includes("reasoning") || n.includes("think");
|
|
55918
55913
|
return /* @__PURE__ */ B(lf, {
|
|
@@ -56322,33 +56317,33 @@ var mV = _(pV), hV = ({ description: e, icon: t, selectedTool: n, setSelectedToo
|
|
|
56322
56317
|
AM,
|
|
56323
56318
|
XP
|
|
56324
56319
|
];
|
|
56325
|
-
function SV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, status: i, stop: a, attachments: o, setAttachments: s, sendMessage: c, messages: l, setMessages: u, regenerate: d, votes: f, isReadonly: p, selectedModelId: m }) {
|
|
56326
|
-
let { artifact:
|
|
56320
|
+
function SV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, status: i, stop: a, attachments: o, setAttachments: s, sendMessage: c, messages: l, setMessages: u, regenerate: d, votes: f, isReadonly: p, selectedModelId: m, suggestedActions: h }) {
|
|
56321
|
+
let { artifact: g, setArtifact: _, metadata: y, setMetadata: b } = Xy(), { data: S, isLoading: C, mutate: w } = gv(g.documentId !== "init" && g.status !== "streaming" ? `/api/rb/agents/document?id=${g.documentId}` : null, ef), [T, E] = k("edit"), [D, O] = k(null), [A, j] = k(-1);
|
|
56327
56322
|
x(() => {
|
|
56328
|
-
if (
|
|
56329
|
-
let e =
|
|
56330
|
-
e && (
|
|
56323
|
+
if (S && S.length > 0) {
|
|
56324
|
+
let e = S.at(-1);
|
|
56325
|
+
e && (O(e), j(S.length - 1), _((t) => ({
|
|
56331
56326
|
...t,
|
|
56332
56327
|
content: e.content ?? ""
|
|
56333
56328
|
})));
|
|
56334
56329
|
}
|
|
56335
|
-
}, [
|
|
56336
|
-
|
|
56337
|
-
}, [
|
|
56338
|
-
let { mutate:
|
|
56339
|
-
|
|
56330
|
+
}, [S, _]), x(() => {
|
|
56331
|
+
w();
|
|
56332
|
+
}, [w]);
|
|
56333
|
+
let { mutate: M } = $_(), [N, P] = k(!1), F = v((e) => {
|
|
56334
|
+
g && M(`/api/rb/agents/document?id=${g.documentId}`, async (t) => {
|
|
56340
56335
|
if (!t) return [];
|
|
56341
56336
|
let n = t.at(-1);
|
|
56342
|
-
if (!n || !n.content) return
|
|
56337
|
+
if (!n || !n.content) return P(!1), t;
|
|
56343
56338
|
if (n.content !== e) {
|
|
56344
|
-
await fetch(`/api/rb/agents/document?id=${
|
|
56339
|
+
await fetch(`/api/rb/agents/document?id=${g.documentId}`, {
|
|
56345
56340
|
method: "POST",
|
|
56346
56341
|
body: JSON.stringify({
|
|
56347
|
-
title:
|
|
56342
|
+
title: g.title,
|
|
56348
56343
|
content: e,
|
|
56349
|
-
kind:
|
|
56344
|
+
kind: g.kind
|
|
56350
56345
|
})
|
|
56351
|
-
}),
|
|
56346
|
+
}), P(!1);
|
|
56352
56347
|
let r = {
|
|
56353
56348
|
...n,
|
|
56354
56349
|
content: e,
|
|
@@ -56358,30 +56353,30 @@ function SV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
56358
56353
|
}
|
|
56359
56354
|
return t;
|
|
56360
56355
|
}, { revalidate: !1 });
|
|
56361
|
-
}, [
|
|
56362
|
-
|
|
56356
|
+
}, [g, M]), I = hM(F, 2e3), L = v((e, t) => {
|
|
56357
|
+
D && e !== D.content && (P(!0), t ? I(e) : F(e));
|
|
56363
56358
|
}, [
|
|
56364
|
-
|
|
56365
|
-
|
|
56366
|
-
|
|
56359
|
+
D,
|
|
56360
|
+
I,
|
|
56361
|
+
F
|
|
56367
56362
|
]);
|
|
56368
|
-
function
|
|
56369
|
-
return !
|
|
56363
|
+
function R(e) {
|
|
56364
|
+
return !S || !S[e] ? "" : S[e].content ?? "";
|
|
56370
56365
|
}
|
|
56371
|
-
let
|
|
56372
|
-
|
|
56373
|
-
}, [
|
|
56374
|
-
if (!
|
|
56366
|
+
let z = (e) => {
|
|
56367
|
+
S && (e === "latest" && (j(S.length - 1), E("edit")), e === "toggle" && E((e) => e === "edit" ? "diff" : "edit"), e === "prev" ? A > 0 && j((e) => e - 1) : e === "next" && A < S.length - 1 && j((e) => e + 1));
|
|
56368
|
+
}, [ee, te] = k(!1), ne = S && S.length > 0 ? A === S.length - 1 : !0, re = ym(), U = xV.find((e) => e.kind === g.kind);
|
|
56369
|
+
if (!U) throw Error("Artifact definition not found!");
|
|
56375
56370
|
return x(() => {
|
|
56376
|
-
|
|
56377
|
-
documentId:
|
|
56378
|
-
setMetadata:
|
|
56371
|
+
g.documentId !== "init" && U.initialize && U.initialize({
|
|
56372
|
+
documentId: g.documentId,
|
|
56373
|
+
setMetadata: b
|
|
56379
56374
|
});
|
|
56380
56375
|
}, [
|
|
56381
|
-
|
|
56382
|
-
|
|
56383
|
-
|
|
56384
|
-
]), /* @__PURE__ */ B(Pk, { children:
|
|
56376
|
+
g.documentId,
|
|
56377
|
+
U,
|
|
56378
|
+
b
|
|
56379
|
+
]), /* @__PURE__ */ B(Pk, { children: g.isVisible && /* @__PURE__ */ V(Dj.div, {
|
|
56385
56380
|
animate: { opacity: 1 },
|
|
56386
56381
|
className: "absolute inset-0 z-50 flex min-h-0 min-w-0 flex-row overflow-hidden bg-background",
|
|
56387
56382
|
"data-testid": "artifact",
|
|
@@ -56390,7 +56385,7 @@ function SV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
56390
56385
|
transition: { delay: .4 }
|
|
56391
56386
|
},
|
|
56392
56387
|
initial: { opacity: 1 },
|
|
56393
|
-
children: [!
|
|
56388
|
+
children: [!re && /* @__PURE__ */ V(Dj.div, {
|
|
56394
56389
|
animate: {
|
|
56395
56390
|
opacity: 1,
|
|
56396
56391
|
x: 0,
|
|
@@ -56414,7 +56409,7 @@ function SV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
56414
56409
|
x: 10,
|
|
56415
56410
|
scale: 1
|
|
56416
56411
|
},
|
|
56417
|
-
children: [/* @__PURE__ */ B(Pk, { children: !
|
|
56412
|
+
children: [/* @__PURE__ */ B(Pk, { children: !ne && /* @__PURE__ */ B(Dj.div, {
|
|
56418
56413
|
animate: { opacity: 1 },
|
|
56419
56414
|
className: "absolute inset-0 z-50 bg-background/70",
|
|
56420
56415
|
exit: { opacity: 0 },
|
|
@@ -56423,7 +56418,7 @@ function SV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
56423
56418
|
className: "flex h-full flex-col items-center justify-between",
|
|
56424
56419
|
children: [/* @__PURE__ */ B(LL, {
|
|
56425
56420
|
addToolApprovalResponse: e,
|
|
56426
|
-
artifactStatus:
|
|
56421
|
+
artifactStatus: g.status,
|
|
56427
56422
|
chatId: t,
|
|
56428
56423
|
isReadonly: p,
|
|
56429
56424
|
messages: l,
|
|
@@ -56445,7 +56440,8 @@ function SV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
56445
56440
|
setInput: r,
|
|
56446
56441
|
setMessages: u,
|
|
56447
56442
|
status: i,
|
|
56448
|
-
stop: a
|
|
56443
|
+
stop: a,
|
|
56444
|
+
suggestedActions: h
|
|
56449
56445
|
})
|
|
56450
56446
|
})]
|
|
56451
56447
|
})]
|
|
@@ -56474,7 +56470,7 @@ function SV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
56474
56470
|
damping: 30
|
|
56475
56471
|
}
|
|
56476
56472
|
},
|
|
56477
|
-
initial:
|
|
56473
|
+
initial: re ? {
|
|
56478
56474
|
opacity: 0,
|
|
56479
56475
|
x: 0,
|
|
56480
56476
|
y: 16,
|
|
@@ -56494,131 +56490,137 @@ function SV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
56494
56490
|
className: "flex flex-col",
|
|
56495
56491
|
children: [/* @__PURE__ */ B("div", {
|
|
56496
56492
|
className: "font-medium",
|
|
56497
|
-
children:
|
|
56498
|
-
}),
|
|
56493
|
+
children: g.title
|
|
56494
|
+
}), N ? /* @__PURE__ */ B("div", {
|
|
56499
56495
|
className: "text-muted-foreground text-sm",
|
|
56500
56496
|
children: "Saving changes..."
|
|
56501
|
-
}) :
|
|
56497
|
+
}) : D ? /* @__PURE__ */ B("div", {
|
|
56502
56498
|
className: "text-muted-foreground text-sm",
|
|
56503
|
-
children: `Updated ${H(new Date(
|
|
56499
|
+
children: `Updated ${H(new Date(D.createdAt), /* @__PURE__ */ new Date(), { addSuffix: !0 })}`
|
|
56504
56500
|
}) : /* @__PURE__ */ B("div", { className: "mt-2 h-3 w-32 animate-pulse rounded-md bg-muted-foreground/20" })]
|
|
56505
56501
|
})]
|
|
56506
56502
|
}), /* @__PURE__ */ B(qF, {
|
|
56507
|
-
artifact:
|
|
56508
|
-
currentVersionIndex:
|
|
56509
|
-
handleVersionChange:
|
|
56510
|
-
isCurrentVersion:
|
|
56511
|
-
metadata:
|
|
56512
|
-
mode:
|
|
56513
|
-
setMetadata:
|
|
56503
|
+
artifact: g,
|
|
56504
|
+
currentVersionIndex: A,
|
|
56505
|
+
handleVersionChange: z,
|
|
56506
|
+
isCurrentVersion: ne,
|
|
56507
|
+
metadata: y,
|
|
56508
|
+
mode: T,
|
|
56509
|
+
setMetadata: b
|
|
56514
56510
|
})]
|
|
56515
56511
|
}),
|
|
56516
56512
|
/* @__PURE__ */ V("div", {
|
|
56517
56513
|
className: "h-full max-w-full! items-center overflow-y-scroll bg-background dark:bg-muted",
|
|
56518
|
-
children: [/* @__PURE__ */ B(
|
|
56519
|
-
content:
|
|
56520
|
-
currentVersionIndex:
|
|
56521
|
-
getDocumentContentById:
|
|
56522
|
-
isCurrentVersion:
|
|
56514
|
+
children: [/* @__PURE__ */ B(U.content, {
|
|
56515
|
+
content: ne ? g.content : R(A),
|
|
56516
|
+
currentVersionIndex: A,
|
|
56517
|
+
getDocumentContentById: R,
|
|
56518
|
+
isCurrentVersion: ne,
|
|
56523
56519
|
isInline: !1,
|
|
56524
|
-
isLoading:
|
|
56525
|
-
metadata:
|
|
56526
|
-
mode:
|
|
56527
|
-
onSaveContent:
|
|
56528
|
-
setMetadata:
|
|
56529
|
-
status:
|
|
56520
|
+
isLoading: C && !g.content,
|
|
56521
|
+
metadata: y,
|
|
56522
|
+
mode: T,
|
|
56523
|
+
onSaveContent: L,
|
|
56524
|
+
setMetadata: b,
|
|
56525
|
+
status: g.status,
|
|
56530
56526
|
suggestions: [],
|
|
56531
|
-
title:
|
|
56532
|
-
}), /* @__PURE__ */ B(Pk, { children:
|
|
56533
|
-
artifactKind:
|
|
56534
|
-
isToolbarVisible:
|
|
56527
|
+
title: g.title
|
|
56528
|
+
}), /* @__PURE__ */ B(Pk, { children: ne && /* @__PURE__ */ B(yV, {
|
|
56529
|
+
artifactKind: g.kind,
|
|
56530
|
+
isToolbarVisible: ee,
|
|
56535
56531
|
sendMessage: c,
|
|
56536
|
-
setIsToolbarVisible:
|
|
56532
|
+
setIsToolbarVisible: te,
|
|
56537
56533
|
setMessages: u,
|
|
56538
56534
|
status: i,
|
|
56539
56535
|
stop: a
|
|
56540
56536
|
}) })]
|
|
56541
56537
|
}),
|
|
56542
|
-
/* @__PURE__ */ B(Pk, { children: !
|
|
56543
|
-
currentVersionIndex:
|
|
56544
|
-
documents:
|
|
56545
|
-
handleVersionChange:
|
|
56538
|
+
/* @__PURE__ */ B(Pk, { children: !ne && /* @__PURE__ */ B(bV, {
|
|
56539
|
+
currentVersionIndex: A,
|
|
56540
|
+
documents: S,
|
|
56541
|
+
handleVersionChange: z
|
|
56546
56542
|
}) })
|
|
56547
56543
|
]
|
|
56548
56544
|
})]
|
|
56549
56545
|
}) });
|
|
56550
56546
|
}
|
|
56551
|
-
var CV = _(SV, (e, t) => !(e.status !== t.status || !_e(e.votes, t.votes) || e.input !== t.input || !_e(e.messages, t.messages.length))), wV = (
|
|
56552
|
-
|
|
56553
|
-
|
|
56554
|
-
|
|
56555
|
-
|
|
56556
|
-
|
|
56557
|
-
|
|
56558
|
-
|
|
56559
|
-
|
|
56560
|
-
|
|
56561
|
-
|
|
56562
|
-
|
|
56563
|
-
|
|
56564
|
-
|
|
56565
|
-
|
|
56566
|
-
|
|
56567
|
-
|
|
56568
|
-
|
|
56569
|
-
|
|
56570
|
-
|
|
56571
|
-
|
|
56572
|
-
|
|
56573
|
-
|
|
56574
|
-
|
|
56575
|
-
|
|
56576
|
-
|
|
56577
|
-
|
|
56578
|
-
|
|
56579
|
-
|
|
56580
|
-
|
|
56581
|
-
|
|
56582
|
-
|
|
56583
|
-
|
|
56584
|
-
|
|
56585
|
-
|
|
56586
|
-
|
|
56547
|
+
var CV = _(SV, (e, t) => !(e.status !== t.status || !_e(e.votes, t.votes) || e.input !== t.input || !_e(e.messages, t.messages.length) || !_e(e.suggestedActions, t.suggestedActions))), wV = ({ title1: e, title2: t }) => {
|
|
56548
|
+
let n = e?.trim(), r = t?.trim();
|
|
56549
|
+
return !n && !r ? null : /* @__PURE__ */ V("div", {
|
|
56550
|
+
className: "mx-auto mt-4 flex size-full max-w-3xl flex-col justify-center px-4 md:mt-16 md:px-8",
|
|
56551
|
+
children: [n && /* @__PURE__ */ B(Dj.div, {
|
|
56552
|
+
animate: {
|
|
56553
|
+
opacity: 1,
|
|
56554
|
+
y: 0
|
|
56555
|
+
},
|
|
56556
|
+
className: "font-semibold text-xl md:text-2xl",
|
|
56557
|
+
exit: {
|
|
56558
|
+
opacity: 0,
|
|
56559
|
+
y: 10
|
|
56560
|
+
},
|
|
56561
|
+
initial: {
|
|
56562
|
+
opacity: 0,
|
|
56563
|
+
y: 10
|
|
56564
|
+
},
|
|
56565
|
+
transition: { delay: .5 },
|
|
56566
|
+
children: n
|
|
56567
|
+
}), r && /* @__PURE__ */ B(Dj.div, {
|
|
56568
|
+
animate: {
|
|
56569
|
+
opacity: 1,
|
|
56570
|
+
y: 0
|
|
56571
|
+
},
|
|
56572
|
+
className: "text-xl text-muted-foreground md:text-2xl",
|
|
56573
|
+
exit: {
|
|
56574
|
+
opacity: 0,
|
|
56575
|
+
y: 10
|
|
56576
|
+
},
|
|
56577
|
+
initial: {
|
|
56578
|
+
opacity: 0,
|
|
56579
|
+
y: 10
|
|
56580
|
+
},
|
|
56581
|
+
transition: { delay: .6 },
|
|
56582
|
+
children: r
|
|
56583
|
+
})]
|
|
56584
|
+
}, "overview");
|
|
56585
|
+
};
|
|
56587
56586
|
//#endregion
|
|
56588
56587
|
//#region src/components/messages.tsx
|
|
56589
|
-
function TV({ addToolApprovalResponse: e, chatId: t, status: n, votes: r, messages: i, setMessages: a, regenerate: o, isReadonly: s, selectedModelId: c }) {
|
|
56590
|
-
let
|
|
56588
|
+
function TV({ addToolApprovalResponse: e, chatId: t, status: n, votes: r, messages: i, setMessages: a, regenerate: o, isReadonly: s, selectedModelId: c, title1: l, title2: u }) {
|
|
56589
|
+
let d = i.at(-1), f = (e) => e === "dynamic-tool" || e.startsWith("tool-"), p = d?.role === "assistant" && (d.parts?.some((e) => e.type === "text" ? !!e.text?.trim() : e.type === "reasoning" ? kL(e) : !!f(e.type)) ?? !1), m = n === "submitted" || n === "streaming" && d?.role === "assistant" && !p, h = n === "streaming" && d?.role === "assistant" && !p, { containerRef: g, endRef: _, isAtBottom: v, scrollToBottom: y, hasSentMessage: b } = ZF({ status: n });
|
|
56591
56590
|
return mt(), /* @__PURE__ */ V("div", {
|
|
56592
56591
|
className: "relative flex-1",
|
|
56593
56592
|
children: [/* @__PURE__ */ B("div", {
|
|
56594
56593
|
className: "absolute inset-0 touch-pan-y overflow-y-auto",
|
|
56595
|
-
ref:
|
|
56594
|
+
ref: g,
|
|
56596
56595
|
children: /* @__PURE__ */ V("div", {
|
|
56597
56596
|
className: "mx-auto flex min-w-0 max-w-4xl flex-col gap-4 px-2 pt-[60px] pb-4 md:gap-6 md:px-4",
|
|
56598
56597
|
children: [
|
|
56599
|
-
i.length === 0 && /* @__PURE__ */ B(wV, {
|
|
56600
|
-
|
|
56598
|
+
i.length === 0 && /* @__PURE__ */ B(wV, {
|
|
56599
|
+
title1: l,
|
|
56600
|
+
title2: u
|
|
56601
|
+
}),
|
|
56602
|
+
i.map((c, l) => h && l === i.length - 1 && c.role === "assistant" ? null : /* @__PURE__ */ B(NL, {
|
|
56601
56603
|
addToolApprovalResponse: e,
|
|
56602
56604
|
chatId: t,
|
|
56603
56605
|
isLoading: n === "streaming" && i.length - 1 === l,
|
|
56604
56606
|
isReadonly: s,
|
|
56605
56607
|
message: c,
|
|
56606
56608
|
regenerate: o,
|
|
56607
|
-
requiresScrollPadding:
|
|
56609
|
+
requiresScrollPadding: b && l === i.length - 1,
|
|
56608
56610
|
setMessages: a,
|
|
56609
56611
|
vote: r ? r.find((e) => e.messageId === c.id) : void 0
|
|
56610
56612
|
}, c.id)),
|
|
56611
|
-
|
|
56613
|
+
m && /* @__PURE__ */ B(PL, {}),
|
|
56612
56614
|
/* @__PURE__ */ B("div", {
|
|
56613
56615
|
className: "min-h-[24px] min-w-[24px] shrink-0",
|
|
56614
|
-
ref:
|
|
56616
|
+
ref: _
|
|
56615
56617
|
})
|
|
56616
56618
|
]
|
|
56617
56619
|
})
|
|
56618
56620
|
}), /* @__PURE__ */ B("button", {
|
|
56619
56621
|
"aria-label": "Scroll to bottom",
|
|
56620
|
-
className: `-translate-x-1/2 absolute bottom-4 left-1/2 z-10 rounded-full border bg-background p-2 shadow-lg transition-all hover:bg-muted ${
|
|
56621
|
-
onClick: () =>
|
|
56622
|
+
className: `-translate-x-1/2 absolute bottom-4 left-1/2 z-10 rounded-full border bg-background p-2 shadow-lg transition-all hover:bg-muted ${v ? "pointer-events-none scale-0 opacity-0" : "pointer-events-auto scale-100 opacity-100"}`,
|
|
56623
|
+
onClick: () => y("smooth"),
|
|
56622
56624
|
type: "button",
|
|
56623
56625
|
children: /* @__PURE__ */ B(Pf, { className: "size-4" })
|
|
56624
56626
|
})]
|
|
@@ -56628,16 +56630,16 @@ var EV = TV, DV = (e) => e?.parts?.some((e) => {
|
|
|
56628
56630
|
let t = e.state;
|
|
56629
56631
|
return t === "approval-responded" || t === "output-denied";
|
|
56630
56632
|
}) ?? !1, OV = (e) => `agents-sdk:chat:${e}:stream`, kV = (e) => !!(e && typeof e == "object" && !Array.isArray(e)), AV = (e) => a(e) ?? "default";
|
|
56631
|
-
function jV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, autoResume: s }) {
|
|
56632
|
-
let { setDataStream:
|
|
56633
|
+
function jV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, autoResume: s, suggestedActions: c, title1: l, title2: u }) {
|
|
56634
|
+
let { setDataStream: d } = mt(), { getChatPath: f } = lt(), p = t.has(a) ? a : r, m = AV(p), [h, g] = k(""), [_, v] = k(p), y = O(_), [b, S] = k(m), C = O(b);
|
|
56633
56635
|
x(() => {
|
|
56634
|
-
g.current = m;
|
|
56635
|
-
}, [m]), x(() => {
|
|
56636
|
-
h(u), v(AV(u));
|
|
56637
|
-
}, [e, u]), x(() => {
|
|
56638
56636
|
y.current = _;
|
|
56639
|
-
}, [_])
|
|
56640
|
-
|
|
56637
|
+
}, [_]), x(() => {
|
|
56638
|
+
v(p), S(AV(p));
|
|
56639
|
+
}, [e, p]), x(() => {
|
|
56640
|
+
C.current = b;
|
|
56641
|
+
}, [b]);
|
|
56642
|
+
let { messages: w, setMessages: T, sendMessage: E, status: D, stop: A, regenerate: j, resumeStream: M, addToolApprovalResponse: N } = qy({
|
|
56641
56643
|
id: e,
|
|
56642
56644
|
messages: n,
|
|
56643
56645
|
experimental_throttle: 100,
|
|
@@ -56647,7 +56649,7 @@ function jV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, aut
|
|
|
56647
56649
|
api: "/api/rb/agents/chat",
|
|
56648
56650
|
fetch: tf,
|
|
56649
56651
|
prepareSendMessagesRequest(e) {
|
|
56650
|
-
let t =
|
|
56652
|
+
let t = y.current, n = C.current, r = e.messages.at(-1), a = e.messages.at(-2), o = Zd(e.headers, Yd()), s = r?.role !== "user" || r?.role === "user" && DV(a);
|
|
56651
56653
|
return {
|
|
56652
56654
|
...o ? { headers: o } : {},
|
|
56653
56655
|
body: {
|
|
@@ -56668,7 +56670,7 @@ function jV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, aut
|
|
|
56668
56670
|
}
|
|
56669
56671
|
}),
|
|
56670
56672
|
onData: (e) => {
|
|
56671
|
-
|
|
56673
|
+
d((t) => t ? [...t, e] : []);
|
|
56672
56674
|
},
|
|
56673
56675
|
onError: (e) => {
|
|
56674
56676
|
if (e instanceof Vd) {
|
|
@@ -56681,7 +56683,7 @@ function jV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, aut
|
|
|
56681
56683
|
}
|
|
56682
56684
|
se.error("Something went wrong. Please try again.");
|
|
56683
56685
|
}
|
|
56684
|
-
}),
|
|
56686
|
+
}), P = O(null), F = O("");
|
|
56685
56687
|
x(() => ce(OV(e), (t) => {
|
|
56686
56688
|
if (!kV(t) || t.chatId !== e) return;
|
|
56687
56689
|
let n = t.message;
|
|
@@ -56694,28 +56696,28 @@ function jV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, aut
|
|
|
56694
56696
|
parts: r,
|
|
56695
56697
|
metadata: kV(n.metadata) ? n.metadata : { createdAt: (/* @__PURE__ */ new Date()).toISOString() }
|
|
56696
56698
|
};
|
|
56697
|
-
|
|
56699
|
+
T((t) => {
|
|
56698
56700
|
let n = t.findIndex((t) => t.id === e);
|
|
56699
56701
|
return n === -1 ? [...t, i] : t.map((e, t) => t === n ? i : e);
|
|
56700
56702
|
});
|
|
56701
56703
|
}
|
|
56702
56704
|
}
|
|
56703
56705
|
if (t.done === !0) {
|
|
56704
|
-
|
|
56706
|
+
P.current = null, F.current = "";
|
|
56705
56707
|
return;
|
|
56706
56708
|
}
|
|
56707
56709
|
let r = t.part;
|
|
56708
56710
|
if (!kV(r)) return;
|
|
56709
56711
|
if (r.type === "start" && typeof r.messageId == "string") {
|
|
56710
|
-
|
|
56712
|
+
P.current = r.messageId, F.current = "";
|
|
56711
56713
|
return;
|
|
56712
56714
|
}
|
|
56713
|
-
if (typeof r.type == "string" && r.type.startsWith("data-") &&
|
|
56714
|
-
let i =
|
|
56715
|
+
if (typeof r.type == "string" && r.type.startsWith("data-") && d((e) => e ? [...e, r] : []), r.type !== "text-delta" || typeof r.delta != "string") return;
|
|
56716
|
+
let i = P.current;
|
|
56715
56717
|
if (!i) return;
|
|
56716
|
-
|
|
56717
|
-
let a =
|
|
56718
|
-
|
|
56718
|
+
F.current += r.delta;
|
|
56719
|
+
let a = F.current;
|
|
56720
|
+
T((e) => {
|
|
56719
56721
|
let t = e.findIndex((e) => e.id === i), n = {
|
|
56720
56722
|
id: i,
|
|
56721
56723
|
role: "assistant",
|
|
@@ -56729,89 +56731,93 @@ function jV({ id: e, initialMessages: n, initialChatModel: a, isReadonly: o, aut
|
|
|
56729
56731
|
});
|
|
56730
56732
|
}), [
|
|
56731
56733
|
e,
|
|
56732
|
-
|
|
56733
|
-
|
|
56734
|
+
d,
|
|
56735
|
+
T
|
|
56734
56736
|
]);
|
|
56735
|
-
let [
|
|
56737
|
+
let [I] = R(), L = I.get("query"), [z, ee] = k(!1);
|
|
56736
56738
|
x(() => {
|
|
56737
|
-
if (
|
|
56738
|
-
|
|
56739
|
+
if (L && !z) {
|
|
56740
|
+
E({
|
|
56739
56741
|
role: "user",
|
|
56740
56742
|
parts: [{
|
|
56741
56743
|
type: "text",
|
|
56742
|
-
text:
|
|
56744
|
+
text: L
|
|
56743
56745
|
}]
|
|
56744
|
-
}),
|
|
56746
|
+
}), ee(!0);
|
|
56745
56747
|
let t = new URLSearchParams(window.location.search);
|
|
56746
56748
|
t.delete("query");
|
|
56747
56749
|
let n = t.toString();
|
|
56748
|
-
window.history.replaceState({}, "", `${
|
|
56750
|
+
window.history.replaceState({}, "", `${f(e)}${n ? `?${n}` : ""}`);
|
|
56749
56751
|
}
|
|
56750
56752
|
}, [
|
|
56751
|
-
|
|
56752
|
-
|
|
56753
|
-
|
|
56753
|
+
L,
|
|
56754
|
+
E,
|
|
56755
|
+
z,
|
|
56754
56756
|
e,
|
|
56755
|
-
|
|
56757
|
+
f
|
|
56756
56758
|
]);
|
|
56757
|
-
let { data:
|
|
56759
|
+
let { data: H } = gv(w.length >= 2 ? `/api/rb/agents/vote?chatId=${e}` : null, ef), [te, ne] = k([]), re = Yy((e) => e.isVisible);
|
|
56758
56760
|
return Zy({
|
|
56759
56761
|
autoResume: s,
|
|
56760
56762
|
initialMessages: n,
|
|
56761
|
-
resumeStream:
|
|
56762
|
-
setMessages:
|
|
56763
|
+
resumeStream: M,
|
|
56764
|
+
setMessages: T
|
|
56763
56765
|
}), /* @__PURE__ */ V("div", {
|
|
56764
56766
|
className: "relative flex h-full min-h-0 min-w-0 overflow-hidden bg-background",
|
|
56765
56767
|
children: [/* @__PURE__ */ V("div", {
|
|
56766
56768
|
className: "overscroll-behavior-contain flex h-full min-h-0 min-w-0 flex-1 touch-pan-y flex-col bg-background",
|
|
56767
56769
|
children: [/* @__PURE__ */ B(EV, {
|
|
56768
|
-
addToolApprovalResponse:
|
|
56770
|
+
addToolApprovalResponse: N,
|
|
56769
56771
|
chatId: e,
|
|
56770
|
-
isArtifactVisible:
|
|
56772
|
+
isArtifactVisible: re,
|
|
56771
56773
|
isReadonly: o,
|
|
56772
|
-
messages:
|
|
56773
|
-
regenerate:
|
|
56774
|
-
selectedModelId:
|
|
56775
|
-
setMessages:
|
|
56776
|
-
status:
|
|
56777
|
-
|
|
56774
|
+
messages: w,
|
|
56775
|
+
regenerate: j,
|
|
56776
|
+
selectedModelId: p,
|
|
56777
|
+
setMessages: T,
|
|
56778
|
+
status: D,
|
|
56779
|
+
title1: l,
|
|
56780
|
+
title2: u,
|
|
56781
|
+
votes: H
|
|
56778
56782
|
}), /* @__PURE__ */ B("div", {
|
|
56779
56783
|
className: "sticky bottom-0 z-1 mx-auto flex w-full max-w-4xl gap-2 border-t-0 bg-background px-2 pb-3 md:px-4 md:pb-4",
|
|
56780
56784
|
children: !o && /* @__PURE__ */ B(oV, {
|
|
56781
|
-
attachments:
|
|
56785
|
+
attachments: te,
|
|
56782
56786
|
chatId: e,
|
|
56783
|
-
input:
|
|
56784
|
-
messages:
|
|
56787
|
+
input: h,
|
|
56788
|
+
messages: w,
|
|
56785
56789
|
onModelChange: (e) => {
|
|
56786
|
-
|
|
56790
|
+
v(e), S(AV(e));
|
|
56787
56791
|
},
|
|
56788
|
-
onOpenAIReasoningEffortChange:
|
|
56789
|
-
openaiReasoningEffort:
|
|
56790
|
-
selectedModelId:
|
|
56791
|
-
sendMessage:
|
|
56792
|
-
setAttachments:
|
|
56793
|
-
setInput:
|
|
56794
|
-
setMessages:
|
|
56795
|
-
status:
|
|
56796
|
-
stop:
|
|
56792
|
+
onOpenAIReasoningEffortChange: S,
|
|
56793
|
+
openaiReasoningEffort: b,
|
|
56794
|
+
selectedModelId: _,
|
|
56795
|
+
sendMessage: E,
|
|
56796
|
+
setAttachments: ne,
|
|
56797
|
+
setInput: g,
|
|
56798
|
+
setMessages: T,
|
|
56799
|
+
status: D,
|
|
56800
|
+
stop: A,
|
|
56801
|
+
suggestedActions: c
|
|
56797
56802
|
})
|
|
56798
56803
|
})]
|
|
56799
56804
|
}), /* @__PURE__ */ B(CV, {
|
|
56800
|
-
addToolApprovalResponse:
|
|
56801
|
-
attachments:
|
|
56805
|
+
addToolApprovalResponse: N,
|
|
56806
|
+
attachments: te,
|
|
56802
56807
|
chatId: e,
|
|
56803
|
-
input:
|
|
56808
|
+
input: h,
|
|
56804
56809
|
isReadonly: o,
|
|
56805
|
-
messages:
|
|
56806
|
-
regenerate:
|
|
56807
|
-
selectedModelId:
|
|
56808
|
-
sendMessage:
|
|
56809
|
-
setAttachments:
|
|
56810
|
-
setInput:
|
|
56811
|
-
setMessages:
|
|
56812
|
-
status:
|
|
56813
|
-
stop:
|
|
56814
|
-
|
|
56810
|
+
messages: w,
|
|
56811
|
+
regenerate: j,
|
|
56812
|
+
selectedModelId: _,
|
|
56813
|
+
sendMessage: E,
|
|
56814
|
+
setAttachments: ne,
|
|
56815
|
+
setInput: g,
|
|
56816
|
+
setMessages: T,
|
|
56817
|
+
status: D,
|
|
56818
|
+
stop: A,
|
|
56819
|
+
suggestedActions: c,
|
|
56820
|
+
votes: H
|
|
56815
56821
|
})]
|
|
56816
56822
|
});
|
|
56817
56823
|
}
|