@rpcbase/agents-sdk 0.7.0 → 0.9.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/api/chat/handler.d.ts.map +1 -1
- package/dist/api/chat/historyCompaction.d.ts +29 -0
- package/dist/api/chat/historyCompaction.d.ts.map +1 -0
- package/dist/api/chat/models.d.ts +1 -0
- package/dist/api/chat/models.d.ts.map +1 -1
- package/dist/api/chat/runtimeConfig.d.ts +43 -0
- package/dist/api/chat/runtimeConfig.d.ts.map +1 -1
- package/dist/api/chatDb.d.ts +4 -0
- package/dist/api/chatDb.d.ts.map +1 -1
- package/dist/chat-models.browser.js +2 -2
- package/dist/chat-models.d.ts +1 -1
- package/dist/chat-models.d.ts.map +1 -1
- package/dist/chat-models.js +2 -2
- package/dist/{chatDb-DdX0Vtyt.js → chatDb-BSiHIyn9.js} +25 -18
- package/dist/{chatDb-CcAjAGX7.js → chatDb-YfeABtn-.js} +25 -18
- package/dist/client-routes.browser.js +94 -75
- package/dist/client-routes.d.ts +7 -1
- package/dist/client-routes.d.ts.map +1 -1
- package/dist/client-routes.js +94 -75
- package/dist/components/agents-chat-route-layout.d.ts +5 -2
- package/dist/components/agents-chat-route-layout.d.ts.map +1 -1
- package/dist/components/artifact-messages.d.ts +3 -2
- package/dist/components/artifact-messages.d.ts.map +1 -1
- package/dist/components/artifact.d.ts +6 -2
- package/dist/components/artifact.d.ts.map +1 -1
- package/dist/components/chat.d.ts +6 -2
- package/dist/components/chat.d.ts.map +1 -1
- package/dist/components/message.d.ts +3 -2
- package/dist/components/message.d.ts.map +1 -1
- package/dist/components/messages.d.ts +3 -2
- package/dist/components/messages.d.ts.map +1 -1
- package/dist/components/multimodal-input.d.ts +4 -1
- package/dist/components/multimodal-input.d.ts.map +1 -1
- package/dist/components/sidebar-history-item.d.ts +4 -5
- package/dist/components/sidebar-history-item.d.ts.map +1 -1
- package/dist/components/sidebar-history.d.ts +6 -3
- package/dist/components/sidebar-history.d.ts.map +1 -1
- package/dist/{data-stream-handler-BW4eCG7d.js → data-stream-handler-DXAHFC5k.js} +462 -427
- package/dist/{data-stream-handler-Bd_oM4r9.js → data-stream-handler-lr4wJ3vt.js} +462 -427
- package/dist/{handler-D7f8iAy5.js → handler-5n-YwiF3.js} +1 -1
- package/dist/{handler-CGV7uuUA.js → handler-B3uUDuTR.js} +1 -1
- package/dist/{handler-BLG0AYVC.js → handler-BMeUL2iE.js} +1 -1
- package/dist/{handler-C6u7vLAb.js → handler-BgYHL3BZ.js} +9 -9
- package/dist/{handler-dVlpopfq.js → handler-By86dyTJ.js} +1 -1
- package/dist/{handler-BeWk8pDD.js → handler-C0MO52d9.js} +1 -1
- package/dist/{handler-mbDBRYl8.js → handler-C8gaYgmy.js} +1 -1
- package/dist/{handler-ClWOGjB_.js → handler-DE8agLBS.js} +438 -268
- package/dist/{handler-CEk1hut1.js → handler-DMwBT4bK.js} +1 -1
- package/dist/{handler-DPuJK6ft.js → handler-DSncMeo4.js} +352 -182
- package/dist/{handler-BY5bgBEh.js → handler-DdKB5P3H.js} +1 -1
- package/dist/{handler-BBCbPLLC.js → handler-Dy536I3-.js} +1 -1
- package/dist/{handler-BKT8Hl0a.js → handler-Jua6SU39.js} +9 -9
- package/dist/{handler-CZSMkZnQ.js → handler-YmuAR8ei.js} +1 -1
- package/dist/{handler-P40GjJry.js → handler-hah8tVEE.js} +1 -1
- package/dist/{handler-DbjPd3w4.js → handler-svaSKC2q.js} +1 -1
- package/dist/index.browser.js +4 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -3
- package/dist/lib/ai/models.d.ts +6 -0
- package/dist/lib/ai/models.d.ts.map +1 -1
- package/dist/lib/types.d.ts +23 -0
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/{models-DUt7W9lV.js → models-DphUIx22.js} +13 -2
- package/dist/pages/ChatNewPage.d.ts +6 -1
- package/dist/pages/ChatNewPage.d.ts.map +1 -1
- package/dist/pages/ChatPage.d.ts +6 -1
- package/dist/pages/ChatPage.d.ts.map +1 -1
- package/dist/routes.browser.js +8 -8
- package/dist/routes.js +8 -8
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +1 -1
- package/dist/tailwind-source.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { l as e, o as t, r as n, s as r, u as i } from "./chunk-BO2N2NFS-DRhdPgDj.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a, i as o, r as s, s as c } from "./models-DphUIx22.js";
|
|
3
3
|
import { i as l, n as u, r as d, t as f } from "./openai-reasoning-kFq60GX9.js";
|
|
4
4
|
import * as p from "react";
|
|
5
5
|
import m, { Children as h, Component as g, Fragment as _, createContext as v, createElement as y, forwardRef as b, isValidElement as x, memo as S, useCallback as C, useContext as w, useEffect as T, useEffectEvent as E, useId as D, useImperativeHandle as O, useInsertionEffect as k, useLayoutEffect as A, useMemo as j, useRef as M, useState as N, useSyncExternalStore as P, useSyncExternalStore as F } from "react";
|
|
@@ -43998,41 +43998,46 @@ function Xv({ label: e }) {
|
|
|
43998
43998
|
className: "block size-3.5 shrink-0 animate-spin rounded-full border-2 border-primary/20 border-t-primary"
|
|
43999
43999
|
});
|
|
44000
44000
|
}
|
|
44001
|
-
var Zv = ({ chat: e, isActive: t, isStreaming: n, onDelete: r,
|
|
44002
|
-
let
|
|
44001
|
+
var Zv = ({ chat: e, isActive: t, isStreaming: n, onDelete: r, renderSidebarChat: i, setOpenMobile: a }) => {
|
|
44002
|
+
let o = e.title?.trim() ? e.title : "New conversation", s = i?.({
|
|
44003
|
+
chat: e,
|
|
44004
|
+
isActive: t,
|
|
44005
|
+
isStreaming: n,
|
|
44006
|
+
title: o
|
|
44007
|
+
}), { getChatPath: c } = Ue(), l = Yv(e.id), [u, d] = N(!1), f = M(null), p = M(null), m = (e) => {
|
|
44003
44008
|
let t = e.relatedTarget;
|
|
44004
44009
|
if (!(t instanceof Node)) {
|
|
44005
|
-
|
|
44010
|
+
d(!1);
|
|
44006
44011
|
return;
|
|
44007
44012
|
}
|
|
44008
|
-
|
|
44013
|
+
f.current?.contains(t) || p.current?.contains(t) || d(!1);
|
|
44009
44014
|
};
|
|
44010
44015
|
return /* @__PURE__ */ H(c_, { children: [/* @__PURE__ */ V(u_, {
|
|
44011
44016
|
asChild: !0,
|
|
44012
44017
|
isActive: t,
|
|
44013
|
-
children: /* @__PURE__ */
|
|
44018
|
+
children: /* @__PURE__ */ V(I, {
|
|
44014
44019
|
className: "flex min-w-0 items-center gap-2",
|
|
44015
|
-
onClick: () =>
|
|
44016
|
-
to:
|
|
44017
|
-
children: [/* @__PURE__ */ V("span", {
|
|
44020
|
+
onClick: () => a(!1),
|
|
44021
|
+
to: c(e.id),
|
|
44022
|
+
children: s === void 0 ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("span", {
|
|
44018
44023
|
className: "min-w-0 flex-1 truncate",
|
|
44019
|
-
children:
|
|
44024
|
+
children: o
|
|
44020
44025
|
}), n ? /* @__PURE__ */ V("span", {
|
|
44021
44026
|
className: "mr-0.5 shrink-0",
|
|
44022
44027
|
children: /* @__PURE__ */ V(Xv, { label: "Conversation is streaming" })
|
|
44023
|
-
}) : null]
|
|
44028
|
+
}) : null] }) : s
|
|
44024
44029
|
})
|
|
44025
44030
|
}), /* @__PURE__ */ H(Lv, {
|
|
44026
44031
|
modal: !0,
|
|
44027
|
-
onOpenChange:
|
|
44028
|
-
open:
|
|
44032
|
+
onOpenChange: d,
|
|
44033
|
+
open: u,
|
|
44029
44034
|
children: [/* @__PURE__ */ V(Rv, {
|
|
44030
44035
|
asChild: !0,
|
|
44031
44036
|
children: /* @__PURE__ */ H(d_, {
|
|
44032
44037
|
className: "mr-0.5 data-open:bg-sidebar-accent data-open:text-sidebar-accent-foreground",
|
|
44033
|
-
id:
|
|
44034
|
-
onMouseLeave:
|
|
44035
|
-
ref:
|
|
44038
|
+
id: l,
|
|
44039
|
+
onMouseLeave: m,
|
|
44040
|
+
ref: f,
|
|
44036
44041
|
showOnHover: !t,
|
|
44037
44042
|
children: [/* @__PURE__ */ V(ot, {}), /* @__PURE__ */ V("span", {
|
|
44038
44043
|
className: "sr-only",
|
|
@@ -44041,8 +44046,8 @@ var Zv = ({ chat: e, isActive: t, isStreaming: n, onDelete: r, setOpenMobile: i
|
|
|
44041
44046
|
})
|
|
44042
44047
|
}), /* @__PURE__ */ V(Bv, {
|
|
44043
44048
|
align: "end",
|
|
44044
|
-
onMouseLeave:
|
|
44045
|
-
ref:
|
|
44049
|
+
onMouseLeave: m,
|
|
44050
|
+
ref: p,
|
|
44046
44051
|
side: "bottom",
|
|
44047
44052
|
children: /* @__PURE__ */ H(Uv, {
|
|
44048
44053
|
className: "cursor-pointer text-destructive focus:bg-destructive/15 focus:text-destructive",
|
|
@@ -44125,54 +44130,55 @@ function ry(e = "") {
|
|
|
44125
44130
|
visibleHistory: s
|
|
44126
44131
|
};
|
|
44127
44132
|
}
|
|
44128
|
-
function iy({ currentUserId: e = "", onActiveChatTitleChange: t } = {}) {
|
|
44133
|
+
function iy({ currentUserId: e = "", onActiveChatTitleChange: t, renderSidebarChat: n } = {}) {
|
|
44129
44134
|
return /* @__PURE__ */ V(ay, {
|
|
44130
44135
|
historyState: ry(e),
|
|
44131
|
-
onActiveChatTitleChange: t
|
|
44136
|
+
onActiveChatTitleChange: t,
|
|
44137
|
+
renderSidebarChat: n
|
|
44132
44138
|
});
|
|
44133
44139
|
}
|
|
44134
|
-
function ay({ historyState: e, onActiveChatTitleChange: t }) {
|
|
44135
|
-
let { setOpenMobile:
|
|
44140
|
+
function ay({ historyState: e, onActiveChatTitleChange: t, renderSidebarChat: n }) {
|
|
44141
|
+
let { setOpenMobile: r } = Kg(), i = R(), a = z(), { getNewChatPath: o } = Ue(), s = i.pathname, c = We(s), l = M(null), { historyQuery: u, isInitialLoading: d, showLoadingSkeleton: f, visibleHistory: p } = e, m = p?.chats ?? [], h = !!p?.pageInfo?.hasNextPage, g = c ? m.find((e) => e.id === c)?.title : null;
|
|
44136
44142
|
T(() => {
|
|
44137
44143
|
if (!t) return;
|
|
44138
|
-
if (!
|
|
44144
|
+
if (!c) {
|
|
44139
44145
|
t(null);
|
|
44140
44146
|
return;
|
|
44141
44147
|
}
|
|
44142
|
-
let e =
|
|
44148
|
+
let e = g?.trim();
|
|
44143
44149
|
t(e || "New conversation");
|
|
44144
44150
|
}, [
|
|
44145
|
-
|
|
44146
|
-
|
|
44151
|
+
c,
|
|
44152
|
+
g,
|
|
44147
44153
|
t
|
|
44148
44154
|
]);
|
|
44149
|
-
let { endSentinelRef:
|
|
44150
|
-
containerRef:
|
|
44151
|
-
enabled:
|
|
44152
|
-
hasNextPage:
|
|
44153
|
-
onEndReached: C(async () => !
|
|
44155
|
+
let { endSentinelRef: _, isFetchingNext: v } = ie({
|
|
44156
|
+
containerRef: l,
|
|
44157
|
+
enabled: h,
|
|
44158
|
+
hasNextPage: h,
|
|
44159
|
+
onEndReached: C(async () => !h || u.loading ? !1 : u.fetchNext(), [h, u]),
|
|
44154
44160
|
endReachedOffsetPx: 120
|
|
44155
|
-
}),
|
|
44156
|
-
if (
|
|
44157
|
-
|
|
44161
|
+
}), y = C((e) => {
|
|
44162
|
+
if (_(e), !(e instanceof HTMLElement)) {
|
|
44163
|
+
l.current = null;
|
|
44158
44164
|
return;
|
|
44159
44165
|
}
|
|
44160
44166
|
let t = e.closest("[data-sidebar=\"content\"]");
|
|
44161
|
-
|
|
44162
|
-
}, [
|
|
44163
|
-
let e =
|
|
44167
|
+
l.current = t instanceof HTMLElement ? t : null;
|
|
44168
|
+
}, [_]), [b, x] = N(null), [S, w] = N(!1), E = () => {
|
|
44169
|
+
let e = b;
|
|
44164
44170
|
if (!e) return;
|
|
44165
|
-
let t =
|
|
44166
|
-
|
|
44171
|
+
let t = c === e;
|
|
44172
|
+
w(!1);
|
|
44167
44173
|
let n = fetch(`/api/rb/agents/chat?id=${e}`, { method: "DELETE" });
|
|
44168
44174
|
U.promise(n, {
|
|
44169
44175
|
loading: "Deleting chat...",
|
|
44170
|
-
success: () => (t &&
|
|
44176
|
+
success: () => (t && a(o(), { replace: !0 }), "Chat deleted successfully"),
|
|
44171
44177
|
error: "Failed to delete chat"
|
|
44172
44178
|
});
|
|
44173
44179
|
};
|
|
44174
|
-
if (
|
|
44175
|
-
if (
|
|
44180
|
+
if (d && !f) return null;
|
|
44181
|
+
if (d) return /* @__PURE__ */ H(r_, { children: [/* @__PURE__ */ V("div", {
|
|
44176
44182
|
className: "px-2 py-1 text-sidebar-foreground/50 text-xs",
|
|
44177
44183
|
children: "Today"
|
|
44178
44184
|
}), /* @__PURE__ */ V(o_, { children: /* @__PURE__ */ V("div", {
|
|
@@ -44191,59 +44197,60 @@ function ay({ historyState: e, onActiveChatTitleChange: t }) {
|
|
|
44191
44197
|
})
|
|
44192
44198
|
}, e))
|
|
44193
44199
|
}) })] });
|
|
44194
|
-
if (
|
|
44200
|
+
if (u.error && m.length === 0) return /* @__PURE__ */ V(r_, { children: /* @__PURE__ */ V(o_, { children: /* @__PURE__ */ V("div", {
|
|
44195
44201
|
className: "flex w-full flex-row items-center justify-center gap-2 px-2 text-center text-destructive text-sm",
|
|
44196
44202
|
children: "Failed to load conversations."
|
|
44197
44203
|
}) }) });
|
|
44198
|
-
if (
|
|
44204
|
+
if (m.length === 0) return /* @__PURE__ */ V(r_, { children: /* @__PURE__ */ V(o_, { children: /* @__PURE__ */ V("div", {
|
|
44199
44205
|
className: "flex w-full flex-row items-center justify-center gap-2 px-2 text-sm text-muted-foreground",
|
|
44200
44206
|
children: "Your conversations will appear here once you start chatting!"
|
|
44201
44207
|
}) }) });
|
|
44202
|
-
let
|
|
44208
|
+
let D = ty(m);
|
|
44203
44209
|
return /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(r_, { children: /* @__PURE__ */ V(o_, { children: /* @__PURE__ */ H(s_, { children: [/* @__PURE__ */ V("div", {
|
|
44204
44210
|
className: "flex flex-col gap-6",
|
|
44205
44211
|
children: [
|
|
44206
44212
|
{
|
|
44207
44213
|
label: "Today",
|
|
44208
|
-
chats:
|
|
44214
|
+
chats: D.today
|
|
44209
44215
|
},
|
|
44210
44216
|
{
|
|
44211
44217
|
label: "Yesterday",
|
|
44212
|
-
chats:
|
|
44218
|
+
chats: D.yesterday
|
|
44213
44219
|
},
|
|
44214
44220
|
{
|
|
44215
44221
|
label: "Last 7 days",
|
|
44216
|
-
chats:
|
|
44222
|
+
chats: D.lastWeek
|
|
44217
44223
|
},
|
|
44218
44224
|
{
|
|
44219
44225
|
label: "Last 30 days",
|
|
44220
|
-
chats:
|
|
44226
|
+
chats: D.lastMonth
|
|
44221
44227
|
},
|
|
44222
44228
|
{
|
|
44223
44229
|
label: "Older than last month",
|
|
44224
|
-
chats:
|
|
44230
|
+
chats: D.older
|
|
44225
44231
|
}
|
|
44226
44232
|
].filter((e) => e.chats.length > 0).map((e) => /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("div", {
|
|
44227
44233
|
className: "px-2 py-1 text-sidebar-foreground/50 text-xs",
|
|
44228
44234
|
children: e.label
|
|
44229
44235
|
}), e.chats.map((e) => /* @__PURE__ */ V(Zv, {
|
|
44230
44236
|
chat: e,
|
|
44231
|
-
isActive: e.id ===
|
|
44237
|
+
isActive: e.id === c,
|
|
44232
44238
|
isStreaming: !!e.isStreaming,
|
|
44233
44239
|
onDelete: (e) => {
|
|
44234
|
-
|
|
44240
|
+
x(e), w(!0);
|
|
44235
44241
|
},
|
|
44236
|
-
|
|
44242
|
+
renderSidebarChat: n,
|
|
44243
|
+
setOpenMobile: r
|
|
44237
44244
|
}, e.id))] }, e.label))
|
|
44238
|
-
}), (
|
|
44245
|
+
}), (h || v) && /* @__PURE__ */ H("div", {
|
|
44239
44246
|
className: "mt-6 flex flex-row items-center gap-2 p-2 text-muted-foreground",
|
|
44240
|
-
ref:
|
|
44241
|
-
children: [/* @__PURE__ */ V(ny, {}), /* @__PURE__ */ V("div", { children:
|
|
44247
|
+
ref: y,
|
|
44248
|
+
children: [/* @__PURE__ */ V(ny, {}), /* @__PURE__ */ V("div", { children: v ? "Loading chats..." : "Scroll to load more..." })]
|
|
44242
44249
|
})] }) }) }), /* @__PURE__ */ V(Nm, {
|
|
44243
|
-
onOpenChange:
|
|
44244
|
-
open:
|
|
44250
|
+
onOpenChange: w,
|
|
44251
|
+
open: S,
|
|
44245
44252
|
children: /* @__PURE__ */ H(Lm, { children: [/* @__PURE__ */ H(Rm, { children: [/* @__PURE__ */ V(Bm, { children: "Are you absolutely sure?" }), /* @__PURE__ */ V(Vm, { children: "This action cannot be undone. This will hide the chat from your history." })] }), /* @__PURE__ */ H(zm, { children: [/* @__PURE__ */ V(Um, { children: "Cancel" }), /* @__PURE__ */ V(Hm, {
|
|
44246
|
-
onClick:
|
|
44253
|
+
onClick: E,
|
|
44247
44254
|
children: "Continue"
|
|
44248
44255
|
})] })] })
|
|
44249
44256
|
})] });
|
|
@@ -44264,67 +44271,69 @@ var oy = (e) => typeof e == "string" ? e.trim() : "", sy = async () => {
|
|
|
44264
44271
|
return null;
|
|
44265
44272
|
}
|
|
44266
44273
|
};
|
|
44267
|
-
function cy({
|
|
44268
|
-
let
|
|
44269
|
-
getNewChatPath: () =>
|
|
44270
|
-
getChatPath: (e) => Ke(
|
|
44271
|
-
}, [
|
|
44274
|
+
function cy({ renderSidebarChat: e, sidebarActions: t, theme: n, title: r = "Agents" }) {
|
|
44275
|
+
let i = R(), a = z(), o = ee(), s = te("root"), c = Ge(i.pathname), l = {
|
|
44276
|
+
getNewChatPath: () => c,
|
|
44277
|
+
getChatPath: (e) => Ke(c, `chat/${encodeURIComponent(e)}`)
|
|
44278
|
+
}, [u, d] = N(null), f = oy(s?.rtsUid), [p, m] = N(f);
|
|
44272
44279
|
return T(() => {
|
|
44273
|
-
if (
|
|
44274
|
-
|
|
44280
|
+
if (f) {
|
|
44281
|
+
m(f);
|
|
44275
44282
|
return;
|
|
44276
44283
|
}
|
|
44277
44284
|
let e = !1;
|
|
44278
|
-
return
|
|
44285
|
+
return m(""), sy().then((t) => {
|
|
44279
44286
|
if (e) return;
|
|
44280
44287
|
let n = oy(t?.rtsUid);
|
|
44281
|
-
n &&
|
|
44288
|
+
n && m(n);
|
|
44282
44289
|
}), () => {
|
|
44283
44290
|
e = !0;
|
|
44284
44291
|
};
|
|
44285
|
-
}, [
|
|
44286
|
-
value:
|
|
44292
|
+
}, [f]), /* @__PURE__ */ V(He, {
|
|
44293
|
+
value: l,
|
|
44287
44294
|
children: /* @__PURE__ */ V(jm, {
|
|
44288
|
-
theme:
|
|
44295
|
+
theme: n,
|
|
44289
44296
|
children: /* @__PURE__ */ V(ly, {
|
|
44290
|
-
currentConversationTitle:
|
|
44291
|
-
currentUserId:
|
|
44292
|
-
defaultSidebarOpen:
|
|
44293
|
-
onActiveChatTitleChange:
|
|
44294
|
-
|
|
44297
|
+
currentConversationTitle: u,
|
|
44298
|
+
currentUserId: p,
|
|
44299
|
+
defaultSidebarOpen: s?.sidebarDefaultOpen ?? !0,
|
|
44300
|
+
onActiveChatTitleChange: d,
|
|
44301
|
+
renderSidebarChat: e,
|
|
44302
|
+
sidebarActions: t,
|
|
44295
44303
|
startNewChat: () => {
|
|
44296
|
-
let e =
|
|
44304
|
+
let e = l.getNewChatPath(), t = typeof window > "u" ? i.pathname : window.location.pathname;
|
|
44297
44305
|
if ((t.length > 1 ? t.replace(/\/+$/, "") : t) === (e.length > 1 ? e.replace(/\/+$/, "") : e)) {
|
|
44298
|
-
|
|
44306
|
+
o.revalidate();
|
|
44299
44307
|
return;
|
|
44300
44308
|
}
|
|
44301
|
-
|
|
44309
|
+
a(e, { replace: !1 });
|
|
44302
44310
|
},
|
|
44303
|
-
title:
|
|
44311
|
+
title: r
|
|
44304
44312
|
})
|
|
44305
44313
|
})
|
|
44306
44314
|
});
|
|
44307
44315
|
}
|
|
44308
|
-
function ly({ currentConversationTitle: e, currentUserId: t, defaultSidebarOpen: n, onActiveChatTitleChange: r,
|
|
44309
|
-
let { resolvedTheme:
|
|
44316
|
+
function ly({ currentConversationTitle: e, currentUserId: t, defaultSidebarOpen: n, onActiveChatTitleChange: r, renderSidebarChat: i, sidebarActions: a, startNewChat: o, title: s }) {
|
|
44317
|
+
let { resolvedTheme: c, theme: l } = Mm();
|
|
44310
44318
|
return /* @__PURE__ */ V(Je, {
|
|
44311
44319
|
currentUserId: t,
|
|
44312
44320
|
children: /* @__PURE__ */ V(qg, {
|
|
44313
|
-
className: G("agents-sdk relative h-full !min-h-0 min-h-0 overflow-hidden bg-background text-foreground",
|
|
44314
|
-
"data-agents-sdk-resolved-theme":
|
|
44315
|
-
"data-agents-sdk-theme":
|
|
44321
|
+
className: G("agents-sdk relative h-full !min-h-0 min-h-0 overflow-hidden bg-background text-foreground", l !== "inherit" && c === "dark" && "dark"),
|
|
44322
|
+
"data-agents-sdk-resolved-theme": c,
|
|
44323
|
+
"data-agents-sdk-theme": l,
|
|
44316
44324
|
defaultOpen: n,
|
|
44317
44325
|
children: /* @__PURE__ */ H(Ze, { children: [/* @__PURE__ */ V(uy, {
|
|
44318
44326
|
currentConversationTitle: e,
|
|
44319
44327
|
currentUserId: t,
|
|
44320
44328
|
onActiveChatTitleChange: r,
|
|
44321
|
-
|
|
44322
|
-
|
|
44329
|
+
renderSidebarChat: i,
|
|
44330
|
+
sidebarActions: a,
|
|
44331
|
+
startNewChat: o
|
|
44323
44332
|
}), /* @__PURE__ */ H(Zg, {
|
|
44324
44333
|
className: "min-h-0 min-w-0 overflow-hidden",
|
|
44325
44334
|
children: [/* @__PURE__ */ V(fy, {
|
|
44326
|
-
startNewChat:
|
|
44327
|
-
title:
|
|
44335
|
+
startNewChat: o,
|
|
44336
|
+
title: s
|
|
44328
44337
|
}), /* @__PURE__ */ V("div", {
|
|
44329
44338
|
className: "min-h-0 flex-1",
|
|
44330
44339
|
children: /* @__PURE__ */ V(L, {})
|
|
@@ -44333,44 +44342,46 @@ function ly({ currentConversationTitle: e, currentUserId: t, defaultSidebarOpen:
|
|
|
44333
44342
|
})
|
|
44334
44343
|
});
|
|
44335
44344
|
}
|
|
44336
|
-
function uy({ currentConversationTitle: e, currentUserId: t, onActiveChatTitleChange: n,
|
|
44337
|
-
let { isMobile:
|
|
44345
|
+
function uy({ currentConversationTitle: e, currentUserId: t, onActiveChatTitleChange: n, renderSidebarChat: r, sidebarActions: i, startNewChat: a }) {
|
|
44346
|
+
let { isMobile: o, open: s, setOpen: c } = Kg(), [l, u] = N(!1), d = ry(t);
|
|
44338
44347
|
T(() => {
|
|
44339
|
-
if (!
|
|
44348
|
+
if (!l) return;
|
|
44340
44349
|
let e = window.requestAnimationFrame(() => {
|
|
44341
|
-
|
|
44350
|
+
u(!1);
|
|
44342
44351
|
});
|
|
44343
44352
|
return () => window.cancelAnimationFrame(e);
|
|
44344
|
-
}, [
|
|
44345
|
-
let
|
|
44346
|
-
|
|
44353
|
+
}, [l]);
|
|
44354
|
+
let f = () => {
|
|
44355
|
+
u(!0), c(!0);
|
|
44347
44356
|
};
|
|
44348
|
-
if (
|
|
44357
|
+
if (o) return /* @__PURE__ */ V(Jg, {
|
|
44349
44358
|
className: "border-sidebar-border",
|
|
44350
44359
|
collapsible: "offcanvas",
|
|
44351
44360
|
children: /* @__PURE__ */ V(dy, {
|
|
44352
|
-
historyState:
|
|
44361
|
+
historyState: d,
|
|
44353
44362
|
mode: "mobile",
|
|
44354
44363
|
onActiveChatTitleChange: n,
|
|
44355
|
-
|
|
44356
|
-
|
|
44364
|
+
renderSidebarChat: r,
|
|
44365
|
+
sidebarActions: i,
|
|
44366
|
+
startNewChat: a
|
|
44357
44367
|
})
|
|
44358
44368
|
});
|
|
44359
|
-
if (
|
|
44369
|
+
if (s) return /* @__PURE__ */ V("div", {
|
|
44360
44370
|
className: "agents-chat-sidebar-docked-slot",
|
|
44361
|
-
"data-sidebar-transition":
|
|
44371
|
+
"data-sidebar-transition": l ? "none" : void 0,
|
|
44362
44372
|
children: /* @__PURE__ */ V(dy, {
|
|
44363
|
-
historyState:
|
|
44373
|
+
historyState: d,
|
|
44364
44374
|
mode: "docked",
|
|
44365
44375
|
onActiveChatTitleChange: n,
|
|
44366
|
-
|
|
44367
|
-
|
|
44376
|
+
renderSidebarChat: r,
|
|
44377
|
+
sidebarActions: i,
|
|
44378
|
+
startNewChat: a
|
|
44368
44379
|
})
|
|
44369
44380
|
});
|
|
44370
|
-
let
|
|
44381
|
+
let p = !!e?.trim();
|
|
44371
44382
|
return /* @__PURE__ */ V("div", {
|
|
44372
44383
|
className: "agents-chat-sidebar-hover-slot",
|
|
44373
|
-
"data-sidebar-transition":
|
|
44384
|
+
"data-sidebar-transition": l ? "none" : void 0,
|
|
44374
44385
|
children: /* @__PURE__ */ H("div", {
|
|
44375
44386
|
className: "agents-chat-sidebar-hover-shell",
|
|
44376
44387
|
children: [/* @__PURE__ */ H("div", {
|
|
@@ -44379,23 +44390,24 @@ function uy({ currentConversationTitle: e, currentUserId: t, onActiveChatTitleCh
|
|
|
44379
44390
|
"aria-label": "Open conversation history",
|
|
44380
44391
|
className: "agents-chat-sidebar-hover-button size-9",
|
|
44381
44392
|
"data-testid": "sidebar-hover-trigger-button",
|
|
44382
|
-
onClick:
|
|
44383
|
-
onPointerDown: () =>
|
|
44393
|
+
onClick: f,
|
|
44394
|
+
onPointerDown: () => u(!0),
|
|
44384
44395
|
size: "icon",
|
|
44385
44396
|
type: "button",
|
|
44386
44397
|
variant: "ghost",
|
|
44387
|
-
children: [/* @__PURE__ */ V(xt, { size: 16 }),
|
|
44398
|
+
children: [/* @__PURE__ */ V(xt, { size: 16 }), p ? /* @__PURE__ */ V("span", {
|
|
44388
44399
|
"aria-hidden": "true",
|
|
44389
44400
|
className: "agents-chat-sidebar-hover-badge"
|
|
44390
44401
|
}) : null]
|
|
44391
44402
|
}), /* @__PURE__ */ V("div", {
|
|
44392
44403
|
className: "agents-chat-sidebar-floating-panel",
|
|
44393
44404
|
children: /* @__PURE__ */ V(dy, {
|
|
44394
|
-
historyState:
|
|
44405
|
+
historyState: d,
|
|
44395
44406
|
mode: "floating",
|
|
44396
44407
|
onActiveChatTitleChange: n,
|
|
44397
|
-
|
|
44398
|
-
|
|
44408
|
+
renderSidebarChat: r,
|
|
44409
|
+
sidebarActions: i,
|
|
44410
|
+
startNewChat: a
|
|
44399
44411
|
})
|
|
44400
44412
|
})]
|
|
44401
44413
|
}), /* @__PURE__ */ V(Ng, {
|
|
@@ -44406,7 +44418,7 @@ function uy({ currentConversationTitle: e, currentUserId: t, onActiveChatTitleCh
|
|
|
44406
44418
|
"aria-label": "New conversation",
|
|
44407
44419
|
className: "agents-chat-sidebar-hover-button agents-chat-sidebar-hover-new-chat-button size-9",
|
|
44408
44420
|
"data-testid": "sidebar-hover-new-chat-button",
|
|
44409
|
-
onClick:
|
|
44421
|
+
onClick: a,
|
|
44410
44422
|
size: "icon",
|
|
44411
44423
|
type: "button",
|
|
44412
44424
|
variant: "ghost",
|
|
@@ -44421,22 +44433,23 @@ function uy({ currentConversationTitle: e, currentUserId: t, onActiveChatTitleCh
|
|
|
44421
44433
|
})
|
|
44422
44434
|
});
|
|
44423
44435
|
}
|
|
44424
|
-
function dy({ historyState: e, mode: t, onActiveChatTitleChange: n,
|
|
44436
|
+
function dy({ historyState: e, mode: t, onActiveChatTitleChange: n, renderSidebarChat: r, sidebarActions: i, startNewChat: a }) {
|
|
44425
44437
|
return /* @__PURE__ */ H("div", {
|
|
44426
44438
|
className: G("agents-chat-sidebar-panel flex h-full min-h-0 w-full flex-col overflow-hidden", t === "mobile" && "rounded-none border-0 shadow-none"),
|
|
44427
44439
|
"data-sidebar": "sidebar",
|
|
44428
44440
|
"data-sidebar-mode": t,
|
|
44429
44441
|
children: [t === "floating" ? null : /* @__PURE__ */ H("div", {
|
|
44430
44442
|
className: "agents-chat-sidebar-panel-controls flex h-11 shrink-0 items-center justify-between px-2 pb-1 pt-2",
|
|
44431
|
-
children: [/* @__PURE__ */ V(my, { testId: "sidebar-panel-toggle-button" }), /* @__PURE__ */ V(py, { startNewChat:
|
|
44443
|
+
children: [/* @__PURE__ */ V(my, { testId: "sidebar-panel-toggle-button" }), /* @__PURE__ */ V(py, { startNewChat: a })]
|
|
44432
44444
|
}), /* @__PURE__ */ H(n_, {
|
|
44433
44445
|
className: G("px-2 pb-3", t === "floating" ? "pt-12" : "pt-1"),
|
|
44434
|
-
children: [
|
|
44446
|
+
children: [i ? /* @__PURE__ */ V("div", {
|
|
44435
44447
|
className: "mb-3",
|
|
44436
|
-
children:
|
|
44448
|
+
children: i
|
|
44437
44449
|
}) : null, /* @__PURE__ */ V(ay, {
|
|
44438
44450
|
historyState: e,
|
|
44439
|
-
onActiveChatTitleChange: n
|
|
44451
|
+
onActiveChatTitleChange: n,
|
|
44452
|
+
renderSidebarChat: r
|
|
44440
44453
|
})]
|
|
44441
44454
|
})]
|
|
44442
44455
|
});
|
|
@@ -56627,15 +56640,15 @@ function iB(e, t) {
|
|
|
56627
56640
|
}
|
|
56628
56641
|
return n;
|
|
56629
56642
|
}
|
|
56630
|
-
var aB = ({ addToolApprovalResponse: e, chatId: t, message: n, vote: r, isLoading: i,
|
|
56631
|
-
let [
|
|
56643
|
+
var aB = ({ addToolApprovalResponse: e, chatId: t, message: n, vote: r, isLoading: i, renderMessagePart: a, setMessages: o, regenerate: s, isReadonly: c, requiresScrollPadding: l }) => {
|
|
56644
|
+
let [u, d] = N("view"), f = n.parts?.some((e) => e.type === "text" && e.text?.trim()), p = n.parts?.some((e) => $z(e.type)), m = n.parts.filter((e) => e.type === "file"), h = iB(n.id, n.parts);
|
|
56632
56645
|
return Qe(), /* @__PURE__ */ V("div", {
|
|
56633
56646
|
className: "group/message fade-in w-full animate-in duration-200",
|
|
56634
56647
|
"data-role": n.role,
|
|
56635
56648
|
"data-testid": `message-${n.role}`,
|
|
56636
56649
|
children: /* @__PURE__ */ H("div", {
|
|
56637
56650
|
className: G("flex w-full items-start gap-2 md:gap-3", {
|
|
56638
|
-
"justify-end": n.role === "user" &&
|
|
56651
|
+
"justify-end": n.role === "user" && u !== "edit",
|
|
56639
56652
|
"justify-start": n.role === "assistant"
|
|
56640
56653
|
}),
|
|
56641
56654
|
children: [n.role === "assistant" && /* @__PURE__ */ V("div", {
|
|
@@ -56643,28 +56656,34 @@ var aB = ({ addToolApprovalResponse: e, chatId: t, message: n, vote: r, isLoadin
|
|
|
56643
56656
|
children: /* @__PURE__ */ V(gt, { size: 14 })
|
|
56644
56657
|
}), /* @__PURE__ */ H("div", {
|
|
56645
56658
|
className: G("flex flex-col", {
|
|
56646
|
-
"gap-2 md:gap-4":
|
|
56647
|
-
"w-full": n.role === "assistant" && (
|
|
56648
|
-
"max-w-[80%]": n.role === "user" &&
|
|
56659
|
+
"gap-2 md:gap-4": f || p,
|
|
56660
|
+
"w-full": n.role === "assistant" && (f || p) || u === "edit",
|
|
56661
|
+
"max-w-[80%]": n.role === "user" && u !== "edit"
|
|
56649
56662
|
}),
|
|
56650
56663
|
children: [
|
|
56651
|
-
|
|
56664
|
+
m.length > 0 && /* @__PURE__ */ V("div", {
|
|
56652
56665
|
className: "flex flex-row justify-end gap-2",
|
|
56653
56666
|
"data-testid": "message-attachments",
|
|
56654
|
-
children:
|
|
56667
|
+
children: m.map((e) => /* @__PURE__ */ V(Wz, { attachment: {
|
|
56655
56668
|
name: e.filename ?? "file",
|
|
56656
56669
|
contentType: e.mediaType,
|
|
56657
56670
|
url: e.url
|
|
56658
56671
|
} }, e.url))
|
|
56659
56672
|
}),
|
|
56660
|
-
|
|
56661
|
-
let { type:
|
|
56662
|
-
|
|
56673
|
+
h.map(({ part: t, key: r }) => {
|
|
56674
|
+
let { type: l } = t, f = a?.({
|
|
56675
|
+
isLoading: i,
|
|
56676
|
+
isReadonly: c,
|
|
56677
|
+
message: n,
|
|
56678
|
+
part: t
|
|
56679
|
+
});
|
|
56680
|
+
if (f !== void 0) return /* @__PURE__ */ V(_, { children: f }, r);
|
|
56681
|
+
if (l === "reasoning" && tB(t)) return /* @__PURE__ */ V(Uz, {
|
|
56663
56682
|
isStreaming: t.state === "streaming",
|
|
56664
56683
|
reasoning: t.text ?? ""
|
|
56665
56684
|
}, r);
|
|
56666
|
-
if (
|
|
56667
|
-
if (
|
|
56685
|
+
if (l === "text") {
|
|
56686
|
+
if (u === "view") return /* @__PURE__ */ V("div", { children: /* @__PURE__ */ V(Oz, {
|
|
56668
56687
|
className: G({
|
|
56669
56688
|
"wrap-break-word w-fit rounded-2xl bg-primary px-3 py-2 text-left text-primary-foreground": n.role === "user",
|
|
56670
56689
|
"bg-transparent px-0 py-0 text-left": n.role === "assistant"
|
|
@@ -56672,20 +56691,20 @@ var aB = ({ addToolApprovalResponse: e, chatId: t, message: n, vote: r, isLoadin
|
|
|
56672
56691
|
"data-testid": "message-content",
|
|
56673
56692
|
children: /* @__PURE__ */ V(qL, { children: Sm(t.text) })
|
|
56674
56693
|
}) }, r);
|
|
56675
|
-
if (
|
|
56694
|
+
if (u === "edit") return /* @__PURE__ */ H("div", {
|
|
56676
56695
|
className: "flex w-full flex-row items-start gap-3",
|
|
56677
56696
|
children: [/* @__PURE__ */ V("div", { className: "size-8" }), /* @__PURE__ */ V("div", {
|
|
56678
56697
|
className: "min-w-0 flex-1",
|
|
56679
56698
|
children: /* @__PURE__ */ V(Pz, {
|
|
56680
56699
|
message: n,
|
|
56681
|
-
regenerate:
|
|
56682
|
-
setMessages:
|
|
56683
|
-
setMode:
|
|
56700
|
+
regenerate: s,
|
|
56701
|
+
setMessages: o,
|
|
56702
|
+
setMode: d
|
|
56684
56703
|
}, n.id)
|
|
56685
56704
|
})]
|
|
56686
56705
|
}, r);
|
|
56687
56706
|
}
|
|
56688
|
-
if (
|
|
56707
|
+
if (l === "tool-getWeather") {
|
|
56689
56708
|
let { toolCallId: n, state: r } = t, i = t.approval?.id, a = r === "output-denied" || r === "approval-responded" && t.approval?.approved === !1, o = "w-[min(100%,450px)]";
|
|
56690
56709
|
return r === "output-available" ? /* @__PURE__ */ V("div", {
|
|
56691
56710
|
className: o,
|
|
@@ -56729,17 +56748,17 @@ var aB = ({ addToolApprovalResponse: e, chatId: t, message: n, vote: r, isLoadin
|
|
|
56729
56748
|
})
|
|
56730
56749
|
}, n);
|
|
56731
56750
|
}
|
|
56732
|
-
if (
|
|
56751
|
+
if (l === "tool-createDocument") {
|
|
56733
56752
|
let { toolCallId: e } = t, n = t.output, r = rB(n) ? n : void 0;
|
|
56734
56753
|
return Qz(n) && "error" in n ? /* @__PURE__ */ H("div", {
|
|
56735
56754
|
className: "rounded-lg border border-destructive/25 bg-destructive/10 p-4 text-destructive",
|
|
56736
56755
|
children: ["Error creating document: ", String(n.error)]
|
|
56737
56756
|
}, e) : /* @__PURE__ */ V(fz, {
|
|
56738
|
-
isReadonly:
|
|
56757
|
+
isReadonly: c,
|
|
56739
56758
|
result: r
|
|
56740
56759
|
}, e);
|
|
56741
56760
|
}
|
|
56742
|
-
if (
|
|
56761
|
+
if (l === "tool-updateDocument") {
|
|
56743
56762
|
let { toolCallId: e } = t, n = t.output, r = rB(n) ? n : void 0;
|
|
56744
56763
|
return Qz(n) && "error" in n ? /* @__PURE__ */ H("div", {
|
|
56745
56764
|
className: "rounded-lg border border-destructive/25 bg-destructive/10 p-4 text-destructive",
|
|
@@ -56751,12 +56770,12 @@ var aB = ({ addToolApprovalResponse: e, chatId: t, message: n, vote: r, isLoadin
|
|
|
56751
56770
|
...r,
|
|
56752
56771
|
isUpdate: !0
|
|
56753
56772
|
} : { isUpdate: !0 },
|
|
56754
|
-
isReadonly:
|
|
56773
|
+
isReadonly: c,
|
|
56755
56774
|
result: r
|
|
56756
56775
|
})
|
|
56757
56776
|
}, e);
|
|
56758
56777
|
}
|
|
56759
|
-
if (
|
|
56778
|
+
if (l === "tool-editDocument") {
|
|
56760
56779
|
let { toolCallId: e } = t, n = t.output, r = rB(n) ? n : void 0;
|
|
56761
56780
|
return Qz(n) && "error" in n ? /* @__PURE__ */ H("div", {
|
|
56762
56781
|
className: "rounded-lg border border-destructive/25 bg-destructive/10 p-4 text-destructive",
|
|
@@ -56768,12 +56787,12 @@ var aB = ({ addToolApprovalResponse: e, chatId: t, message: n, vote: r, isLoadin
|
|
|
56768
56787
|
...r,
|
|
56769
56788
|
isUpdate: !0
|
|
56770
56789
|
} : { isUpdate: !0 },
|
|
56771
|
-
isReadonly:
|
|
56790
|
+
isReadonly: c,
|
|
56772
56791
|
result: r
|
|
56773
56792
|
})
|
|
56774
56793
|
}, e);
|
|
56775
56794
|
}
|
|
56776
|
-
if (
|
|
56795
|
+
if (l === "tool-requestSuggestions") {
|
|
56777
56796
|
let { toolCallId: e, state: n } = t;
|
|
56778
56797
|
return /* @__PURE__ */ H(ez, {
|
|
56779
56798
|
defaultOpen: !0,
|
|
@@ -56786,34 +56805,34 @@ var aB = ({ addToolApprovalResponse: e, chatId: t, message: n, vote: r, isLoadin
|
|
|
56786
56805
|
className: "rounded border p-2 text-destructive",
|
|
56787
56806
|
children: ["Error: ", String(t.output.error)]
|
|
56788
56807
|
}) : /* @__PURE__ */ V(uz, {
|
|
56789
|
-
isReadonly:
|
|
56808
|
+
isReadonly: c,
|
|
56790
56809
|
result: t.output,
|
|
56791
56810
|
type: "request-suggestions"
|
|
56792
56811
|
})
|
|
56793
56812
|
})] })]
|
|
56794
56813
|
}, e);
|
|
56795
56814
|
}
|
|
56796
|
-
if ($z(
|
|
56797
|
-
let n = t,
|
|
56815
|
+
if ($z(l)) {
|
|
56816
|
+
let n = t, i = n.toolCallId ?? r, a = n.state, o = n.approval?.id, s = typeof n.title == "string" ? n.title : void 0, c = typeof n.toolName == "string" ? n.toolName : "tool", u = n.state === "output-denied" || n.state === "approval-responded" && n.approval?.approved === !1;
|
|
56798
56817
|
return /* @__PURE__ */ V("div", {
|
|
56799
56818
|
className: "w-[min(100%,450px)]",
|
|
56800
56819
|
children: /* @__PURE__ */ H(ez, {
|
|
56801
56820
|
className: "w-full",
|
|
56802
56821
|
defaultOpen: !0,
|
|
56803
|
-
children: [
|
|
56804
|
-
state: u ? "output-denied" :
|
|
56805
|
-
title:
|
|
56806
|
-
toolName:
|
|
56822
|
+
children: [l === "dynamic-tool" ? /* @__PURE__ */ V(iz, {
|
|
56823
|
+
state: u ? "output-denied" : a,
|
|
56824
|
+
title: s,
|
|
56825
|
+
toolName: c,
|
|
56807
56826
|
type: "dynamic-tool"
|
|
56808
56827
|
}) : /* @__PURE__ */ V(iz, {
|
|
56809
|
-
state: u ? "output-denied" :
|
|
56810
|
-
title:
|
|
56811
|
-
type:
|
|
56828
|
+
state: u ? "output-denied" : a,
|
|
56829
|
+
title: s,
|
|
56830
|
+
type: l
|
|
56812
56831
|
}), /* @__PURE__ */ H(az, { children: [
|
|
56813
56832
|
n.input !== void 0 && (n.state === "input-available" || n.state === "approval-requested" || n.state === "approval-responded" || n.state === "output-available" || n.state === "output-error" || n.state === "output-denied") && /* @__PURE__ */ V(oz, { input: Zz(n.input) }),
|
|
56814
|
-
n.state === "approval-requested" &&
|
|
56833
|
+
n.state === "approval-requested" && o && /* @__PURE__ */ V(eB, {
|
|
56815
56834
|
addToolApprovalResponse: e,
|
|
56816
|
-
approvalId:
|
|
56835
|
+
approvalId: o,
|
|
56817
56836
|
denyReason: "User denied tool call"
|
|
56818
56837
|
}),
|
|
56819
56838
|
u && /* @__PURE__ */ V("div", {
|
|
@@ -56826,15 +56845,15 @@ var aB = ({ addToolApprovalResponse: e, chatId: t, message: n, vote: r, isLoadin
|
|
|
56826
56845
|
})
|
|
56827
56846
|
] })]
|
|
56828
56847
|
})
|
|
56829
|
-
},
|
|
56848
|
+
}, i);
|
|
56830
56849
|
}
|
|
56831
56850
|
return null;
|
|
56832
56851
|
}),
|
|
56833
|
-
!
|
|
56852
|
+
!c && /* @__PURE__ */ V(Mz, {
|
|
56834
56853
|
chatId: t,
|
|
56835
56854
|
isLoading: i,
|
|
56836
56855
|
message: n,
|
|
56837
|
-
setMode:
|
|
56856
|
+
setMode: d,
|
|
56838
56857
|
vote: r
|
|
56839
56858
|
}, `action-${n.id}`)
|
|
56840
56859
|
]
|
|
@@ -56883,38 +56902,39 @@ var aB = ({ addToolApprovalResponse: e, chatId: t, message: n, vote: r, isLoadin
|
|
|
56883
56902
|
});
|
|
56884
56903
|
//#endregion
|
|
56885
56904
|
//#region src/components/artifact-messages.tsx
|
|
56886
|
-
function sB({ addToolApprovalResponse: e, chatId: t, status: n, votes: r, messages: i,
|
|
56887
|
-
let { containerRef:
|
|
56905
|
+
function sB({ addToolApprovalResponse: e, chatId: t, status: n, votes: r, messages: i, renderMessagePart: a, setMessages: o, regenerate: s, isReadonly: c }) {
|
|
56906
|
+
let { containerRef: l, endRef: u, onViewportEnter: d, onViewportLeave: f, hasSentMessage: p } = CR({ status: n });
|
|
56888
56907
|
return /* @__PURE__ */ H("div", {
|
|
56889
56908
|
className: "flex h-full flex-col items-center gap-4 overflow-y-scroll px-4 pt-20",
|
|
56890
|
-
ref:
|
|
56909
|
+
ref: l,
|
|
56891
56910
|
children: [
|
|
56892
|
-
i.map((
|
|
56911
|
+
i.map((l, u) => /* @__PURE__ */ V(aB, {
|
|
56893
56912
|
addToolApprovalResponse: e,
|
|
56894
56913
|
chatId: t,
|
|
56895
|
-
isLoading: n === "streaming" &&
|
|
56896
|
-
isReadonly:
|
|
56897
|
-
message:
|
|
56898
|
-
|
|
56899
|
-
|
|
56900
|
-
|
|
56901
|
-
|
|
56902
|
-
|
|
56914
|
+
isLoading: n === "streaming" && u === i.length - 1,
|
|
56915
|
+
isReadonly: c,
|
|
56916
|
+
message: l,
|
|
56917
|
+
renderMessagePart: a,
|
|
56918
|
+
regenerate: s,
|
|
56919
|
+
requiresScrollPadding: p && u === i.length - 1,
|
|
56920
|
+
setMessages: o,
|
|
56921
|
+
vote: r ? r.find((e) => e.messageId === l.id) : void 0
|
|
56922
|
+
}, l.id)),
|
|
56903
56923
|
/* @__PURE__ */ V($j, {
|
|
56904
56924
|
mode: "wait",
|
|
56905
56925
|
children: n === "submitted" && !i.some((e) => e.parts?.some((e) => "state" in e && e.state === "approval-responded")) && /* @__PURE__ */ V(oB, {}, "thinking")
|
|
56906
56926
|
}),
|
|
56907
56927
|
/* @__PURE__ */ V(KN.div, {
|
|
56908
56928
|
className: "min-h-[24px] min-w-[24px] shrink-0",
|
|
56909
|
-
onViewportEnter:
|
|
56910
|
-
onViewportLeave:
|
|
56911
|
-
ref:
|
|
56929
|
+
onViewportEnter: d,
|
|
56930
|
+
onViewportLeave: f,
|
|
56931
|
+
ref: u
|
|
56912
56932
|
})
|
|
56913
56933
|
]
|
|
56914
56934
|
});
|
|
56915
56935
|
}
|
|
56916
56936
|
function cB(e, t) {
|
|
56917
|
-
return e.artifactStatus === "streaming" && t.artifactStatus === "streaming" ? !0 : !(e.status !== t.status || e.status && t.status || e.messages.length !== t.messages.length || !ue(e.votes, t.votes));
|
|
56937
|
+
return e.artifactStatus === "streaming" && t.artifactStatus === "streaming" ? !0 : !(e.status !== t.status || e.status && t.status || e.messages.length !== t.messages.length || !ue(e.votes, t.votes) || e.renderMessagePart !== t.renderMessagePart);
|
|
56918
56938
|
}
|
|
56919
56939
|
var lB = S(sB, cB), uB = yh, dB = Vp, fB = p.forwardRef(({ className: e, ...t }, n) => {
|
|
56920
56940
|
let { resolvedTheme: r, theme: i } = Mm();
|
|
@@ -59631,37 +59651,37 @@ function AU(e, t) {
|
|
|
59631
59651
|
let r = DU(t.scrollArea);
|
|
59632
59652
|
r && (r.scrollTop = 0);
|
|
59633
59653
|
}
|
|
59634
|
-
function jU({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments: a, setAttachments: o, messages: s, setMessages: c, sendMessage: l, className: u,
|
|
59635
|
-
let
|
|
59654
|
+
function jU({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments: a, setAttachments: o, messages: s, setMessages: c, sendMessage: l, className: u, chatModels: d, defaultChatModel: p, selectedModelId: m, onModelChange: h, openaiReasoningEffort: g = f, onOpenAIReasoningEffortChange: _, suggestedActions: v }) {
|
|
59655
|
+
let y = M(null), b = M(null), [x, S] = N(TU), { width: w } = LP(), { getChatPath: E } = Ue();
|
|
59636
59656
|
T(() => {
|
|
59637
|
-
kU(
|
|
59638
|
-
scrollArea:
|
|
59639
|
-
setScrollAreaHeight:
|
|
59657
|
+
kU(y.current, {
|
|
59658
|
+
scrollArea: b.current,
|
|
59659
|
+
setScrollAreaHeight: S
|
|
59640
59660
|
});
|
|
59641
|
-
}, [t,
|
|
59642
|
-
let
|
|
59661
|
+
}, [t, w]);
|
|
59662
|
+
let D = M(!1);
|
|
59643
59663
|
T(() => {
|
|
59644
|
-
if (!
|
|
59664
|
+
if (!D.current && w) {
|
|
59645
59665
|
let e = setTimeout(() => {
|
|
59646
|
-
|
|
59666
|
+
y.current?.focus(), D.current = !0;
|
|
59647
59667
|
}, 100);
|
|
59648
59668
|
return () => clearTimeout(e);
|
|
59649
59669
|
}
|
|
59650
|
-
}, [
|
|
59651
|
-
let [
|
|
59670
|
+
}, [w]);
|
|
59671
|
+
let [O, k] = MP("input", "");
|
|
59652
59672
|
T(() => {
|
|
59653
|
-
|
|
59654
|
-
}, [
|
|
59655
|
-
|
|
59656
|
-
}, [t,
|
|
59657
|
-
let
|
|
59673
|
+
y.current && n(y.current.value || O || "");
|
|
59674
|
+
}, [O, n]), T(() => {
|
|
59675
|
+
k(t);
|
|
59676
|
+
}, [t, k]);
|
|
59677
|
+
let A = (e) => {
|
|
59658
59678
|
n(e.target.value), kU(e.currentTarget, {
|
|
59659
|
-
scrollArea:
|
|
59660
|
-
setScrollAreaHeight:
|
|
59679
|
+
scrollArea: b.current,
|
|
59680
|
+
setScrollAreaHeight: S
|
|
59661
59681
|
});
|
|
59662
|
-
},
|
|
59682
|
+
}, j = M(null), [P, F] = N([]), I = C(() => {
|
|
59663
59683
|
let r = mm();
|
|
59664
|
-
window.history.pushState({}, "", vm(
|
|
59684
|
+
window.history.pushState({}, "", vm(E(e), r)), l({
|
|
59665
59685
|
role: "user",
|
|
59666
59686
|
parts: [...a.map((e) => ({
|
|
59667
59687
|
type: "file",
|
|
@@ -59672,21 +59692,21 @@ function jU({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
59672
59692
|
type: "text",
|
|
59673
59693
|
text: t
|
|
59674
59694
|
}]
|
|
59675
|
-
}), o([]),
|
|
59676
|
-
scrollArea:
|
|
59677
|
-
setScrollAreaHeight:
|
|
59678
|
-
}),
|
|
59695
|
+
}), o([]), k(""), n(""), AU(y.current, {
|
|
59696
|
+
scrollArea: b.current,
|
|
59697
|
+
setScrollAreaHeight: S
|
|
59698
|
+
}), w && w > 768 && y.current?.focus();
|
|
59679
59699
|
}, [
|
|
59680
59700
|
t,
|
|
59681
59701
|
n,
|
|
59682
59702
|
a,
|
|
59683
59703
|
l,
|
|
59684
59704
|
o,
|
|
59685
|
-
|
|
59686
|
-
|
|
59705
|
+
k,
|
|
59706
|
+
w,
|
|
59687
59707
|
e,
|
|
59688
|
-
|
|
59689
|
-
]),
|
|
59708
|
+
E
|
|
59709
|
+
]), L = C(async (e) => {
|
|
59690
59710
|
try {
|
|
59691
59711
|
let t = mm(), n = await fetch("/api/rb/file-uploads", {
|
|
59692
59712
|
method: "POST",
|
|
@@ -59747,49 +59767,49 @@ function jU({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
59747
59767
|
} catch {
|
|
59748
59768
|
U.error("Failed to upload file, please try again!");
|
|
59749
59769
|
}
|
|
59750
|
-
}, []),
|
|
59770
|
+
}, []), R = C(async (e) => {
|
|
59751
59771
|
let t = Array.from(e.target.files || []);
|
|
59752
|
-
|
|
59772
|
+
F(t.map((e) => e.name));
|
|
59753
59773
|
try {
|
|
59754
|
-
let e = t.map((e) =>
|
|
59774
|
+
let e = t.map((e) => L(e)), n = (await Promise.all(e)).filter((e) => e !== void 0);
|
|
59755
59775
|
o((e) => [...e, ...n]);
|
|
59756
59776
|
} catch (e) {
|
|
59757
59777
|
console.error("Error uploading files!", e);
|
|
59758
59778
|
} finally {
|
|
59759
|
-
|
|
59779
|
+
F([]);
|
|
59760
59780
|
}
|
|
59761
|
-
}, [o,
|
|
59781
|
+
}, [o, L]), z = C(async (e) => {
|
|
59762
59782
|
let t = e.clipboardData?.items;
|
|
59763
59783
|
if (!t) return;
|
|
59764
59784
|
let n = Array.from(t).filter((e) => e.type.startsWith("image/"));
|
|
59765
59785
|
if (n.length !== 0) {
|
|
59766
|
-
e.preventDefault(),
|
|
59786
|
+
e.preventDefault(), F((e) => [...e, "Pasted image"]);
|
|
59767
59787
|
try {
|
|
59768
|
-
let e = n.map((e) => e.getAsFile()).filter((e) => e !== null).map((e) =>
|
|
59788
|
+
let e = n.map((e) => e.getAsFile()).filter((e) => e !== null).map((e) => L(e)), t = (await Promise.all(e)).filter((e) => e !== void 0 && e.url !== void 0 && e.contentType !== void 0);
|
|
59769
59789
|
o((e) => [...e, ...t]);
|
|
59770
59790
|
} catch (e) {
|
|
59771
59791
|
console.error("Error uploading pasted images:", e), U.error("Failed to upload pasted image(s)");
|
|
59772
59792
|
} finally {
|
|
59773
|
-
|
|
59793
|
+
F([]);
|
|
59774
59794
|
}
|
|
59775
59795
|
}
|
|
59776
|
-
}, [o,
|
|
59796
|
+
}, [o, L]);
|
|
59777
59797
|
return T(() => {
|
|
59778
|
-
let e =
|
|
59779
|
-
if (e) return e.addEventListener("paste",
|
|
59780
|
-
}, [
|
|
59798
|
+
let e = y.current;
|
|
59799
|
+
if (e) return e.addEventListener("paste", z), () => e.removeEventListener("paste", z);
|
|
59800
|
+
}, [z]), /* @__PURE__ */ H("div", {
|
|
59781
59801
|
className: G("relative flex w-full flex-col gap-4", u),
|
|
59782
59802
|
children: [
|
|
59783
|
-
s.length === 0 && a.length === 0 &&
|
|
59803
|
+
s.length === 0 && a.length === 0 && P.length === 0 && v && v.length > 0 && /* @__PURE__ */ V(SU, {
|
|
59784
59804
|
chatId: e,
|
|
59785
59805
|
sendMessage: l,
|
|
59786
|
-
suggestedActions:
|
|
59806
|
+
suggestedActions: v
|
|
59787
59807
|
}),
|
|
59788
59808
|
/* @__PURE__ */ V("input", {
|
|
59789
59809
|
className: "-top-4 -left-4 pointer-events-none fixed size-0.5 opacity-0",
|
|
59790
59810
|
multiple: !0,
|
|
59791
|
-
onChange:
|
|
59792
|
-
ref:
|
|
59811
|
+
onChange: R,
|
|
59812
|
+
ref: j,
|
|
59793
59813
|
tabIndex: -1,
|
|
59794
59814
|
type: "file"
|
|
59795
59815
|
}),
|
|
@@ -59797,23 +59817,23 @@ function jU({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
59797
59817
|
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",
|
|
59798
59818
|
onSubmit: (e) => {
|
|
59799
59819
|
if (e.preventDefault(), !(!t.trim() && a.length === 0)) {
|
|
59800
|
-
if (
|
|
59820
|
+
if (P.length > 0) {
|
|
59801
59821
|
U.error("Please wait for uploads to finish!");
|
|
59802
59822
|
return;
|
|
59803
59823
|
}
|
|
59804
|
-
r === "ready" ?
|
|
59824
|
+
r === "ready" ? I() : U.error("Please wait for the model to finish its response!");
|
|
59805
59825
|
}
|
|
59806
59826
|
},
|
|
59807
59827
|
children: [
|
|
59808
|
-
(a.length > 0 ||
|
|
59828
|
+
(a.length > 0 || P.length > 0) && /* @__PURE__ */ H("div", {
|
|
59809
59829
|
className: "flex flex-row items-end gap-2 overflow-x-scroll",
|
|
59810
59830
|
"data-testid": "attachments-preview",
|
|
59811
59831
|
children: [a.map((e) => /* @__PURE__ */ V(Wz, {
|
|
59812
59832
|
attachment: e,
|
|
59813
59833
|
onRemove: () => {
|
|
59814
|
-
o((t) => t.filter((t) => t.url !== e.url)),
|
|
59834
|
+
o((t) => t.filter((t) => t.url !== e.url)), j.current && (j.current.value = "");
|
|
59815
59835
|
}
|
|
59816
|
-
}, e.url)),
|
|
59836
|
+
}, e.url)), P.map((e) => /* @__PURE__ */ V(Wz, {
|
|
59817
59837
|
attachment: {
|
|
59818
59838
|
url: "",
|
|
59819
59839
|
name: e,
|
|
@@ -59826,15 +59846,15 @@ function jU({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
59826
59846
|
className: "flex flex-row items-start gap-1 sm:gap-2",
|
|
59827
59847
|
children: /* @__PURE__ */ V(wV, {
|
|
59828
59848
|
className: "grow rounded-md",
|
|
59829
|
-
ref:
|
|
59830
|
-
style: { height:
|
|
59849
|
+
ref: b,
|
|
59850
|
+
style: { height: x },
|
|
59831
59851
|
children: /* @__PURE__ */ V(gU, {
|
|
59832
59852
|
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",
|
|
59833
59853
|
"data-testid": "multimodal-input",
|
|
59834
59854
|
disableAutoResize: !0,
|
|
59835
|
-
onChange:
|
|
59855
|
+
onChange: A,
|
|
59836
59856
|
placeholder: "Send a message...",
|
|
59837
|
-
ref:
|
|
59857
|
+
ref: y,
|
|
59838
59858
|
rows: 1,
|
|
59839
59859
|
value: t
|
|
59840
59860
|
})
|
|
@@ -59846,22 +59866,24 @@ function jU({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
59846
59866
|
className: "gap-0 sm:gap-0.5",
|
|
59847
59867
|
children: [
|
|
59848
59868
|
/* @__PURE__ */ V(PU, {
|
|
59849
|
-
fileInputRef:
|
|
59850
|
-
selectedModelId:
|
|
59869
|
+
fileInputRef: j,
|
|
59870
|
+
selectedModelId: m,
|
|
59851
59871
|
status: r
|
|
59852
59872
|
}),
|
|
59853
59873
|
/* @__PURE__ */ V(IU, {
|
|
59854
|
-
focusTargetRef:
|
|
59874
|
+
focusTargetRef: y,
|
|
59875
|
+
chatModels: d,
|
|
59876
|
+
defaultChatModel: p,
|
|
59855
59877
|
idScope: e,
|
|
59856
|
-
onModelChange:
|
|
59857
|
-
selectedModelId:
|
|
59878
|
+
onModelChange: h,
|
|
59879
|
+
selectedModelId: m
|
|
59858
59880
|
}),
|
|
59859
59881
|
/* @__PURE__ */ V(RU, {
|
|
59860
59882
|
disabled: r !== "ready",
|
|
59861
59883
|
idScope: e,
|
|
59862
|
-
onChange:
|
|
59863
|
-
selectedModelId:
|
|
59864
|
-
value:
|
|
59884
|
+
onChange: _,
|
|
59885
|
+
selectedModelId: m,
|
|
59886
|
+
value: g
|
|
59865
59887
|
})
|
|
59866
59888
|
]
|
|
59867
59889
|
}), r === "submitted" || r === "streaming" ? /* @__PURE__ */ V(BU, {
|
|
@@ -59870,7 +59892,7 @@ function jU({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
59870
59892
|
}) : /* @__PURE__ */ V(yU, {
|
|
59871
59893
|
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",
|
|
59872
59894
|
"data-testid": "send-button",
|
|
59873
|
-
disabled: !t.trim() ||
|
|
59895
|
+
disabled: !t.trim() || P.length > 0,
|
|
59874
59896
|
status: r,
|
|
59875
59897
|
children: /* @__PURE__ */ V(rt, { size: 14 })
|
|
59876
59898
|
})]
|
|
@@ -59880,7 +59902,7 @@ function jU({ chatId: e, input: t, setInput: n, status: r, stop: i, attachments:
|
|
|
59880
59902
|
]
|
|
59881
59903
|
});
|
|
59882
59904
|
}
|
|
59883
|
-
var MU = S(jU, (e, t) => !(e.input !== t.input || e.status !== t.status || !ue(e.attachments, t.attachments) || e.selectedModelId !== t.selectedModelId || e.openaiReasoningEffort !== t.openaiReasoningEffort || !ue(e.suggestedActions, t.suggestedActions)));
|
|
59905
|
+
var MU = S(jU, (e, t) => !(e.input !== t.input || e.status !== t.status || !ue(e.attachments, t.attachments) || e.selectedModelId !== t.selectedModelId || e.openaiReasoningEffort !== t.openaiReasoningEffort || !ue(e.suggestedActions, t.suggestedActions) || !ue(e.chatModels, t.chatModels) || e.defaultChatModel !== t.defaultChatModel));
|
|
59884
59906
|
function NU({ fileInputRef: e, status: t, selectedModelId: n }) {
|
|
59885
59907
|
let r = n.includes("reasoning") || n.includes("think");
|
|
59886
59908
|
return /* @__PURE__ */ V(Em, {
|
|
@@ -59901,8 +59923,8 @@ function NU({ fileInputRef: e, status: t, selectedModelId: n }) {
|
|
|
59901
59923
|
});
|
|
59902
59924
|
}
|
|
59903
59925
|
var PU = S(NU);
|
|
59904
|
-
function FU({ focusTargetRef: e,
|
|
59905
|
-
let [
|
|
59926
|
+
function FU({ focusTargetRef: e, chatModels: t, defaultChatModel: n, idScope: r, selectedModelId: i, onModelChange: o }) {
|
|
59927
|
+
let [c, l] = N(!1), u = M(!1), d = wU(r), f = t && t.length > 0 ? t : s, p = a(f), m = f.find((e) => e.id === i) ?? f.find((e) => e.id === n) ?? f[0] ?? s[0], [h] = m.id.split("/"), g = {
|
|
59906
59928
|
anthropic: "Anthropic",
|
|
59907
59929
|
openai: "OpenAI",
|
|
59908
59930
|
google: "Google",
|
|
@@ -59910,34 +59932,34 @@ function FU({ focusTargetRef: e, idScope: t, selectedModelId: n, onModelChange:
|
|
|
59910
59932
|
reasoning: "Reasoning"
|
|
59911
59933
|
};
|
|
59912
59934
|
return /* @__PURE__ */ H(NB, {
|
|
59913
|
-
onOpenChange:
|
|
59914
|
-
open:
|
|
59935
|
+
onOpenChange: l,
|
|
59936
|
+
open: c,
|
|
59915
59937
|
children: [/* @__PURE__ */ V(PB, {
|
|
59916
59938
|
asChild: !0,
|
|
59917
59939
|
children: /* @__PURE__ */ H(Em, {
|
|
59918
59940
|
className: "agents-chat-model-selector-trigger h-8 w-auto max-w-[18rem] justify-start gap-2 px-2",
|
|
59919
|
-
id: `agents-sdk-model-selector-${
|
|
59941
|
+
id: `agents-sdk-model-selector-${d}`,
|
|
59920
59942
|
variant: "ghost",
|
|
59921
|
-
children: [
|
|
59943
|
+
children: [h && /* @__PURE__ */ V(BB, { provider: h }), /* @__PURE__ */ V(VB, {
|
|
59922
59944
|
className: "min-w-0 max-w-[14rem] flex-initial",
|
|
59923
|
-
children:
|
|
59945
|
+
children: m.name
|
|
59924
59946
|
})]
|
|
59925
59947
|
})
|
|
59926
59948
|
}), /* @__PURE__ */ H(FB, {
|
|
59927
|
-
finalFocus: () =>
|
|
59928
|
-
children: [/* @__PURE__ */ V(IB, { placeholder: "Search models..." }), /* @__PURE__ */ V(LB, { children: Object.entries(
|
|
59929
|
-
heading:
|
|
59949
|
+
finalFocus: () => u.current ? (u.current = !1, e.current) : !0,
|
|
59950
|
+
children: [/* @__PURE__ */ V(IB, { placeholder: "Search models..." }), /* @__PURE__ */ V(LB, { children: Object.entries(p).map(([e, t]) => /* @__PURE__ */ V(RB, {
|
|
59951
|
+
heading: g[e] ?? e,
|
|
59930
59952
|
children: t.map((e) => {
|
|
59931
59953
|
let t = e.id.split("/")[0];
|
|
59932
59954
|
return /* @__PURE__ */ H(zB, {
|
|
59933
59955
|
onSelect: () => {
|
|
59934
|
-
|
|
59956
|
+
u.current = !0, o?.(e.id), CU("chat-model", e.id), l(!1);
|
|
59935
59957
|
},
|
|
59936
59958
|
value: e.id,
|
|
59937
59959
|
children: [
|
|
59938
59960
|
/* @__PURE__ */ V(BB, { provider: t }),
|
|
59939
59961
|
/* @__PURE__ */ V(VB, { children: e.name }),
|
|
59940
|
-
e.id ===
|
|
59962
|
+
e.id === m.id && /* @__PURE__ */ V(th, { className: "ml-auto size-4" })
|
|
59941
59963
|
]
|
|
59942
59964
|
}, e.id);
|
|
59943
59965
|
})
|
|
@@ -60295,44 +60317,44 @@ var BU = S(zU), VU = ({ description: e, icon: t, selectedTool: n, setSelectedToo
|
|
|
60295
60317
|
YP,
|
|
60296
60318
|
hL
|
|
60297
60319
|
];
|
|
60298
|
-
function JU({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, status: i, stop: a, attachments: o, setAttachments: s,
|
|
60299
|
-
let { artifact:
|
|
60320
|
+
function JU({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, status: i, stop: a, attachments: o, setAttachments: s, chatModels: c, defaultChatModel: l, sendMessage: u, messages: d, setMessages: f, regenerate: p, renderMessagePart: m, votes: h, isReadonly: g, selectedModelId: _, suggestedActions: v }) {
|
|
60321
|
+
let { artifact: y, setArtifact: b, metadata: x, setMetadata: S } = uS(), { data: w, isLoading: E } = _R(y.documentId, y.documentId !== "init" && y.status !== "streaming"), [D, O] = N([]), k = j(() => D.length > 0 ? gR(w, D) : w, [w, D]), [A, M] = N("edit"), [P, F] = N(null), [I, L] = N(-1);
|
|
60300
60322
|
T(() => {
|
|
60301
|
-
|
|
60302
|
-
}, [
|
|
60303
|
-
if (
|
|
60304
|
-
let e =
|
|
60305
|
-
e && (
|
|
60323
|
+
O([]);
|
|
60324
|
+
}, [y.documentId]), T(() => {
|
|
60325
|
+
if (k && k.length > 0) {
|
|
60326
|
+
let e = k.at(-1);
|
|
60327
|
+
e && (F(e), L(k.length - 1), b((t) => ({
|
|
60306
60328
|
...t,
|
|
60307
60329
|
content: e.content ?? ""
|
|
60308
60330
|
})));
|
|
60309
60331
|
}
|
|
60310
|
-
}, [
|
|
60311
|
-
let [
|
|
60312
|
-
if (!
|
|
60313
|
-
if (!
|
|
60314
|
-
|
|
60332
|
+
}, [k, b]);
|
|
60333
|
+
let [R, z] = N(!1), ee = C(async (e) => {
|
|
60334
|
+
if (!y) return;
|
|
60335
|
+
if (!k) {
|
|
60336
|
+
z(!1);
|
|
60315
60337
|
return;
|
|
60316
60338
|
}
|
|
60317
|
-
let t =
|
|
60339
|
+
let t = k.at(-1);
|
|
60318
60340
|
if (!t || !t.content) {
|
|
60319
|
-
|
|
60341
|
+
z(!1);
|
|
60320
60342
|
return;
|
|
60321
60343
|
}
|
|
60322
60344
|
if (t.content === e) {
|
|
60323
|
-
|
|
60345
|
+
z(!1);
|
|
60324
60346
|
return;
|
|
60325
60347
|
}
|
|
60326
|
-
let n = await fetch(`/api/rb/agents/document?id=${
|
|
60348
|
+
let n = await fetch(`/api/rb/agents/document?id=${y.documentId}`, {
|
|
60327
60349
|
method: "POST",
|
|
60328
60350
|
body: JSON.stringify({
|
|
60329
|
-
title:
|
|
60351
|
+
title: y.title,
|
|
60330
60352
|
content: e,
|
|
60331
|
-
kind:
|
|
60353
|
+
kind: y.kind
|
|
60332
60354
|
})
|
|
60333
60355
|
});
|
|
60334
60356
|
if (!n.ok) {
|
|
60335
|
-
|
|
60357
|
+
z(!1);
|
|
60336
60358
|
return;
|
|
60337
60359
|
}
|
|
60338
60360
|
let r = await n.json().catch(() => null), i = {
|
|
@@ -60340,31 +60362,31 @@ function JU({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
60340
60362
|
content: e,
|
|
60341
60363
|
createdAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
60342
60364
|
}, a = r && typeof r == "object" ? hR(r) : i;
|
|
60343
|
-
|
|
60344
|
-
}, [
|
|
60345
|
-
|
|
60365
|
+
O((e) => gR(e, [a.id ? a : i])), z(!1);
|
|
60366
|
+
}, [y, k]), te = PP(ee, 2e3), ne = C((e, t) => {
|
|
60367
|
+
P && e !== P.content && (z(!0), t ? te(e) : ee(e));
|
|
60346
60368
|
}, [
|
|
60347
|
-
|
|
60348
|
-
|
|
60349
|
-
|
|
60369
|
+
P,
|
|
60370
|
+
te,
|
|
60371
|
+
ee
|
|
60350
60372
|
]);
|
|
60351
|
-
function
|
|
60352
|
-
return !
|
|
60373
|
+
function B(e) {
|
|
60374
|
+
return !k || !k[e] ? "" : k[e].content ?? "";
|
|
60353
60375
|
}
|
|
60354
|
-
let
|
|
60355
|
-
|
|
60356
|
-
}, [
|
|
60357
|
-
if (!
|
|
60376
|
+
let U = (e) => {
|
|
60377
|
+
k && (e === "latest" && (L(k.length - 1), M("edit")), e === "toggle" && M((e) => e === "edit" ? "diff" : "edit"), e === "prev" ? I > 0 && L((e) => e - 1) : e === "next" && I < k.length - 1 && L((e) => e + 1));
|
|
60378
|
+
}, [W, re] = N(!1), G = k && k.length > 0 ? I === k.length - 1 : !0, ie = Rg(), ae = qU.find((e) => e.kind === y.kind);
|
|
60379
|
+
if (!ae) throw Error("Artifact definition not found!");
|
|
60358
60380
|
return T(() => {
|
|
60359
|
-
|
|
60360
|
-
documentId:
|
|
60361
|
-
setMetadata:
|
|
60381
|
+
y.documentId !== "init" && ae.initialize && ae.initialize({
|
|
60382
|
+
documentId: y.documentId,
|
|
60383
|
+
setMetadata: S
|
|
60362
60384
|
});
|
|
60363
60385
|
}, [
|
|
60364
|
-
|
|
60365
|
-
|
|
60366
|
-
|
|
60367
|
-
]), /* @__PURE__ */ V($j, { children:
|
|
60386
|
+
y.documentId,
|
|
60387
|
+
ae,
|
|
60388
|
+
S
|
|
60389
|
+
]), /* @__PURE__ */ V($j, { children: y.isVisible && /* @__PURE__ */ H(KN.div, {
|
|
60368
60390
|
animate: { opacity: 1 },
|
|
60369
60391
|
className: "absolute inset-0 z-50 flex min-h-0 min-w-0 flex-row overflow-hidden bg-background",
|
|
60370
60392
|
"data-testid": "artifact",
|
|
@@ -60373,7 +60395,7 @@ function JU({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
60373
60395
|
transition: { delay: .4 }
|
|
60374
60396
|
},
|
|
60375
60397
|
initial: { opacity: 1 },
|
|
60376
|
-
children: [!
|
|
60398
|
+
children: [!ie && /* @__PURE__ */ H(KN.div, {
|
|
60377
60399
|
animate: {
|
|
60378
60400
|
opacity: 1,
|
|
60379
60401
|
x: 0,
|
|
@@ -60397,7 +60419,7 @@ function JU({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
60397
60419
|
x: 10,
|
|
60398
60420
|
scale: 1
|
|
60399
60421
|
},
|
|
60400
|
-
children: [/* @__PURE__ */ V($j, { children: !
|
|
60422
|
+
children: [/* @__PURE__ */ V($j, { children: !G && /* @__PURE__ */ V(KN.div, {
|
|
60401
60423
|
animate: { opacity: 1 },
|
|
60402
60424
|
className: "absolute inset-0 z-50 bg-background/70",
|
|
60403
60425
|
exit: { opacity: 0 },
|
|
@@ -60406,30 +60428,33 @@ function JU({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
60406
60428
|
className: "flex h-full flex-col items-center justify-between",
|
|
60407
60429
|
children: [/* @__PURE__ */ V(lB, {
|
|
60408
60430
|
addToolApprovalResponse: e,
|
|
60409
|
-
artifactStatus:
|
|
60431
|
+
artifactStatus: y.status,
|
|
60410
60432
|
chatId: t,
|
|
60411
|
-
isReadonly:
|
|
60412
|
-
messages:
|
|
60413
|
-
regenerate:
|
|
60414
|
-
|
|
60433
|
+
isReadonly: g,
|
|
60434
|
+
messages: d,
|
|
60435
|
+
regenerate: p,
|
|
60436
|
+
renderMessagePart: m,
|
|
60437
|
+
setMessages: f,
|
|
60415
60438
|
status: i,
|
|
60416
|
-
votes:
|
|
60439
|
+
votes: h
|
|
60417
60440
|
}), /* @__PURE__ */ V("div", {
|
|
60418
60441
|
className: "relative flex w-full flex-row items-end gap-2 px-4 pb-4",
|
|
60419
60442
|
children: /* @__PURE__ */ V(MU, {
|
|
60420
60443
|
attachments: o,
|
|
60444
|
+
chatModels: c,
|
|
60445
|
+
defaultChatModel: l,
|
|
60421
60446
|
chatId: t,
|
|
60422
60447
|
className: "bg-background dark:bg-muted",
|
|
60423
60448
|
input: n,
|
|
60424
|
-
messages:
|
|
60425
|
-
selectedModelId:
|
|
60426
|
-
sendMessage:
|
|
60449
|
+
messages: d,
|
|
60450
|
+
selectedModelId: _,
|
|
60451
|
+
sendMessage: u,
|
|
60427
60452
|
setAttachments: s,
|
|
60428
60453
|
setInput: r,
|
|
60429
|
-
setMessages:
|
|
60454
|
+
setMessages: f,
|
|
60430
60455
|
status: i,
|
|
60431
60456
|
stop: a,
|
|
60432
|
-
suggestedActions:
|
|
60457
|
+
suggestedActions: v
|
|
60433
60458
|
})
|
|
60434
60459
|
})]
|
|
60435
60460
|
})]
|
|
@@ -60458,7 +60483,7 @@ function JU({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
60458
60483
|
damping: 30
|
|
60459
60484
|
}
|
|
60460
60485
|
},
|
|
60461
|
-
initial:
|
|
60486
|
+
initial: ie ? {
|
|
60462
60487
|
opacity: 0,
|
|
60463
60488
|
x: 0,
|
|
60464
60489
|
y: 16,
|
|
@@ -60478,61 +60503,61 @@ function JU({ addToolApprovalResponse: e, chatId: t, input: n, setInput: r, stat
|
|
|
60478
60503
|
className: "flex flex-col",
|
|
60479
60504
|
children: [/* @__PURE__ */ V("div", {
|
|
60480
60505
|
className: "font-medium",
|
|
60481
|
-
children:
|
|
60482
|
-
}),
|
|
60506
|
+
children: y.title
|
|
60507
|
+
}), R ? /* @__PURE__ */ V("div", {
|
|
60483
60508
|
className: "text-muted-foreground text-sm",
|
|
60484
60509
|
children: "Saving changes..."
|
|
60485
|
-
}) :
|
|
60510
|
+
}) : P ? /* @__PURE__ */ V("div", {
|
|
60486
60511
|
className: "text-muted-foreground text-sm",
|
|
60487
|
-
children: `Updated ${$n(new Date(
|
|
60512
|
+
children: `Updated ${$n(new Date(P.createdAt), /* @__PURE__ */ new Date(), { addSuffix: !0 })}`
|
|
60488
60513
|
}) : /* @__PURE__ */ V("div", { className: "mt-2 h-3 w-32 animate-pulse rounded-md bg-muted-foreground/20" })]
|
|
60489
60514
|
})]
|
|
60490
60515
|
}), /* @__PURE__ */ V(yR, {
|
|
60491
|
-
artifact:
|
|
60492
|
-
currentVersionIndex:
|
|
60493
|
-
handleVersionChange:
|
|
60494
|
-
isCurrentVersion:
|
|
60495
|
-
metadata:
|
|
60496
|
-
mode:
|
|
60497
|
-
setMetadata:
|
|
60516
|
+
artifact: y,
|
|
60517
|
+
currentVersionIndex: I,
|
|
60518
|
+
handleVersionChange: U,
|
|
60519
|
+
isCurrentVersion: G,
|
|
60520
|
+
metadata: x,
|
|
60521
|
+
mode: A,
|
|
60522
|
+
setMetadata: S
|
|
60498
60523
|
})]
|
|
60499
60524
|
}),
|
|
60500
60525
|
/* @__PURE__ */ H("div", {
|
|
60501
60526
|
className: "h-full max-w-full! items-center overflow-y-scroll bg-background dark:bg-muted",
|
|
60502
|
-
children: [/* @__PURE__ */ V(
|
|
60503
|
-
content:
|
|
60504
|
-
currentVersionIndex:
|
|
60505
|
-
getDocumentContentById:
|
|
60506
|
-
isCurrentVersion:
|
|
60527
|
+
children: [/* @__PURE__ */ V(ae.content, {
|
|
60528
|
+
content: G ? y.content : B(I),
|
|
60529
|
+
currentVersionIndex: I,
|
|
60530
|
+
getDocumentContentById: B,
|
|
60531
|
+
isCurrentVersion: G,
|
|
60507
60532
|
isInline: !1,
|
|
60508
|
-
isLoading:
|
|
60509
|
-
metadata:
|
|
60510
|
-
mode:
|
|
60511
|
-
onSaveContent:
|
|
60512
|
-
setMetadata:
|
|
60513
|
-
status:
|
|
60533
|
+
isLoading: E && !y.content,
|
|
60534
|
+
metadata: x,
|
|
60535
|
+
mode: A,
|
|
60536
|
+
onSaveContent: ne,
|
|
60537
|
+
setMetadata: S,
|
|
60538
|
+
status: y.status,
|
|
60514
60539
|
suggestions: [],
|
|
60515
|
-
title:
|
|
60516
|
-
}), /* @__PURE__ */ V($j, { children:
|
|
60517
|
-
artifactKind:
|
|
60518
|
-
isToolbarVisible:
|
|
60519
|
-
sendMessage:
|
|
60520
|
-
setIsToolbarVisible:
|
|
60521
|
-
setMessages:
|
|
60540
|
+
title: y.title
|
|
60541
|
+
}), /* @__PURE__ */ V($j, { children: G && /* @__PURE__ */ V(GU, {
|
|
60542
|
+
artifactKind: y.kind,
|
|
60543
|
+
isToolbarVisible: W,
|
|
60544
|
+
sendMessage: u,
|
|
60545
|
+
setIsToolbarVisible: re,
|
|
60546
|
+
setMessages: f,
|
|
60522
60547
|
status: i,
|
|
60523
60548
|
stop: a
|
|
60524
60549
|
}) })]
|
|
60525
60550
|
}),
|
|
60526
|
-
/* @__PURE__ */ V($j, { children: !
|
|
60527
|
-
currentVersionIndex:
|
|
60528
|
-
documents:
|
|
60529
|
-
handleVersionChange:
|
|
60551
|
+
/* @__PURE__ */ V($j, { children: !G && /* @__PURE__ */ V(KU, {
|
|
60552
|
+
currentVersionIndex: I,
|
|
60553
|
+
documents: k,
|
|
60554
|
+
handleVersionChange: U
|
|
60530
60555
|
}) })
|
|
60531
60556
|
]
|
|
60532
60557
|
})]
|
|
60533
60558
|
}) });
|
|
60534
60559
|
}
|
|
60535
|
-
var YU = S(JU, (e, t) => !(e.status !== t.status || !ue(e.votes, t.votes) || e.input !== t.input || !ue(e.messages, t.messages.length) || !ue(e.suggestedActions, t.suggestedActions))), XU = ({ title1: e, title2: t }) => {
|
|
60560
|
+
var YU = S(JU, (e, t) => !(e.status !== t.status || !ue(e.votes, t.votes) || e.input !== t.input || !ue(e.messages, t.messages.length) || e.renderMessagePart !== t.renderMessagePart || !ue(e.suggestedActions, t.suggestedActions) || !ue(e.chatModels, t.chatModels) || e.defaultChatModel !== t.defaultChatModel)), XU = ({ title1: e, title2: t }) => {
|
|
60536
60561
|
let n = e?.trim(), r = t?.trim();
|
|
60537
60562
|
return !n && !r ? null : /* @__PURE__ */ H("div", {
|
|
60538
60563
|
className: "mx-auto mt-4 flex size-full max-w-3xl flex-col justify-center px-4 md:mt-16 md:px-8",
|
|
@@ -60573,42 +60598,43 @@ var YU = S(JU, (e, t) => !(e.status !== t.status || !ue(e.votes, t.votes) || e.i
|
|
|
60573
60598
|
};
|
|
60574
60599
|
//#endregion
|
|
60575
60600
|
//#region src/components/messages.tsx
|
|
60576
|
-
function ZU({ addToolApprovalResponse: e, chatId: t, status: n, votes: r, messages: i,
|
|
60577
|
-
let
|
|
60601
|
+
function ZU({ addToolApprovalResponse: e, chatId: t, status: n, votes: r, messages: i, renderMessagePart: a, setMessages: o, regenerate: s, isReadonly: c, selectedModelId: l, title1: u, title2: d }) {
|
|
60602
|
+
let f = i.at(-1), p = (e) => e === "dynamic-tool" || e.startsWith("tool-"), m = f?.role === "assistant" && (f.parts?.some((e) => e.type === "text" ? !!e.text?.trim() : e.type === "reasoning" ? tB(e) : !!p(e.type)) ?? !1), h = n === "submitted" || n === "streaming" && f?.role === "assistant" && !m, g = n === "streaming" && f?.role === "assistant" && !m, { containerRef: _, endRef: v, isAtBottom: y, scrollToBottom: b, hasSentMessage: x } = CR({ status: n });
|
|
60578
60603
|
return Qe(), /* @__PURE__ */ H("div", {
|
|
60579
60604
|
className: "relative flex-1",
|
|
60580
60605
|
children: [/* @__PURE__ */ V("div", {
|
|
60581
60606
|
className: "absolute inset-0 touch-pan-y overflow-y-auto",
|
|
60582
|
-
ref:
|
|
60607
|
+
ref: _,
|
|
60583
60608
|
children: /* @__PURE__ */ H("div", {
|
|
60584
60609
|
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",
|
|
60585
60610
|
children: [
|
|
60586
60611
|
i.length === 0 && /* @__PURE__ */ V(XU, {
|
|
60587
|
-
title1:
|
|
60588
|
-
title2:
|
|
60612
|
+
title1: u,
|
|
60613
|
+
title2: d
|
|
60589
60614
|
}),
|
|
60590
|
-
i.map((
|
|
60615
|
+
i.map((l, u) => g && u === i.length - 1 && l.role === "assistant" ? null : /* @__PURE__ */ V(aB, {
|
|
60591
60616
|
addToolApprovalResponse: e,
|
|
60592
60617
|
chatId: t,
|
|
60593
|
-
isLoading: n === "streaming" && i.length - 1 ===
|
|
60594
|
-
isReadonly:
|
|
60595
|
-
message:
|
|
60596
|
-
|
|
60597
|
-
|
|
60598
|
-
|
|
60599
|
-
|
|
60600
|
-
|
|
60601
|
-
|
|
60618
|
+
isLoading: n === "streaming" && i.length - 1 === u,
|
|
60619
|
+
isReadonly: c,
|
|
60620
|
+
message: l,
|
|
60621
|
+
renderMessagePart: a,
|
|
60622
|
+
regenerate: s,
|
|
60623
|
+
requiresScrollPadding: x && u === i.length - 1,
|
|
60624
|
+
setMessages: o,
|
|
60625
|
+
vote: r ? r.find((e) => e.messageId === l.id) : void 0
|
|
60626
|
+
}, l.id)),
|
|
60627
|
+
h && /* @__PURE__ */ V(oB, {}),
|
|
60602
60628
|
/* @__PURE__ */ V("div", {
|
|
60603
60629
|
className: "min-h-[24px] min-w-[24px] shrink-0",
|
|
60604
|
-
ref:
|
|
60630
|
+
ref: v
|
|
60605
60631
|
})
|
|
60606
60632
|
]
|
|
60607
60633
|
})
|
|
60608
60634
|
}), /* @__PURE__ */ V("button", {
|
|
60609
60635
|
"aria-label": "Scroll to bottom",
|
|
60610
|
-
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 ${
|
|
60611
|
-
onClick: () =>
|
|
60636
|
+
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 ${y ? "pointer-events-none scale-0 opacity-0" : "pointer-events-auto scale-100 opacity-100"}`,
|
|
60637
|
+
onClick: () => b("smooth"),
|
|
60612
60638
|
type: "button",
|
|
60613
60639
|
children: /* @__PURE__ */ V($m, { className: "size-4" })
|
|
60614
60640
|
})]
|
|
@@ -60618,16 +60644,19 @@ var QU = ZU, $U = (e) => e?.parts?.some((e) => {
|
|
|
60618
60644
|
let t = e.state;
|
|
60619
60645
|
return t === "approval-responded" || t === "output-denied";
|
|
60620
60646
|
}) ?? !1, eW = (e) => `agents-sdk:chat:${e}:stream`, tW = (e) => !!(e && typeof e == "object" && !Array.isArray(e)), nW = (e) => u(e) ?? "default";
|
|
60621
|
-
function rW({ id: e, initialMessages: t, initialChatModel: n, isReadonly: r, autoResume: i,
|
|
60622
|
-
let { setDataStream:
|
|
60647
|
+
function rW({ id: e, initialMessages: t, initialChatModel: n, isReadonly: r, autoResume: i, chatModels: a, defaultChatModel: u, renderMessagePart: d, suggestedActions: f, title1: p, title2: m }) {
|
|
60648
|
+
let { setDataStream: h } = Qe(), { getChatPath: g } = Ue(), _ = a && a.length > 0 ? a : s, v = c({
|
|
60649
|
+
defaultChatModel: u,
|
|
60650
|
+
models: _
|
|
60651
|
+
}), y = o(_).has(n) ? n : v, b = nW(y), [x, S] = N(""), [C, w] = N(y), E = M(C), [D, O] = N(b), k = M(D);
|
|
60623
60652
|
T(() => {
|
|
60624
|
-
|
|
60625
|
-
}, [
|
|
60626
|
-
|
|
60627
|
-
}, [e,
|
|
60628
|
-
|
|
60629
|
-
}, [
|
|
60630
|
-
let { messages:
|
|
60653
|
+
E.current = C;
|
|
60654
|
+
}, [C]), T(() => {
|
|
60655
|
+
w(y), O(nW(y));
|
|
60656
|
+
}, [e, y]), T(() => {
|
|
60657
|
+
k.current = D;
|
|
60658
|
+
}, [D]);
|
|
60659
|
+
let { messages: A, setMessages: j, sendMessage: P, status: F, stop: I, regenerate: L, resumeStream: R, addToolApprovalResponse: z } = Qx({
|
|
60631
60660
|
id: e,
|
|
60632
60661
|
messages: t,
|
|
60633
60662
|
experimental_throttle: 100,
|
|
@@ -60637,7 +60666,7 @@ function rW({ id: e, initialMessages: t, initialChatModel: n, isReadonly: r, aut
|
|
|
60637
60666
|
api: "/api/rb/agents/chat",
|
|
60638
60667
|
fetch: ym,
|
|
60639
60668
|
prepareSendMessagesRequest(e) {
|
|
60640
|
-
let t =
|
|
60669
|
+
let t = E.current, n = k.current, r = e.messages.at(-1), i = e.messages.at(-2), a = gm(e.headers, mm()), o = r?.role !== "user" || r?.role === "user" && $U(i);
|
|
60641
60670
|
return {
|
|
60642
60671
|
...a ? { headers: a } : {},
|
|
60643
60672
|
body: {
|
|
@@ -60658,7 +60687,7 @@ function rW({ id: e, initialMessages: t, initialChatModel: n, isReadonly: r, aut
|
|
|
60658
60687
|
}
|
|
60659
60688
|
}),
|
|
60660
60689
|
onData: (e) => {
|
|
60661
|
-
|
|
60690
|
+
h((t) => t ? [...t, e] : []);
|
|
60662
60691
|
},
|
|
60663
60692
|
onError: (e) => {
|
|
60664
60693
|
if (e instanceof om) {
|
|
@@ -60671,7 +60700,7 @@ function rW({ id: e, initialMessages: t, initialChatModel: n, isReadonly: r, aut
|
|
|
60671
60700
|
}
|
|
60672
60701
|
U.error("Something went wrong. Please try again.");
|
|
60673
60702
|
}
|
|
60674
|
-
}),
|
|
60703
|
+
}), ee = M(null), te = M("");
|
|
60675
60704
|
T(() => W(eW(e), (t) => {
|
|
60676
60705
|
if (!tW(t) || t.chatId !== e) return;
|
|
60677
60706
|
let n = t.message;
|
|
@@ -60684,28 +60713,28 @@ function rW({ id: e, initialMessages: t, initialChatModel: n, isReadonly: r, aut
|
|
|
60684
60713
|
parts: r,
|
|
60685
60714
|
metadata: tW(n.metadata) ? n.metadata : { createdAt: (/* @__PURE__ */ new Date()).toISOString() }
|
|
60686
60715
|
};
|
|
60687
|
-
|
|
60716
|
+
j((t) => {
|
|
60688
60717
|
let n = t.findIndex((t) => t.id === e);
|
|
60689
60718
|
return n === -1 ? [...t, i] : t.map((e, t) => t === n ? i : e);
|
|
60690
60719
|
});
|
|
60691
60720
|
}
|
|
60692
60721
|
}
|
|
60693
60722
|
if (t.done === !0) {
|
|
60694
|
-
|
|
60723
|
+
ee.current = null, te.current = "";
|
|
60695
60724
|
return;
|
|
60696
60725
|
}
|
|
60697
60726
|
let r = t.part;
|
|
60698
60727
|
if (!tW(r)) return;
|
|
60699
60728
|
if (r.type === "start" && typeof r.messageId == "string") {
|
|
60700
|
-
|
|
60729
|
+
ee.current = r.messageId, te.current = "";
|
|
60701
60730
|
return;
|
|
60702
60731
|
}
|
|
60703
|
-
if (typeof r.type == "string" && r.type.startsWith("data-") &&
|
|
60704
|
-
let i =
|
|
60732
|
+
if (typeof r.type == "string" && r.type.startsWith("data-") && h((e) => e ? [...e, r] : []), r.type !== "text-delta" || typeof r.delta != "string") return;
|
|
60733
|
+
let i = ee.current;
|
|
60705
60734
|
if (!i) return;
|
|
60706
|
-
|
|
60707
|
-
let a =
|
|
60708
|
-
|
|
60735
|
+
te.current += r.delta;
|
|
60736
|
+
let a = te.current;
|
|
60737
|
+
j((e) => {
|
|
60709
60738
|
let t = e.findIndex((e) => e.id === i), n = {
|
|
60710
60739
|
id: i,
|
|
60711
60740
|
role: "assistant",
|
|
@@ -60719,93 +60748,99 @@ function rW({ id: e, initialMessages: t, initialChatModel: n, isReadonly: r, aut
|
|
|
60719
60748
|
});
|
|
60720
60749
|
}), [
|
|
60721
60750
|
e,
|
|
60722
|
-
|
|
60723
|
-
|
|
60751
|
+
h,
|
|
60752
|
+
j
|
|
60724
60753
|
]);
|
|
60725
|
-
let [
|
|
60754
|
+
let [B] = ne(), re = B.get("query"), [G, ie] = N(!1);
|
|
60726
60755
|
T(() => {
|
|
60727
|
-
if (
|
|
60728
|
-
|
|
60756
|
+
if (re && !G) {
|
|
60757
|
+
P({
|
|
60729
60758
|
role: "user",
|
|
60730
60759
|
parts: [{
|
|
60731
60760
|
type: "text",
|
|
60732
|
-
text:
|
|
60761
|
+
text: re
|
|
60733
60762
|
}]
|
|
60734
|
-
}),
|
|
60763
|
+
}), ie(!0);
|
|
60735
60764
|
let t = new URLSearchParams(window.location.search);
|
|
60736
60765
|
t.delete("query");
|
|
60737
60766
|
let n = t.toString();
|
|
60738
|
-
window.history.replaceState({}, "", `${
|
|
60767
|
+
window.history.replaceState({}, "", `${g(e)}${n ? `?${n}` : ""}`);
|
|
60739
60768
|
}
|
|
60740
60769
|
}, [
|
|
60741
|
-
|
|
60742
|
-
|
|
60743
|
-
|
|
60770
|
+
re,
|
|
60771
|
+
P,
|
|
60772
|
+
G,
|
|
60744
60773
|
e,
|
|
60745
|
-
|
|
60774
|
+
g
|
|
60746
60775
|
]);
|
|
60747
|
-
let { data:
|
|
60776
|
+
let { data: ae } = mS(e, A.length >= 2), [oe, se] = N([]), ce = lS((e) => e.isVisible);
|
|
60748
60777
|
return dS({
|
|
60749
60778
|
autoResume: i,
|
|
60750
60779
|
initialMessages: t,
|
|
60751
|
-
resumeStream:
|
|
60752
|
-
setMessages:
|
|
60780
|
+
resumeStream: R,
|
|
60781
|
+
setMessages: j
|
|
60753
60782
|
}), /* @__PURE__ */ H("div", {
|
|
60754
60783
|
className: "relative flex h-full min-h-0 min-w-0 overflow-hidden bg-background",
|
|
60755
60784
|
children: [/* @__PURE__ */ H("div", {
|
|
60756
60785
|
className: "overscroll-behavior-contain flex h-full min-h-0 min-w-0 flex-1 touch-pan-y flex-col bg-background",
|
|
60757
60786
|
children: [/* @__PURE__ */ V(QU, {
|
|
60758
|
-
addToolApprovalResponse:
|
|
60787
|
+
addToolApprovalResponse: z,
|
|
60759
60788
|
chatId: e,
|
|
60760
|
-
isArtifactVisible:
|
|
60789
|
+
isArtifactVisible: ce,
|
|
60761
60790
|
isReadonly: r,
|
|
60762
|
-
messages:
|
|
60763
|
-
|
|
60764
|
-
|
|
60765
|
-
|
|
60766
|
-
|
|
60767
|
-
|
|
60768
|
-
|
|
60769
|
-
|
|
60791
|
+
messages: A,
|
|
60792
|
+
renderMessagePart: d,
|
|
60793
|
+
regenerate: L,
|
|
60794
|
+
selectedModelId: y,
|
|
60795
|
+
setMessages: j,
|
|
60796
|
+
status: F,
|
|
60797
|
+
title1: p,
|
|
60798
|
+
title2: m,
|
|
60799
|
+
votes: ae
|
|
60770
60800
|
}), /* @__PURE__ */ V("div", {
|
|
60771
60801
|
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",
|
|
60772
60802
|
children: !r && /* @__PURE__ */ V(MU, {
|
|
60773
|
-
attachments:
|
|
60803
|
+
attachments: oe,
|
|
60804
|
+
chatModels: _,
|
|
60805
|
+
defaultChatModel: v,
|
|
60774
60806
|
chatId: e,
|
|
60775
|
-
input:
|
|
60776
|
-
messages:
|
|
60807
|
+
input: x,
|
|
60808
|
+
messages: A,
|
|
60777
60809
|
onModelChange: (e) => {
|
|
60778
|
-
|
|
60810
|
+
w(e), O(nW(e));
|
|
60779
60811
|
},
|
|
60780
|
-
onOpenAIReasoningEffortChange:
|
|
60781
|
-
openaiReasoningEffort:
|
|
60782
|
-
selectedModelId:
|
|
60783
|
-
sendMessage:
|
|
60784
|
-
setAttachments:
|
|
60785
|
-
setInput:
|
|
60786
|
-
setMessages:
|
|
60787
|
-
status:
|
|
60788
|
-
stop:
|
|
60789
|
-
suggestedActions:
|
|
60812
|
+
onOpenAIReasoningEffortChange: O,
|
|
60813
|
+
openaiReasoningEffort: D,
|
|
60814
|
+
selectedModelId: C,
|
|
60815
|
+
sendMessage: P,
|
|
60816
|
+
setAttachments: se,
|
|
60817
|
+
setInput: S,
|
|
60818
|
+
setMessages: j,
|
|
60819
|
+
status: F,
|
|
60820
|
+
stop: I,
|
|
60821
|
+
suggestedActions: f
|
|
60790
60822
|
})
|
|
60791
60823
|
})]
|
|
60792
60824
|
}), /* @__PURE__ */ V(YU, {
|
|
60793
|
-
addToolApprovalResponse:
|
|
60794
|
-
attachments:
|
|
60825
|
+
addToolApprovalResponse: z,
|
|
60826
|
+
attachments: oe,
|
|
60827
|
+
chatModels: _,
|
|
60795
60828
|
chatId: e,
|
|
60796
|
-
|
|
60829
|
+
defaultChatModel: v,
|
|
60830
|
+
input: x,
|
|
60797
60831
|
isReadonly: r,
|
|
60798
|
-
messages:
|
|
60799
|
-
regenerate:
|
|
60800
|
-
|
|
60801
|
-
|
|
60802
|
-
|
|
60803
|
-
|
|
60804
|
-
|
|
60805
|
-
|
|
60806
|
-
|
|
60807
|
-
|
|
60808
|
-
|
|
60832
|
+
messages: A,
|
|
60833
|
+
regenerate: L,
|
|
60834
|
+
renderMessagePart: d,
|
|
60835
|
+
selectedModelId: C,
|
|
60836
|
+
sendMessage: P,
|
|
60837
|
+
setAttachments: se,
|
|
60838
|
+
setInput: S,
|
|
60839
|
+
setMessages: j,
|
|
60840
|
+
status: F,
|
|
60841
|
+
stop: I,
|
|
60842
|
+
suggestedActions: f,
|
|
60843
|
+
votes: ae
|
|
60809
60844
|
})]
|
|
60810
60845
|
});
|
|
60811
60846
|
}
|