@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
|
@@ -52927,7 +52927,7 @@ var kL = S(DL, OL), AL = Kf, jL = md, ML = p.forwardRef(({ className: e, ...t },
|
|
|
52927
52927
|
let { resolvedTheme: r, theme: i } = sf();
|
|
52928
52928
|
return /* @__PURE__ */ H(zu, {
|
|
52929
52929
|
ref: n,
|
|
52930
|
-
className: G("agents-sdk fixed inset-0 z-50 bg-foreground/50 opacity-
|
|
52930
|
+
className: G("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),
|
|
52931
52931
|
"data-agents-sdk-resolved-theme": r,
|
|
52932
52932
|
"data-agents-sdk-theme": i,
|
|
52933
52933
|
...t
|
|
@@ -52948,15 +52948,15 @@ var PL = p.forwardRef(({ asChild: e = !1, children: t, ...n }, r) => /* @__PURE_
|
|
|
52948
52948
|
children: t
|
|
52949
52949
|
}));
|
|
52950
52950
|
PL.displayName = "DialogClose";
|
|
52951
|
-
var FL = p.forwardRef(({
|
|
52952
|
-
let { resolvedTheme:
|
|
52953
|
-
return /* @__PURE__ */ U(jL, { children: [/* @__PURE__ */ H(ML, {
|
|
52954
|
-
ref:
|
|
52955
|
-
className: G("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:
|
|
52956
|
-
"data-agents-sdk-resolved-theme":
|
|
52957
|
-
"data-agents-sdk-theme":
|
|
52958
|
-
...
|
|
52959
|
-
children: [
|
|
52951
|
+
var FL = p.forwardRef(({ className: e, children: t, ...n }, r) => {
|
|
52952
|
+
let { resolvedTheme: i, theme: a } = sf();
|
|
52953
|
+
return /* @__PURE__ */ U(jL, { children: [/* @__PURE__ */ H(ML, {}), /* @__PURE__ */ U(dd, {
|
|
52954
|
+
ref: r,
|
|
52955
|
+
className: G("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),
|
|
52956
|
+
"data-agents-sdk-resolved-theme": i,
|
|
52957
|
+
"data-agents-sdk-theme": a,
|
|
52958
|
+
...n,
|
|
52959
|
+
children: [t, /* @__PURE__ */ U(Ju, {
|
|
52960
52960
|
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",
|
|
52961
52961
|
children: [/* @__PURE__ */ H(Hf, { className: "h-4 w-4" }), /* @__PURE__ */ H("span", {
|
|
52962
52962
|
className: "sr-only",
|
|
@@ -53217,7 +53217,6 @@ QL.displayName = "CommandShortcut";
|
|
|
53217
53217
|
//#endregion
|
|
53218
53218
|
//#region src/components/ai-elements/model-selector.tsx
|
|
53219
53219
|
var $L = (e) => /* @__PURE__ */ H(AL, { ...e }), eR = (e) => /* @__PURE__ */ H(NL, { ...e }), tR = ({ className: e, children: t, title: n = "Model Selector", ...r }) => /* @__PURE__ */ U(FL, {
|
|
53220
|
-
backdropClassName: "!bg-transparent",
|
|
53221
53220
|
className: G("p-0", e),
|
|
53222
53221
|
...r,
|
|
53223
53222
|
children: [/* @__PURE__ */ H(RL, {
|
|
@@ -55564,17 +55563,12 @@ var FB = ({ className: e, ...t }) => /* @__PURE__ */ H("form", {
|
|
|
55564
55563
|
});
|
|
55565
55564
|
//#endregion
|
|
55566
55565
|
//#region src/components/suggested-actions.tsx
|
|
55567
|
-
function VB({ chatId: e, sendMessage: t }) {
|
|
55568
|
-
let { getChatPath:
|
|
55569
|
-
|
|
55570
|
-
"Write code to demonstrate Dijkstra's algorithm",
|
|
55571
|
-
"Help me write an essay about Silicon Valley",
|
|
55572
|
-
"What is the weather in San Francisco?"
|
|
55573
|
-
];
|
|
55574
|
-
return /* @__PURE__ */ H("div", {
|
|
55566
|
+
function VB({ chatId: e, sendMessage: t, suggestedActions: n }) {
|
|
55567
|
+
let { getChatPath: r } = et(), i = n.map((e) => e.trim()).filter(Boolean);
|
|
55568
|
+
return i.length === 0 ? null : /* @__PURE__ */ H("div", {
|
|
55575
55569
|
className: "grid w-full gap-2 sm:grid-cols-2",
|
|
55576
55570
|
"data-testid": "suggested-actions",
|
|
55577
|
-
children:
|
|
55571
|
+
children: i.map((n, i) => /* @__PURE__ */ H(yj.div, {
|
|
55578
55572
|
animate: {
|
|
55579
55573
|
opacity: 1,
|
|
55580
55574
|
y: 0
|
|
@@ -55590,22 +55584,22 @@ function VB({ chatId: e, sendMessage: t }) {
|
|
|
55590
55584
|
transition: { delay: .05 * i },
|
|
55591
55585
|
children: /* @__PURE__ */ H(BB, {
|
|
55592
55586
|
className: "h-auto w-full whitespace-normal p-3 text-left",
|
|
55593
|
-
onClick: (
|
|
55594
|
-
window.history.pushState({}, "",
|
|
55587
|
+
onClick: (n) => {
|
|
55588
|
+
window.history.pushState({}, "", r(e)), t({
|
|
55595
55589
|
role: "user",
|
|
55596
55590
|
parts: [{
|
|
55597
55591
|
type: "text",
|
|
55598
|
-
text:
|
|
55592
|
+
text: n
|
|
55599
55593
|
}]
|
|
55600
55594
|
});
|
|
55601
55595
|
},
|
|
55602
|
-
suggestion:
|
|
55603
|
-
children:
|
|
55596
|
+
suggestion: n,
|
|
55597
|
+
children: n
|
|
55604
55598
|
})
|
|
55605
|
-
},
|
|
55599
|
+
}, `${i}-${n}`))
|
|
55606
55600
|
});
|
|
55607
55601
|
}
|
|
55608
|
-
var HB = S(VB, (e, t) => e.chatId
|
|
55602
|
+
var HB = S(VB, (e, t) => !(e.chatId !== t.chatId || !xe(e.suggestedActions, t.suggestedActions)));
|
|
55609
55603
|
//#endregion
|
|
55610
55604
|
//#region src/components/multimodal-input.tsx
|
|
55611
55605
|
function UB(e, t) {
|
|
@@ -55644,37 +55638,37 @@ function XB(e, t) {
|
|
|
55644
55638
|
let r = qB(t.scrollArea);
|
|
55645
55639
|
r && (r.scrollTop = 0);
|
|
55646
55640
|
}
|
|
55647
|
-
function ZB({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments: a, setAttachments: o, messages: s, setMessages: c, sendMessage: l, className: u, selectedModelId: d, onModelChange: p, openaiReasoningEffort: m = f, onOpenAIReasoningEffortChange: h }) {
|
|
55648
|
-
let
|
|
55641
|
+
function ZB({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments: a, setAttachments: o, messages: s, setMessages: c, sendMessage: l, className: u, selectedModelId: d, onModelChange: p, openaiReasoningEffort: m = f, onOpenAIReasoningEffortChange: h, suggestedActions: g }) {
|
|
55642
|
+
let _ = N(null), v = N(null), [y, b] = P(GB), { width: x } = uM(), { getChatPath: S } = et();
|
|
55649
55643
|
E(() => {
|
|
55650
|
-
YB(
|
|
55651
|
-
scrollArea:
|
|
55652
|
-
setScrollAreaHeight:
|
|
55644
|
+
YB(_.current, {
|
|
55645
|
+
scrollArea: v.current,
|
|
55646
|
+
setScrollAreaHeight: b
|
|
55653
55647
|
});
|
|
55654
|
-
}, [t,
|
|
55655
|
-
let
|
|
55648
|
+
}, [t, x]);
|
|
55649
|
+
let w = N(!1);
|
|
55656
55650
|
E(() => {
|
|
55657
|
-
if (!
|
|
55651
|
+
if (!w.current && x) {
|
|
55658
55652
|
let e = setTimeout(() => {
|
|
55659
|
-
|
|
55653
|
+
_.current?.focus(), w.current = !0;
|
|
55660
55654
|
}, 100);
|
|
55661
55655
|
return () => clearTimeout(e);
|
|
55662
55656
|
}
|
|
55663
|
-
}, [
|
|
55664
|
-
let [
|
|
55657
|
+
}, [x]);
|
|
55658
|
+
let [T, D] = aM("input", "");
|
|
55665
55659
|
E(() => {
|
|
55666
|
-
|
|
55667
|
-
}, [
|
|
55668
|
-
|
|
55669
|
-
}, [t,
|
|
55670
|
-
let
|
|
55660
|
+
_.current && n(_.current.value || T || "");
|
|
55661
|
+
}, [T, n]), E(() => {
|
|
55662
|
+
D(t);
|
|
55663
|
+
}, [t, D]);
|
|
55664
|
+
let O = (e) => {
|
|
55671
55665
|
n(e.target.value), YB(e.currentTarget, {
|
|
55672
|
-
scrollArea:
|
|
55673
|
-
setScrollAreaHeight:
|
|
55666
|
+
scrollArea: v.current,
|
|
55667
|
+
setScrollAreaHeight: b
|
|
55674
55668
|
});
|
|
55675
|
-
},
|
|
55669
|
+
}, k = N(null), [A, j] = P([]), M = C(() => {
|
|
55676
55670
|
let r = Vd();
|
|
55677
|
-
window.history.pushState({}, "", Gd(
|
|
55671
|
+
window.history.pushState({}, "", Gd(S(e), r)), l({
|
|
55678
55672
|
role: "user",
|
|
55679
55673
|
parts: [...a.map((e) => ({
|
|
55680
55674
|
type: "file",
|
|
@@ -55685,21 +55679,21 @@ function ZB({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
55685
55679
|
type: "text",
|
|
55686
55680
|
text: t
|
|
55687
55681
|
}]
|
|
55688
|
-
}), o([]),
|
|
55689
|
-
scrollArea:
|
|
55690
|
-
setScrollAreaHeight:
|
|
55691
|
-
}),
|
|
55682
|
+
}), o([]), D(""), n(""), XB(_.current, {
|
|
55683
|
+
scrollArea: v.current,
|
|
55684
|
+
setScrollAreaHeight: b
|
|
55685
|
+
}), x && x > 768 && _.current?.focus();
|
|
55692
55686
|
}, [
|
|
55693
55687
|
t,
|
|
55694
55688
|
n,
|
|
55695
55689
|
a,
|
|
55696
55690
|
l,
|
|
55697
55691
|
o,
|
|
55698
|
-
|
|
55699
|
-
|
|
55692
|
+
D,
|
|
55693
|
+
x,
|
|
55700
55694
|
e,
|
|
55701
|
-
|
|
55702
|
-
]),
|
|
55695
|
+
S
|
|
55696
|
+
]), F = C(async (e) => {
|
|
55703
55697
|
try {
|
|
55704
55698
|
let t = Vd(), n = await fetch("/api/rb/file-uploads", {
|
|
55705
55699
|
method: "POST",
|
|
@@ -55760,48 +55754,49 @@ function ZB({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
55760
55754
|
} catch {
|
|
55761
55755
|
de.error("Failed to upload file, please try again!");
|
|
55762
55756
|
}
|
|
55763
|
-
}, []),
|
|
55757
|
+
}, []), I = C(async (e) => {
|
|
55764
55758
|
let t = Array.from(e.target.files || []);
|
|
55765
|
-
|
|
55759
|
+
j(t.map((e) => e.name));
|
|
55766
55760
|
try {
|
|
55767
|
-
let e = t.map((e) =>
|
|
55761
|
+
let e = t.map((e) => F(e)), n = (await Promise.all(e)).filter((e) => e !== void 0);
|
|
55768
55762
|
o((e) => [...e, ...n]);
|
|
55769
55763
|
} catch (e) {
|
|
55770
55764
|
console.error("Error uploading files!", e);
|
|
55771
55765
|
} finally {
|
|
55772
|
-
|
|
55766
|
+
j([]);
|
|
55773
55767
|
}
|
|
55774
|
-
}, [o,
|
|
55768
|
+
}, [o, F]), L = C(async (e) => {
|
|
55775
55769
|
let t = e.clipboardData?.items;
|
|
55776
55770
|
if (!t) return;
|
|
55777
55771
|
let n = Array.from(t).filter((e) => e.type.startsWith("image/"));
|
|
55778
55772
|
if (n.length !== 0) {
|
|
55779
|
-
e.preventDefault(),
|
|
55773
|
+
e.preventDefault(), j((e) => [...e, "Pasted image"]);
|
|
55780
55774
|
try {
|
|
55781
|
-
let e = n.map((e) => e.getAsFile()).filter((e) => e !== null).map((e) =>
|
|
55775
|
+
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);
|
|
55782
55776
|
o((e) => [...e, ...t]);
|
|
55783
55777
|
} catch (e) {
|
|
55784
55778
|
console.error("Error uploading pasted images:", e), de.error("Failed to upload pasted image(s)");
|
|
55785
55779
|
} finally {
|
|
55786
|
-
|
|
55780
|
+
j([]);
|
|
55787
55781
|
}
|
|
55788
55782
|
}
|
|
55789
|
-
}, [o,
|
|
55783
|
+
}, [o, F]);
|
|
55790
55784
|
return E(() => {
|
|
55791
|
-
let e =
|
|
55792
|
-
if (e) return e.addEventListener("paste",
|
|
55793
|
-
}, [
|
|
55785
|
+
let e = _.current;
|
|
55786
|
+
if (e) return e.addEventListener("paste", L), () => e.removeEventListener("paste", L);
|
|
55787
|
+
}, [L]), /* @__PURE__ */ U("div", {
|
|
55794
55788
|
className: G("relative flex w-full flex-col gap-4", u),
|
|
55795
55789
|
children: [
|
|
55796
|
-
s.length === 0 && a.length === 0 &&
|
|
55790
|
+
s.length === 0 && a.length === 0 && A.length === 0 && g && g.length > 0 && /* @__PURE__ */ H(HB, {
|
|
55797
55791
|
chatId: e,
|
|
55798
|
-
sendMessage: l
|
|
55792
|
+
sendMessage: l,
|
|
55793
|
+
suggestedActions: g
|
|
55799
55794
|
}),
|
|
55800
55795
|
/* @__PURE__ */ H("input", {
|
|
55801
55796
|
className: "-top-4 -left-4 pointer-events-none fixed size-0.5 opacity-0",
|
|
55802
55797
|
multiple: !0,
|
|
55803
|
-
onChange:
|
|
55804
|
-
ref:
|
|
55798
|
+
onChange: I,
|
|
55799
|
+
ref: k,
|
|
55805
55800
|
tabIndex: -1,
|
|
55806
55801
|
type: "file"
|
|
55807
55802
|
}),
|
|
@@ -55809,23 +55804,23 @@ function ZB({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
55809
55804
|
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",
|
|
55810
55805
|
onSubmit: (e) => {
|
|
55811
55806
|
if (e.preventDefault(), !(!t.trim() && a.length === 0)) {
|
|
55812
|
-
if (
|
|
55807
|
+
if (A.length > 0) {
|
|
55813
55808
|
de.error("Please wait for uploads to finish!");
|
|
55814
55809
|
return;
|
|
55815
55810
|
}
|
|
55816
|
-
r === "ready" ?
|
|
55811
|
+
r === "ready" ? M() : de.error("Please wait for the model to finish its response!");
|
|
55817
55812
|
}
|
|
55818
55813
|
},
|
|
55819
55814
|
children: [
|
|
55820
|
-
(a.length > 0 ||
|
|
55815
|
+
(a.length > 0 || A.length > 0) && /* @__PURE__ */ U("div", {
|
|
55821
55816
|
className: "flex flex-row items-end gap-2 overflow-x-scroll",
|
|
55822
55817
|
"data-testid": "attachments-preview",
|
|
55823
55818
|
children: [a.map((e) => /* @__PURE__ */ H(uL, {
|
|
55824
55819
|
attachment: e,
|
|
55825
55820
|
onRemove: () => {
|
|
55826
|
-
o((t) => t.filter((t) => t.url !== e.url)),
|
|
55821
|
+
o((t) => t.filter((t) => t.url !== e.url)), k.current && (k.current.value = "");
|
|
55827
55822
|
}
|
|
55828
|
-
}, e.url)),
|
|
55823
|
+
}, e.url)), A.map((e) => /* @__PURE__ */ H(uL, {
|
|
55829
55824
|
attachment: {
|
|
55830
55825
|
url: "",
|
|
55831
55826
|
name: e,
|
|
@@ -55838,15 +55833,15 @@ function ZB({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
55838
55833
|
className: "flex flex-row items-start gap-1 sm:gap-2",
|
|
55839
55834
|
children: /* @__PURE__ */ H(WR, {
|
|
55840
55835
|
className: "grow rounded-md",
|
|
55841
|
-
ref:
|
|
55842
|
-
style: { height:
|
|
55836
|
+
ref: v,
|
|
55837
|
+
style: { height: y },
|
|
55843
55838
|
children: /* @__PURE__ */ H(IB, {
|
|
55844
55839
|
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",
|
|
55845
55840
|
"data-testid": "multimodal-input",
|
|
55846
55841
|
disableAutoResize: !0,
|
|
55847
|
-
onChange:
|
|
55842
|
+
onChange: O,
|
|
55848
55843
|
placeholder: "Send a message...",
|
|
55849
|
-
ref:
|
|
55844
|
+
ref: _,
|
|
55850
55845
|
rows: 1,
|
|
55851
55846
|
value: t
|
|
55852
55847
|
})
|
|
@@ -55858,12 +55853,12 @@ function ZB({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
55858
55853
|
className: "gap-0 sm:gap-0.5",
|
|
55859
55854
|
children: [
|
|
55860
55855
|
/* @__PURE__ */ H(eV, {
|
|
55861
|
-
fileInputRef:
|
|
55856
|
+
fileInputRef: k,
|
|
55862
55857
|
selectedModelId: d,
|
|
55863
55858
|
status: r
|
|
55864
55859
|
}),
|
|
55865
55860
|
/* @__PURE__ */ H(nV, {
|
|
55866
|
-
focusTargetRef:
|
|
55861
|
+
focusTargetRef: _,
|
|
55867
55862
|
idScope: e,
|
|
55868
55863
|
onModelChange: p,
|
|
55869
55864
|
selectedModelId: d
|
|
@@ -55882,7 +55877,7 @@ function ZB({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
55882
55877
|
}) : /* @__PURE__ */ H(zB, {
|
|
55883
55878
|
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",
|
|
55884
55879
|
"data-testid": "send-button",
|
|
55885
|
-
disabled: !t.trim() ||
|
|
55880
|
+
disabled: !t.trim() || A.length > 0,
|
|
55886
55881
|
status: r,
|
|
55887
55882
|
children: /* @__PURE__ */ H(K, { size: 14 })
|
|
55888
55883
|
})]
|
|
@@ -55892,7 +55887,7 @@ function ZB({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
55892
55887
|
]
|
|
55893
55888
|
});
|
|
55894
55889
|
}
|
|
55895
|
-
var QB = S(ZB, (e, t) => !(e.input !== t.input || e.status !== t.status || !xe(e.attachments, t.attachments) || e.selectedModelId !== t.selectedModelId || e.openaiReasoningEffort !== t.openaiReasoningEffort));
|
|
55890
|
+
var QB = S(ZB, (e, t) => !(e.input !== t.input || e.status !== t.status || !xe(e.attachments, t.attachments) || e.selectedModelId !== t.selectedModelId || e.openaiReasoningEffort !== t.openaiReasoningEffort || !xe(e.suggestedActions, t.suggestedActions)));
|
|
55896
55891
|
function $B({ fileInputRef: e, status: t, selectedModelId: n }) {
|
|
55897
55892
|
let r = n.includes("reasoning") || n.includes("think");
|
|
55898
55893
|
return /* @__PURE__ */ H(ef, {
|
|
@@ -56302,33 +56297,33 @@ var oV = S(aV), sV = ({ description: e, icon: t, selectedTool: n, setSelectedToo
|
|
|
56302
56297
|
SM,
|
|
56303
56298
|
HP
|
|
56304
56299
|
];
|
|
56305
|
-
function mV({ 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 }) {
|
|
56306
|
-
let { artifact:
|
|
56300
|
+
function mV({ 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 }) {
|
|
56301
|
+
let { artifact: g, setArtifact: _, metadata: v, setMetadata: y } = Hy(), { data: b, isLoading: x, mutate: S } = cv(g.documentId !== "init" && g.status !== "streaming" ? `/api/rb/agents/document?id=${g.documentId}` : null, Kd), [w, T] = P("edit"), [D, O] = P(null), [k, A] = P(-1);
|
|
56307
56302
|
E(() => {
|
|
56308
|
-
if (
|
|
56309
|
-
let e =
|
|
56310
|
-
e && (
|
|
56303
|
+
if (b && b.length > 0) {
|
|
56304
|
+
let e = b.at(-1);
|
|
56305
|
+
e && (O(e), A(b.length - 1), _((t) => ({
|
|
56311
56306
|
...t,
|
|
56312
56307
|
content: e.content ?? ""
|
|
56313
56308
|
})));
|
|
56314
56309
|
}
|
|
56315
|
-
}, [
|
|
56316
|
-
|
|
56317
|
-
}, [
|
|
56318
|
-
let { mutate:
|
|
56319
|
-
|
|
56310
|
+
}, [b, _]), E(() => {
|
|
56311
|
+
S();
|
|
56312
|
+
}, [S]);
|
|
56313
|
+
let { mutate: j } = G_(), [M, N] = P(!1), F = C((e) => {
|
|
56314
|
+
g && j(`/api/rb/agents/document?id=${g.documentId}`, async (t) => {
|
|
56320
56315
|
if (!t) return [];
|
|
56321
56316
|
let n = t.at(-1);
|
|
56322
|
-
if (!n || !n.content) return
|
|
56317
|
+
if (!n || !n.content) return N(!1), t;
|
|
56323
56318
|
if (n.content !== e) {
|
|
56324
|
-
await fetch(`/api/rb/agents/document?id=${
|
|
56319
|
+
await fetch(`/api/rb/agents/document?id=${g.documentId}`, {
|
|
56325
56320
|
method: "POST",
|
|
56326
56321
|
body: JSON.stringify({
|
|
56327
|
-
title:
|
|
56322
|
+
title: g.title,
|
|
56328
56323
|
content: e,
|
|
56329
|
-
kind:
|
|
56324
|
+
kind: g.kind
|
|
56330
56325
|
})
|
|
56331
|
-
}),
|
|
56326
|
+
}), N(!1);
|
|
56332
56327
|
let r = {
|
|
56333
56328
|
...n,
|
|
56334
56329
|
content: e,
|
|
@@ -56338,30 +56333,30 @@ function mV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
56338
56333
|
}
|
|
56339
56334
|
return t;
|
|
56340
56335
|
}, { revalidate: !1 });
|
|
56341
|
-
}, [
|
|
56342
|
-
|
|
56336
|
+
}, [g, j]), I = sM(F, 2e3), L = C((e, t) => {
|
|
56337
|
+
D && e !== D.content && (N(!0), t ? I(e) : F(e));
|
|
56343
56338
|
}, [
|
|
56344
|
-
|
|
56345
|
-
|
|
56346
|
-
|
|
56339
|
+
D,
|
|
56340
|
+
I,
|
|
56341
|
+
F
|
|
56347
56342
|
]);
|
|
56348
|
-
function
|
|
56349
|
-
return !
|
|
56343
|
+
function R(e) {
|
|
56344
|
+
return !b || !b[e] ? "" : b[e].content ?? "";
|
|
56350
56345
|
}
|
|
56351
|
-
let
|
|
56352
|
-
|
|
56353
|
-
}, [
|
|
56354
|
-
if (!
|
|
56346
|
+
let z = (e) => {
|
|
56347
|
+
b && (e === "latest" && (A(b.length - 1), T("edit")), e === "toggle" && T((e) => e === "edit" ? "diff" : "edit"), e === "prev" ? k > 0 && A((e) => e - 1) : e === "next" && k < b.length - 1 && A((e) => e + 1));
|
|
56348
|
+
}, [ee, B] = P(!1), te = b && b.length > 0 ? k === b.length - 1 : !0, V = dm(), ne = pV.find((e) => e.kind === g.kind);
|
|
56349
|
+
if (!ne) throw Error("Artifact definition not found!");
|
|
56355
56350
|
return E(() => {
|
|
56356
|
-
|
|
56357
|
-
documentId:
|
|
56358
|
-
setMetadata:
|
|
56351
|
+
g.documentId !== "init" && ne.initialize && ne.initialize({
|
|
56352
|
+
documentId: g.documentId,
|
|
56353
|
+
setMetadata: y
|
|
56359
56354
|
});
|
|
56360
56355
|
}, [
|
|
56361
|
-
|
|
56362
|
-
|
|
56363
|
-
|
|
56364
|
-
]), /* @__PURE__ */ H(Ek, { children:
|
|
56356
|
+
g.documentId,
|
|
56357
|
+
ne,
|
|
56358
|
+
y
|
|
56359
|
+
]), /* @__PURE__ */ H(Ek, { children: g.isVisible && /* @__PURE__ */ U(yj.div, {
|
|
56365
56360
|
animate: { opacity: 1 },
|
|
56366
56361
|
className: "absolute inset-0 z-50 flex min-h-0 min-w-0 flex-row overflow-hidden bg-background",
|
|
56367
56362
|
"data-testid": "artifact",
|
|
@@ -56370,7 +56365,7 @@ function mV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
56370
56365
|
transition: { delay: .4 }
|
|
56371
56366
|
},
|
|
56372
56367
|
initial: { opacity: 1 },
|
|
56373
|
-
children: [!
|
|
56368
|
+
children: [!V && /* @__PURE__ */ U(yj.div, {
|
|
56374
56369
|
animate: {
|
|
56375
56370
|
opacity: 1,
|
|
56376
56371
|
x: 0,
|
|
@@ -56394,7 +56389,7 @@ function mV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
56394
56389
|
x: 10,
|
|
56395
56390
|
scale: 1
|
|
56396
56391
|
},
|
|
56397
|
-
children: [/* @__PURE__ */ H(Ek, { children: !
|
|
56392
|
+
children: [/* @__PURE__ */ H(Ek, { children: !te && /* @__PURE__ */ H(yj.div, {
|
|
56398
56393
|
animate: { opacity: 1 },
|
|
56399
56394
|
className: "absolute inset-0 z-50 bg-background/70",
|
|
56400
56395
|
exit: { opacity: 0 },
|
|
@@ -56403,7 +56398,7 @@ function mV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
56403
56398
|
className: "flex h-full flex-col items-center justify-between",
|
|
56404
56399
|
children: [/* @__PURE__ */ H(kL, {
|
|
56405
56400
|
addToolApprovalResponse: e,
|
|
56406
|
-
artifactStatus:
|
|
56401
|
+
artifactStatus: g.status,
|
|
56407
56402
|
chatId: t,
|
|
56408
56403
|
isReadonly: p,
|
|
56409
56404
|
messages: l,
|
|
@@ -56425,7 +56420,8 @@ function mV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
56425
56420
|
setInput: r,
|
|
56426
56421
|
setMessages: u,
|
|
56427
56422
|
status: i,
|
|
56428
|
-
stop: a
|
|
56423
|
+
stop: a,
|
|
56424
|
+
suggestedActions: h
|
|
56429
56425
|
})
|
|
56430
56426
|
})]
|
|
56431
56427
|
})]
|
|
@@ -56454,7 +56450,7 @@ function mV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
56454
56450
|
damping: 30
|
|
56455
56451
|
}
|
|
56456
56452
|
},
|
|
56457
|
-
initial:
|
|
56453
|
+
initial: V ? {
|
|
56458
56454
|
opacity: 0,
|
|
56459
56455
|
x: 0,
|
|
56460
56456
|
y: 16,
|
|
@@ -56474,131 +56470,137 @@ function mV({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
56474
56470
|
className: "flex flex-col",
|
|
56475
56471
|
children: [/* @__PURE__ */ H("div", {
|
|
56476
56472
|
className: "font-medium",
|
|
56477
|
-
children:
|
|
56478
|
-
}),
|
|
56473
|
+
children: g.title
|
|
56474
|
+
}), M ? /* @__PURE__ */ H("div", {
|
|
56479
56475
|
className: "text-muted-foreground text-sm",
|
|
56480
56476
|
children: "Saving changes..."
|
|
56481
|
-
}) :
|
|
56477
|
+
}) : D ? /* @__PURE__ */ H("div", {
|
|
56482
56478
|
className: "text-muted-foreground text-sm",
|
|
56483
|
-
children: `Updated ${re(new Date(
|
|
56479
|
+
children: `Updated ${re(new Date(D.createdAt), /* @__PURE__ */ new Date(), { addSuffix: !0 })}`
|
|
56484
56480
|
}) : /* @__PURE__ */ H("div", { className: "mt-2 h-3 w-32 animate-pulse rounded-md bg-muted-foreground/20" })]
|
|
56485
56481
|
})]
|
|
56486
56482
|
}), /* @__PURE__ */ H(zF, {
|
|
56487
|
-
artifact:
|
|
56488
|
-
currentVersionIndex:
|
|
56489
|
-
handleVersionChange:
|
|
56490
|
-
isCurrentVersion:
|
|
56491
|
-
metadata:
|
|
56492
|
-
mode:
|
|
56493
|
-
setMetadata:
|
|
56483
|
+
artifact: g,
|
|
56484
|
+
currentVersionIndex: k,
|
|
56485
|
+
handleVersionChange: z,
|
|
56486
|
+
isCurrentVersion: te,
|
|
56487
|
+
metadata: v,
|
|
56488
|
+
mode: w,
|
|
56489
|
+
setMetadata: y
|
|
56494
56490
|
})]
|
|
56495
56491
|
}),
|
|
56496
56492
|
/* @__PURE__ */ U("div", {
|
|
56497
56493
|
className: "h-full max-w-full! items-center overflow-y-scroll bg-background dark:bg-muted",
|
|
56498
|
-
children: [/* @__PURE__ */ H(
|
|
56499
|
-
content:
|
|
56500
|
-
currentVersionIndex:
|
|
56501
|
-
getDocumentContentById:
|
|
56502
|
-
isCurrentVersion:
|
|
56494
|
+
children: [/* @__PURE__ */ H(ne.content, {
|
|
56495
|
+
content: te ? g.content : R(k),
|
|
56496
|
+
currentVersionIndex: k,
|
|
56497
|
+
getDocumentContentById: R,
|
|
56498
|
+
isCurrentVersion: te,
|
|
56503
56499
|
isInline: !1,
|
|
56504
|
-
isLoading:
|
|
56505
|
-
metadata:
|
|
56506
|
-
mode:
|
|
56507
|
-
onSaveContent:
|
|
56508
|
-
setMetadata:
|
|
56509
|
-
status:
|
|
56500
|
+
isLoading: x && !g.content,
|
|
56501
|
+
metadata: v,
|
|
56502
|
+
mode: w,
|
|
56503
|
+
onSaveContent: L,
|
|
56504
|
+
setMetadata: y,
|
|
56505
|
+
status: g.status,
|
|
56510
56506
|
suggestions: [],
|
|
56511
|
-
title:
|
|
56512
|
-
}), /* @__PURE__ */ H(Ek, { children:
|
|
56513
|
-
artifactKind:
|
|
56514
|
-
isToolbarVisible:
|
|
56507
|
+
title: g.title
|
|
56508
|
+
}), /* @__PURE__ */ H(Ek, { children: te && /* @__PURE__ */ H(dV, {
|
|
56509
|
+
artifactKind: g.kind,
|
|
56510
|
+
isToolbarVisible: ee,
|
|
56515
56511
|
sendMessage: c,
|
|
56516
|
-
setIsToolbarVisible:
|
|
56512
|
+
setIsToolbarVisible: B,
|
|
56517
56513
|
setMessages: u,
|
|
56518
56514
|
status: i,
|
|
56519
56515
|
stop: a
|
|
56520
56516
|
}) })]
|
|
56521
56517
|
}),
|
|
56522
|
-
/* @__PURE__ */ H(Ek, { children: !
|
|
56523
|
-
currentVersionIndex:
|
|
56524
|
-
documents:
|
|
56525
|
-
handleVersionChange:
|
|
56518
|
+
/* @__PURE__ */ H(Ek, { children: !te && /* @__PURE__ */ H(fV, {
|
|
56519
|
+
currentVersionIndex: k,
|
|
56520
|
+
documents: b,
|
|
56521
|
+
handleVersionChange: z
|
|
56526
56522
|
}) })
|
|
56527
56523
|
]
|
|
56528
56524
|
})]
|
|
56529
56525
|
}) });
|
|
56530
56526
|
}
|
|
56531
|
-
var hV = S(mV, (e, t) => !(e.status !== t.status || !xe(e.votes, t.votes) || e.input !== t.input || !xe(e.messages, t.messages.length))), gV = (
|
|
56532
|
-
|
|
56533
|
-
|
|
56534
|
-
|
|
56535
|
-
|
|
56536
|
-
|
|
56537
|
-
|
|
56538
|
-
|
|
56539
|
-
|
|
56540
|
-
|
|
56541
|
-
|
|
56542
|
-
|
|
56543
|
-
|
|
56544
|
-
|
|
56545
|
-
|
|
56546
|
-
|
|
56547
|
-
|
|
56548
|
-
|
|
56549
|
-
|
|
56550
|
-
|
|
56551
|
-
|
|
56552
|
-
|
|
56553
|
-
|
|
56554
|
-
|
|
56555
|
-
|
|
56556
|
-
|
|
56557
|
-
|
|
56558
|
-
|
|
56559
|
-
|
|
56560
|
-
|
|
56561
|
-
|
|
56562
|
-
|
|
56563
|
-
|
|
56564
|
-
|
|
56565
|
-
|
|
56566
|
-
|
|
56527
|
+
var hV = S(mV, (e, t) => !(e.status !== t.status || !xe(e.votes, t.votes) || e.input !== t.input || !xe(e.messages, t.messages.length) || !xe(e.suggestedActions, t.suggestedActions))), gV = ({ title1: e, title2: t }) => {
|
|
56528
|
+
let n = e?.trim(), r = t?.trim();
|
|
56529
|
+
return !n && !r ? null : /* @__PURE__ */ U("div", {
|
|
56530
|
+
className: "mx-auto mt-4 flex size-full max-w-3xl flex-col justify-center px-4 md:mt-16 md:px-8",
|
|
56531
|
+
children: [n && /* @__PURE__ */ H(yj.div, {
|
|
56532
|
+
animate: {
|
|
56533
|
+
opacity: 1,
|
|
56534
|
+
y: 0
|
|
56535
|
+
},
|
|
56536
|
+
className: "font-semibold text-xl md:text-2xl",
|
|
56537
|
+
exit: {
|
|
56538
|
+
opacity: 0,
|
|
56539
|
+
y: 10
|
|
56540
|
+
},
|
|
56541
|
+
initial: {
|
|
56542
|
+
opacity: 0,
|
|
56543
|
+
y: 10
|
|
56544
|
+
},
|
|
56545
|
+
transition: { delay: .5 },
|
|
56546
|
+
children: n
|
|
56547
|
+
}), r && /* @__PURE__ */ H(yj.div, {
|
|
56548
|
+
animate: {
|
|
56549
|
+
opacity: 1,
|
|
56550
|
+
y: 0
|
|
56551
|
+
},
|
|
56552
|
+
className: "text-xl text-muted-foreground md:text-2xl",
|
|
56553
|
+
exit: {
|
|
56554
|
+
opacity: 0,
|
|
56555
|
+
y: 10
|
|
56556
|
+
},
|
|
56557
|
+
initial: {
|
|
56558
|
+
opacity: 0,
|
|
56559
|
+
y: 10
|
|
56560
|
+
},
|
|
56561
|
+
transition: { delay: .6 },
|
|
56562
|
+
children: r
|
|
56563
|
+
})]
|
|
56564
|
+
}, "overview");
|
|
56565
|
+
};
|
|
56567
56566
|
//#endregion
|
|
56568
56567
|
//#region src/components/messages.tsx
|
|
56569
|
-
function _V({ addToolApprovalResponse: e, chatId: t, status: n, votes: r, messages: i, setMessages: a, regenerate: o, isReadonly: s, selectedModelId: c }) {
|
|
56570
|
-
let
|
|
56568
|
+
function _V({ addToolApprovalResponse: e, chatId: t, status: n, votes: r, messages: i, setMessages: a, regenerate: o, isReadonly: s, selectedModelId: c, title1: l, title2: u }) {
|
|
56569
|
+
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" ? xL(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 } = UF({ status: n });
|
|
56571
56570
|
return ot(), /* @__PURE__ */ U("div", {
|
|
56572
56571
|
className: "relative flex-1",
|
|
56573
56572
|
children: [/* @__PURE__ */ H("div", {
|
|
56574
56573
|
className: "absolute inset-0 touch-pan-y overflow-y-auto",
|
|
56575
|
-
ref:
|
|
56574
|
+
ref: g,
|
|
56576
56575
|
children: /* @__PURE__ */ U("div", {
|
|
56577
56576
|
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",
|
|
56578
56577
|
children: [
|
|
56579
|
-
i.length === 0 && /* @__PURE__ */ H(gV, {
|
|
56580
|
-
|
|
56578
|
+
i.length === 0 && /* @__PURE__ */ H(gV, {
|
|
56579
|
+
title1: l,
|
|
56580
|
+
title2: u
|
|
56581
|
+
}),
|
|
56582
|
+
i.map((c, l) => h && l === i.length - 1 && c.role === "assistant" ? null : /* @__PURE__ */ H(TL, {
|
|
56581
56583
|
addToolApprovalResponse: e,
|
|
56582
56584
|
chatId: t,
|
|
56583
56585
|
isLoading: n === "streaming" && i.length - 1 === l,
|
|
56584
56586
|
isReadonly: s,
|
|
56585
56587
|
message: c,
|
|
56586
56588
|
regenerate: o,
|
|
56587
|
-
requiresScrollPadding:
|
|
56589
|
+
requiresScrollPadding: b && l === i.length - 1,
|
|
56588
56590
|
setMessages: a,
|
|
56589
56591
|
vote: r ? r.find((e) => e.messageId === c.id) : void 0
|
|
56590
56592
|
}, c.id)),
|
|
56591
|
-
|
|
56593
|
+
m && /* @__PURE__ */ H(EL, {}),
|
|
56592
56594
|
/* @__PURE__ */ H("div", {
|
|
56593
56595
|
className: "min-h-[24px] min-w-[24px] shrink-0",
|
|
56594
|
-
ref:
|
|
56596
|
+
ref: _
|
|
56595
56597
|
})
|
|
56596
56598
|
]
|
|
56597
56599
|
})
|
|
56598
56600
|
}), /* @__PURE__ */ H("button", {
|
|
56599
56601
|
"aria-label": "Scroll to bottom",
|
|
56600
|
-
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 ${
|
|
56601
|
-
onClick: () =>
|
|
56602
|
+
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"}`,
|
|
56603
|
+
onClick: () => y("smooth"),
|
|
56602
56604
|
type: "button",
|
|
56603
56605
|
children: /* @__PURE__ */ H(Ef, { className: "size-4" })
|
|
56604
56606
|
})]
|
|
@@ -56608,16 +56610,16 @@ var vV = _V, yV = (e) => e?.parts?.some((e) => {
|
|
|
56608
56610
|
let t = e.state;
|
|
56609
56611
|
return t === "approval-responded" || t === "output-denied";
|
|
56610
56612
|
}) ?? !1, bV = (e) => `agents-sdk:chat:${e}:stream`, xV = (e) => !!(e && typeof e == "object" && !Array.isArray(e)), SV = (e) => u(e) ?? "default";
|
|
56611
|
-
function CV({ id: e, initialMessages: t, initialChatModel: n, isReadonly: r, autoResume: i }) {
|
|
56612
|
-
let { setDataStream:
|
|
56613
|
+
function CV({ id: e, initialMessages: t, initialChatModel: n, isReadonly: r, autoResume: i, suggestedActions: a, title1: s, title2: u }) {
|
|
56614
|
+
let { setDataStream: d } = ot(), { getChatPath: f } = et(), p = o.has(n) ? n : c, m = SV(p), [h, g] = P(""), [_, v] = P(p), y = N(_), [b, x] = P(m), S = N(b);
|
|
56613
56615
|
E(() => {
|
|
56614
|
-
g.current = m;
|
|
56615
|
-
}, [m]), E(() => {
|
|
56616
|
-
h(u), v(SV(u));
|
|
56617
|
-
}, [e, u]), E(() => {
|
|
56618
56616
|
y.current = _;
|
|
56619
|
-
}, [_])
|
|
56620
|
-
|
|
56617
|
+
}, [_]), E(() => {
|
|
56618
|
+
v(p), x(SV(p));
|
|
56619
|
+
}, [e, p]), E(() => {
|
|
56620
|
+
S.current = b;
|
|
56621
|
+
}, [b]);
|
|
56622
|
+
let { messages: C, setMessages: w, sendMessage: T, status: D, stop: O, regenerate: k, resumeStream: A, addToolApprovalResponse: j } = zy({
|
|
56621
56623
|
id: e,
|
|
56622
56624
|
messages: t,
|
|
56623
56625
|
experimental_throttle: 100,
|
|
@@ -56627,7 +56629,7 @@ function CV({ id: e, initialMessages: t, initialChatModel: n, isReadonly: r, aut
|
|
|
56627
56629
|
api: "/api/rb/agents/chat",
|
|
56628
56630
|
fetch: qd,
|
|
56629
56631
|
prepareSendMessagesRequest(e) {
|
|
56630
|
-
let t =
|
|
56632
|
+
let t = y.current, n = S.current, r = e.messages.at(-1), i = e.messages.at(-2), a = Ud(e.headers, Vd()), o = r?.role !== "user" || r?.role === "user" && yV(i);
|
|
56631
56633
|
return {
|
|
56632
56634
|
...a ? { headers: a } : {},
|
|
56633
56635
|
body: {
|
|
@@ -56648,7 +56650,7 @@ function CV({ id: e, initialMessages: t, initialChatModel: n, isReadonly: r, aut
|
|
|
56648
56650
|
}
|
|
56649
56651
|
}),
|
|
56650
56652
|
onData: (e) => {
|
|
56651
|
-
|
|
56653
|
+
d((t) => t ? [...t, e] : []);
|
|
56652
56654
|
},
|
|
56653
56655
|
onError: (e) => {
|
|
56654
56656
|
if (e instanceof Nd) {
|
|
@@ -56661,7 +56663,7 @@ function CV({ id: e, initialMessages: t, initialChatModel: n, isReadonly: r, aut
|
|
|
56661
56663
|
}
|
|
56662
56664
|
de.error("Something went wrong. Please try again.");
|
|
56663
56665
|
}
|
|
56664
|
-
}),
|
|
56666
|
+
}), M = N(null), F = N("");
|
|
56665
56667
|
E(() => fe(bV(e), (t) => {
|
|
56666
56668
|
if (!xV(t) || t.chatId !== e) return;
|
|
56667
56669
|
let n = t.message;
|
|
@@ -56674,34 +56676,34 @@ function CV({ id: e, initialMessages: t, initialChatModel: n, isReadonly: r, aut
|
|
|
56674
56676
|
parts: r,
|
|
56675
56677
|
metadata: xV(n.metadata) ? n.metadata : { createdAt: (/* @__PURE__ */ new Date()).toISOString() }
|
|
56676
56678
|
};
|
|
56677
|
-
|
|
56679
|
+
w((t) => {
|
|
56678
56680
|
let n = t.findIndex((t) => t.id === e);
|
|
56679
56681
|
return n === -1 ? [...t, i] : t.map((e, t) => t === n ? i : e);
|
|
56680
56682
|
});
|
|
56681
56683
|
}
|
|
56682
56684
|
}
|
|
56683
56685
|
if (t.done === !0) {
|
|
56684
|
-
|
|
56686
|
+
M.current = null, F.current = "";
|
|
56685
56687
|
return;
|
|
56686
56688
|
}
|
|
56687
56689
|
let r = t.part;
|
|
56688
56690
|
if (!xV(r)) return;
|
|
56689
56691
|
if (r.type === "start" && typeof r.messageId == "string") {
|
|
56690
|
-
|
|
56692
|
+
M.current = r.messageId, F.current = "";
|
|
56691
56693
|
return;
|
|
56692
56694
|
}
|
|
56693
|
-
if (typeof r.type == "string" && r.type.startsWith("data-") &&
|
|
56694
|
-
let i =
|
|
56695
|
+
if (typeof r.type == "string" && r.type.startsWith("data-") && d((e) => e ? [...e, r] : []), r.type !== "text-delta" || typeof r.delta != "string") return;
|
|
56696
|
+
let i = M.current;
|
|
56695
56697
|
if (!i) return;
|
|
56696
|
-
|
|
56697
|
-
let
|
|
56698
|
-
|
|
56698
|
+
F.current += r.delta;
|
|
56699
|
+
let a = F.current;
|
|
56700
|
+
w((e) => {
|
|
56699
56701
|
let t = e.findIndex((e) => e.id === i), n = {
|
|
56700
56702
|
id: i,
|
|
56701
56703
|
role: "assistant",
|
|
56702
56704
|
parts: [{
|
|
56703
56705
|
type: "text",
|
|
56704
|
-
text:
|
|
56706
|
+
text: a
|
|
56705
56707
|
}],
|
|
56706
56708
|
metadata: { createdAt: (/* @__PURE__ */ new Date()).toISOString() }
|
|
56707
56709
|
};
|
|
@@ -56709,89 +56711,93 @@ function CV({ id: e, initialMessages: t, initialChatModel: n, isReadonly: r, aut
|
|
|
56709
56711
|
});
|
|
56710
56712
|
}), [
|
|
56711
56713
|
e,
|
|
56712
|
-
|
|
56713
|
-
|
|
56714
|
+
d,
|
|
56715
|
+
w
|
|
56714
56716
|
]);
|
|
56715
|
-
let [
|
|
56717
|
+
let [I] = V(), L = I.get("query"), [R, z] = P(!1);
|
|
56716
56718
|
E(() => {
|
|
56717
|
-
if (
|
|
56718
|
-
|
|
56719
|
+
if (L && !R) {
|
|
56720
|
+
T({
|
|
56719
56721
|
role: "user",
|
|
56720
56722
|
parts: [{
|
|
56721
56723
|
type: "text",
|
|
56722
|
-
text:
|
|
56724
|
+
text: L
|
|
56723
56725
|
}]
|
|
56724
|
-
}),
|
|
56726
|
+
}), z(!0);
|
|
56725
56727
|
let t = new URLSearchParams(window.location.search);
|
|
56726
56728
|
t.delete("query");
|
|
56727
56729
|
let n = t.toString();
|
|
56728
|
-
window.history.replaceState({}, "", `${
|
|
56730
|
+
window.history.replaceState({}, "", `${f(e)}${n ? `?${n}` : ""}`);
|
|
56729
56731
|
}
|
|
56730
56732
|
}, [
|
|
56731
|
-
|
|
56732
|
-
|
|
56733
|
-
|
|
56733
|
+
L,
|
|
56734
|
+
T,
|
|
56735
|
+
R,
|
|
56734
56736
|
e,
|
|
56735
|
-
|
|
56737
|
+
f
|
|
56736
56738
|
]);
|
|
56737
|
-
let { data:
|
|
56739
|
+
let { data: ee } = cv(C.length >= 2 ? `/api/rb/agents/vote?chatId=${e}` : null, Kd), [B, te] = P([]), ne = Vy((e) => e.isVisible);
|
|
56738
56740
|
return Uy({
|
|
56739
56741
|
autoResume: i,
|
|
56740
56742
|
initialMessages: t,
|
|
56741
|
-
resumeStream:
|
|
56742
|
-
setMessages:
|
|
56743
|
+
resumeStream: A,
|
|
56744
|
+
setMessages: w
|
|
56743
56745
|
}), /* @__PURE__ */ U("div", {
|
|
56744
56746
|
className: "relative flex h-full min-h-0 min-w-0 overflow-hidden bg-background",
|
|
56745
56747
|
children: [/* @__PURE__ */ U("div", {
|
|
56746
56748
|
className: "overscroll-behavior-contain flex h-full min-h-0 min-w-0 flex-1 touch-pan-y flex-col bg-background",
|
|
56747
56749
|
children: [/* @__PURE__ */ H(vV, {
|
|
56748
|
-
addToolApprovalResponse:
|
|
56750
|
+
addToolApprovalResponse: j,
|
|
56749
56751
|
chatId: e,
|
|
56750
|
-
isArtifactVisible:
|
|
56752
|
+
isArtifactVisible: ne,
|
|
56751
56753
|
isReadonly: r,
|
|
56752
|
-
messages:
|
|
56753
|
-
regenerate:
|
|
56754
|
-
selectedModelId:
|
|
56755
|
-
setMessages:
|
|
56756
|
-
status:
|
|
56757
|
-
|
|
56754
|
+
messages: C,
|
|
56755
|
+
regenerate: k,
|
|
56756
|
+
selectedModelId: p,
|
|
56757
|
+
setMessages: w,
|
|
56758
|
+
status: D,
|
|
56759
|
+
title1: s,
|
|
56760
|
+
title2: u,
|
|
56761
|
+
votes: ee
|
|
56758
56762
|
}), /* @__PURE__ */ H("div", {
|
|
56759
56763
|
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",
|
|
56760
56764
|
children: !r && /* @__PURE__ */ H(QB, {
|
|
56761
|
-
attachments:
|
|
56765
|
+
attachments: B,
|
|
56762
56766
|
chatId: e,
|
|
56763
|
-
input:
|
|
56764
|
-
messages:
|
|
56767
|
+
input: h,
|
|
56768
|
+
messages: C,
|
|
56765
56769
|
onModelChange: (e) => {
|
|
56766
|
-
|
|
56770
|
+
v(e), x(SV(e));
|
|
56767
56771
|
},
|
|
56768
|
-
onOpenAIReasoningEffortChange:
|
|
56769
|
-
openaiReasoningEffort:
|
|
56770
|
-
selectedModelId:
|
|
56771
|
-
sendMessage:
|
|
56772
|
-
setAttachments:
|
|
56773
|
-
setInput:
|
|
56774
|
-
setMessages:
|
|
56775
|
-
status:
|
|
56776
|
-
stop:
|
|
56772
|
+
onOpenAIReasoningEffortChange: x,
|
|
56773
|
+
openaiReasoningEffort: b,
|
|
56774
|
+
selectedModelId: _,
|
|
56775
|
+
sendMessage: T,
|
|
56776
|
+
setAttachments: te,
|
|
56777
|
+
setInput: g,
|
|
56778
|
+
setMessages: w,
|
|
56779
|
+
status: D,
|
|
56780
|
+
stop: O,
|
|
56781
|
+
suggestedActions: a
|
|
56777
56782
|
})
|
|
56778
56783
|
})]
|
|
56779
56784
|
}), /* @__PURE__ */ H(hV, {
|
|
56780
|
-
addToolApprovalResponse:
|
|
56781
|
-
attachments:
|
|
56785
|
+
addToolApprovalResponse: j,
|
|
56786
|
+
attachments: B,
|
|
56782
56787
|
chatId: e,
|
|
56783
|
-
input:
|
|
56788
|
+
input: h,
|
|
56784
56789
|
isReadonly: r,
|
|
56785
|
-
messages:
|
|
56786
|
-
regenerate:
|
|
56787
|
-
selectedModelId:
|
|
56788
|
-
sendMessage:
|
|
56789
|
-
setAttachments:
|
|
56790
|
-
setInput:
|
|
56791
|
-
setMessages:
|
|
56792
|
-
status:
|
|
56793
|
-
stop:
|
|
56794
|
-
|
|
56790
|
+
messages: C,
|
|
56791
|
+
regenerate: k,
|
|
56792
|
+
selectedModelId: _,
|
|
56793
|
+
sendMessage: T,
|
|
56794
|
+
setAttachments: te,
|
|
56795
|
+
setInput: g,
|
|
56796
|
+
setMessages: w,
|
|
56797
|
+
status: D,
|
|
56798
|
+
stop: O,
|
|
56799
|
+
suggestedActions: a,
|
|
56800
|
+
votes: ee
|
|
56795
56801
|
})]
|
|
56796
56802
|
});
|
|
56797
56803
|
}
|