laif-ds 0.2.0 → 0.2.2
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/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/components/ui/chat-message.js +193 -196
- package/dist/components/ui/chat.js +146 -140
- package/dist/components/ui/message-list.js +20 -20
- package/dist/index.d.ts +3 -1
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/styles.v3.css +1 -1
- package/package.json +1 -1
package/dist/_virtual/index6.js
CHANGED
package/dist/_virtual/index7.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { useMemo as
|
|
4
|
-
import { cva as
|
|
5
|
-
import { motion as
|
|
2
|
+
import { jsxs as n, jsx as e, Fragment as T } from "react/jsx-runtime";
|
|
3
|
+
import { useMemo as P, useState as N, useRef as V, useEffect as j, Suspense as D } from "react";
|
|
4
|
+
import { cva as X } from "../../node_modules/class-variance-authority/dist/index.js";
|
|
5
|
+
import { motion as J } from "framer-motion";
|
|
6
6
|
import { cn as l } from "../../lib/utils.js";
|
|
7
|
-
import { Collapsible as
|
|
8
|
-
import { FilePreview as
|
|
9
|
-
import { MarkdownRenderer as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
const
|
|
7
|
+
import { Collapsible as _, CollapsibleTrigger as q, CollapsibleContent as G } from "./collapsible.js";
|
|
8
|
+
import { FilePreview as H } from "./file-preview.js";
|
|
9
|
+
import { MarkdownRenderer as M } from "./markdown-renderer.js";
|
|
10
|
+
import O from "../../node_modules/lucide-react/dist/esm/icons/x.js";
|
|
11
|
+
import R from "../../node_modules/lucide-react/dist/esm/icons/check.js";
|
|
12
|
+
import K from "../../node_modules/lucide-react/dist/esm/icons/pen.js";
|
|
13
|
+
import Q from "../../node_modules/lucide-react/dist/esm/icons/chevron-right.js";
|
|
14
|
+
import W from "../../node_modules/lucide-react/dist/esm/icons/ban.js";
|
|
15
|
+
import Y from "../../node_modules/lucide-react/dist/esm/icons/code-xml.js";
|
|
16
|
+
import Z from "../../node_modules/lucide-react/dist/esm/icons/terminal.js";
|
|
17
|
+
import A from "../../node_modules/lucide-react/dist/esm/icons/loader-circle.js";
|
|
18
|
+
const z = X(
|
|
19
19
|
"group/message relative break-words rounded-lg p-3 text-sm sm:max-w-[70%]",
|
|
20
20
|
{
|
|
21
21
|
variants: {
|
|
@@ -53,388 +53,385 @@ const R = W(
|
|
|
53
53
|
}
|
|
54
54
|
]
|
|
55
55
|
}
|
|
56
|
-
),
|
|
57
|
-
role:
|
|
58
|
-
content:
|
|
59
|
-
createdAt:
|
|
60
|
-
showTimeStamp:
|
|
61
|
-
animation:
|
|
62
|
-
actions:
|
|
63
|
-
onEdit:
|
|
64
|
-
experimental_attachments:
|
|
65
|
-
toolInvocations:
|
|
66
|
-
parts:
|
|
56
|
+
), xe = ({
|
|
57
|
+
role: s,
|
|
58
|
+
content: t,
|
|
59
|
+
createdAt: o,
|
|
60
|
+
showTimeStamp: g = !1,
|
|
61
|
+
animation: u = "scale",
|
|
62
|
+
actions: p,
|
|
63
|
+
onEdit: v,
|
|
64
|
+
experimental_attachments: B,
|
|
65
|
+
toolInvocations: y,
|
|
66
|
+
parts: w
|
|
67
67
|
}) => {
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
return new File([
|
|
71
|
-
}), [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
},
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
68
|
+
const I = P(() => B?.map((r) => {
|
|
69
|
+
const m = ee(r.url);
|
|
70
|
+
return new File([m], r.name ?? "Unknown");
|
|
71
|
+
}), [B]), i = s === "user", C = !i && v, [a, k] = N(!1), [c, f] = N(t), [b, F] = N(t), d = V(null);
|
|
72
|
+
j(() => {
|
|
73
|
+
a || (F(t), f(t));
|
|
74
|
+
}, [t, a]), j(() => {
|
|
75
|
+
a && d.current && (d.current.focus(), d.current.setSelectionRange(
|
|
76
|
+
d.current.value.length,
|
|
77
|
+
d.current.value.length
|
|
78
|
+
));
|
|
79
|
+
}, [a]);
|
|
80
|
+
const S = () => {
|
|
81
|
+
f(b), k(!0);
|
|
82
|
+
}, h = () => {
|
|
83
|
+
const r = c.trim();
|
|
84
|
+
r && r !== t && (F(r), v && v(r)), k(!1);
|
|
85
|
+
}, x = () => {
|
|
86
|
+
f(b), k(!1);
|
|
87
|
+
}, E = (r) => {
|
|
88
|
+
r.key === "Enter" && !r.shiftKey ? (r.preventDefault(), h()) : r.key === "Escape" && (r.preventDefault(), x());
|
|
89
|
+
}, U = o?.toLocaleTimeString("en-US", {
|
|
87
90
|
hour: "2-digit",
|
|
88
91
|
minute: "2-digit"
|
|
89
92
|
});
|
|
90
|
-
return
|
|
93
|
+
return i ? /* @__PURE__ */ n(
|
|
91
94
|
"div",
|
|
92
95
|
{
|
|
93
|
-
className: l("flex flex-col",
|
|
96
|
+
className: l("flex flex-col", i ? "items-end" : "items-start"),
|
|
94
97
|
children: [
|
|
95
|
-
|
|
96
|
-
/* @__PURE__ */
|
|
98
|
+
I ? /* @__PURE__ */ e("div", { className: "mb-1 flex flex-wrap gap-2", children: I.map((r, m) => /* @__PURE__ */ e(H, { file: r }, m)) }) : null,
|
|
99
|
+
/* @__PURE__ */ n(
|
|
97
100
|
"div",
|
|
98
101
|
{
|
|
99
102
|
className: l(
|
|
100
|
-
|
|
103
|
+
z({ isUser: i, animation: u }),
|
|
101
104
|
"group relative",
|
|
102
|
-
|
|
105
|
+
a && "border-d-primary border"
|
|
103
106
|
),
|
|
104
107
|
children: [
|
|
105
|
-
/* @__PURE__ */ e(
|
|
106
|
-
"
|
|
108
|
+
a ? /* @__PURE__ */ e(
|
|
109
|
+
"textarea",
|
|
110
|
+
{
|
|
111
|
+
ref: d,
|
|
112
|
+
value: c,
|
|
113
|
+
onChange: (r) => f(r.target.value),
|
|
114
|
+
onKeyDown: E,
|
|
115
|
+
className: "w-full resize-none border-none bg-transparent p-0 focus:outline-none",
|
|
116
|
+
rows: Math.max(2, c.split(`
|
|
117
|
+
`).length)
|
|
118
|
+
}
|
|
119
|
+
) : /* @__PURE__ */ e("div", { className: "pointer-events-none", children: /* @__PURE__ */ e(
|
|
120
|
+
D,
|
|
107
121
|
{
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
onKeyDown: t ? v : void 0,
|
|
111
|
-
className: l(
|
|
112
|
-
"focus:outline-none",
|
|
113
|
-
!t && "pointer-events-none"
|
|
114
|
-
),
|
|
115
|
-
suppressContentEditableWarning: !0,
|
|
116
|
-
children: /* @__PURE__ */ e(
|
|
117
|
-
w,
|
|
118
|
-
{
|
|
119
|
-
fallback: /* @__PURE__ */ e("div", { className: "text-d-secondary-foreground", children: "Caricamento..." }),
|
|
120
|
-
children: /* @__PURE__ */ e(k, { children: n })
|
|
121
|
-
}
|
|
122
|
-
)
|
|
122
|
+
fallback: /* @__PURE__ */ e("div", { className: "text-d-secondary-foreground", children: "Caricamento..." }),
|
|
123
|
+
children: /* @__PURE__ */ e(M, { children: b })
|
|
123
124
|
}
|
|
124
|
-
),
|
|
125
|
-
|
|
125
|
+
) }),
|
|
126
|
+
C && /* @__PURE__ */ e("div", { className: "absolute -top-2 -right-2 flex gap-1", children: a ? /* @__PURE__ */ n(T, { children: [
|
|
126
127
|
/* @__PURE__ */ e(
|
|
127
128
|
"button",
|
|
128
129
|
{
|
|
129
|
-
onClick:
|
|
130
|
+
onClick: x,
|
|
130
131
|
className: "bg-d-background border-d-border hover:bg-d-muted rounded-full border p-1 transition-colors",
|
|
131
132
|
title: "Cancel",
|
|
132
|
-
children: /* @__PURE__ */ e(
|
|
133
|
+
children: /* @__PURE__ */ e(O, { className: "h-3 w-3" })
|
|
133
134
|
}
|
|
134
135
|
),
|
|
135
136
|
/* @__PURE__ */ e(
|
|
136
137
|
"button",
|
|
137
138
|
{
|
|
138
|
-
onClick:
|
|
139
|
+
onClick: h,
|
|
139
140
|
className: "bg-d-background border-d-border hover:bg-d-muted rounded-full border p-1 transition-colors",
|
|
140
141
|
title: "Save",
|
|
141
|
-
children: /* @__PURE__ */ e(
|
|
142
|
+
children: /* @__PURE__ */ e(R, { className: "h-3 w-3" })
|
|
142
143
|
}
|
|
143
144
|
)
|
|
144
145
|
] }) : /* @__PURE__ */ e(
|
|
145
146
|
"button",
|
|
146
147
|
{
|
|
147
|
-
onClick:
|
|
148
|
+
onClick: S,
|
|
148
149
|
className: "bg-d-background border-d-border hover:bg-d-muted rounded-full border p-1 opacity-0 transition-opacity group-hover:opacity-100",
|
|
149
150
|
title: "Edit message",
|
|
150
|
-
children: /* @__PURE__ */ e(
|
|
151
|
+
children: /* @__PURE__ */ e(K, { className: "h-3 w-3" })
|
|
151
152
|
}
|
|
152
153
|
) })
|
|
153
154
|
]
|
|
154
155
|
}
|
|
155
156
|
),
|
|
156
|
-
|
|
157
|
+
g && o ? /* @__PURE__ */ e(
|
|
157
158
|
"time",
|
|
158
159
|
{
|
|
159
|
-
dateTime:
|
|
160
|
+
dateTime: o.toISOString(),
|
|
160
161
|
className: l(
|
|
161
162
|
"mt-1 block px-1 text-xs opacity-50",
|
|
162
|
-
|
|
163
|
+
u !== "none" && "animate-in fade-in-0 duration-500"
|
|
163
164
|
),
|
|
164
|
-
children:
|
|
165
|
+
children: U
|
|
165
166
|
}
|
|
166
167
|
) : null
|
|
167
168
|
]
|
|
168
169
|
}
|
|
169
|
-
) :
|
|
170
|
+
) : w && w.length > 0 ? w.map((r, m) => r.type === "text" ? /* @__PURE__ */ n(
|
|
170
171
|
"div",
|
|
171
172
|
{
|
|
172
173
|
className: l(
|
|
173
174
|
"flex flex-col",
|
|
174
|
-
|
|
175
|
+
i ? "items-end" : "items-start"
|
|
175
176
|
),
|
|
176
177
|
children: [
|
|
177
|
-
/* @__PURE__ */
|
|
178
|
+
/* @__PURE__ */ n(
|
|
178
179
|
"div",
|
|
179
180
|
{
|
|
180
181
|
className: l(
|
|
181
|
-
|
|
182
|
+
z({ isUser: i, animation: u }),
|
|
182
183
|
"group relative",
|
|
183
|
-
|
|
184
|
+
a && "border-d-primary border"
|
|
184
185
|
),
|
|
185
186
|
children: [
|
|
186
|
-
/* @__PURE__ */ e(
|
|
187
|
-
"
|
|
187
|
+
a ? /* @__PURE__ */ e(
|
|
188
|
+
"textarea",
|
|
189
|
+
{
|
|
190
|
+
ref: d,
|
|
191
|
+
value: c,
|
|
192
|
+
onChange: ($) => f($.target.value),
|
|
193
|
+
onKeyDown: E,
|
|
194
|
+
className: "w-full resize-none border-none bg-transparent p-0 focus:outline-none",
|
|
195
|
+
rows: Math.max(2, c.split(`
|
|
196
|
+
`).length)
|
|
197
|
+
}
|
|
198
|
+
) : /* @__PURE__ */ e("div", { className: "pointer-events-none", children: /* @__PURE__ */ e(
|
|
199
|
+
D,
|
|
188
200
|
{
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
onKeyDown: t ? v : void 0,
|
|
192
|
-
className: l(
|
|
193
|
-
"focus:outline-none",
|
|
194
|
-
!t && "pointer-events-none"
|
|
195
|
-
),
|
|
196
|
-
suppressContentEditableWarning: !0,
|
|
197
|
-
children: /* @__PURE__ */ e(
|
|
198
|
-
w,
|
|
199
|
-
{
|
|
200
|
-
fallback: /* @__PURE__ */ e("div", { className: "text-d-secondary-foreground", children: "Caricamento..." }),
|
|
201
|
-
children: /* @__PURE__ */ e(k, { children: r.text })
|
|
202
|
-
}
|
|
203
|
-
)
|
|
201
|
+
fallback: /* @__PURE__ */ e("div", { className: "text-d-secondary-foreground", children: "Caricamento..." }),
|
|
202
|
+
children: /* @__PURE__ */ e(M, { children: r.text })
|
|
204
203
|
}
|
|
205
|
-
),
|
|
206
|
-
|
|
204
|
+
) }),
|
|
205
|
+
C && /* @__PURE__ */ e("div", { className: "absolute -top-2 -right-2 flex gap-1", children: a ? /* @__PURE__ */ n(T, { children: [
|
|
207
206
|
/* @__PURE__ */ e(
|
|
208
207
|
"button",
|
|
209
208
|
{
|
|
210
|
-
onClick:
|
|
209
|
+
onClick: x,
|
|
211
210
|
className: "bg-d-background border-d-border hover:bg-d-muted rounded-full border p-1 transition-colors",
|
|
212
211
|
title: "Cancel",
|
|
213
|
-
children: /* @__PURE__ */ e(
|
|
212
|
+
children: /* @__PURE__ */ e(O, { className: "h-3 w-3" })
|
|
214
213
|
}
|
|
215
214
|
),
|
|
216
215
|
/* @__PURE__ */ e(
|
|
217
216
|
"button",
|
|
218
217
|
{
|
|
219
|
-
onClick:
|
|
218
|
+
onClick: h,
|
|
220
219
|
className: "bg-d-background border-d-border hover:bg-d-muted rounded-full border p-1 transition-colors",
|
|
221
220
|
title: "Save",
|
|
222
|
-
children: /* @__PURE__ */ e(
|
|
221
|
+
children: /* @__PURE__ */ e(R, { className: "h-3 w-3" })
|
|
223
222
|
}
|
|
224
223
|
)
|
|
225
224
|
] }) : /* @__PURE__ */ e(
|
|
226
225
|
"button",
|
|
227
226
|
{
|
|
228
|
-
onClick:
|
|
227
|
+
onClick: S,
|
|
229
228
|
className: "bg-d-background border-d-border hover:bg-d-muted rounded-full border p-1 opacity-0 transition-opacity group-hover:opacity-100",
|
|
230
229
|
title: "Edit message",
|
|
231
|
-
children: /* @__PURE__ */ e(
|
|
230
|
+
children: /* @__PURE__ */ e(K, { className: "h-3 w-3" })
|
|
232
231
|
}
|
|
233
232
|
) }),
|
|
234
|
-
|
|
233
|
+
p && !a ? /* @__PURE__ */ e("div", { className: "bg-d-background text-d-foreground border-d-border absolute right-2 -bottom-4 flex space-x-1 rounded-lg border p-1 opacity-0 transition-opacity group-hover/message:opacity-100", children: p }) : null
|
|
235
234
|
]
|
|
236
235
|
}
|
|
237
236
|
),
|
|
238
|
-
|
|
237
|
+
g && o ? /* @__PURE__ */ e(
|
|
239
238
|
"time",
|
|
240
239
|
{
|
|
241
|
-
dateTime:
|
|
240
|
+
dateTime: o.toISOString(),
|
|
242
241
|
className: l(
|
|
243
242
|
"mt-1 block px-1 text-xs opacity-50",
|
|
244
|
-
|
|
243
|
+
u !== "none" && "animate-in fade-in-0 duration-500"
|
|
245
244
|
),
|
|
246
|
-
children:
|
|
245
|
+
children: U
|
|
247
246
|
}
|
|
248
247
|
) : null
|
|
249
248
|
]
|
|
250
249
|
},
|
|
251
|
-
`text-${
|
|
252
|
-
) : r.type === "reasoning" ? /* @__PURE__ */ e(
|
|
253
|
-
|
|
250
|
+
`text-${m}`
|
|
251
|
+
) : r.type === "reasoning" ? /* @__PURE__ */ e(re, { part: r }, `reasoning-${m}`) : r.type === "tool-invocation" ? /* @__PURE__ */ e(
|
|
252
|
+
L,
|
|
254
253
|
{
|
|
255
254
|
toolInvocations: [r.toolInvocation]
|
|
256
255
|
},
|
|
257
|
-
`tool-${
|
|
258
|
-
) : null) :
|
|
259
|
-
/* @__PURE__ */
|
|
256
|
+
`tool-${m}`
|
|
257
|
+
) : null) : y && y.length > 0 ? /* @__PURE__ */ e(L, { toolInvocations: y }) : /* @__PURE__ */ n("div", { className: l("flex flex-col", i ? "items-end" : "items-start"), children: [
|
|
258
|
+
/* @__PURE__ */ n(
|
|
260
259
|
"div",
|
|
261
260
|
{
|
|
262
261
|
className: l(
|
|
263
|
-
|
|
262
|
+
z({ isUser: i, animation: u }),
|
|
264
263
|
"group relative",
|
|
265
|
-
|
|
264
|
+
a && "border-d-primary border"
|
|
266
265
|
),
|
|
267
266
|
children: [
|
|
268
|
-
/* @__PURE__ */ e(
|
|
269
|
-
"
|
|
267
|
+
a ? /* @__PURE__ */ e(
|
|
268
|
+
"textarea",
|
|
270
269
|
{
|
|
271
|
-
ref:
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
suppressContentEditableWarning: !0,
|
|
279
|
-
children: /* @__PURE__ */ e(
|
|
280
|
-
w,
|
|
281
|
-
{
|
|
282
|
-
fallback: /* @__PURE__ */ e("div", { className: "text-d-secondary-foreground", children: "Caricamento..." }),
|
|
283
|
-
children: /* @__PURE__ */ e(k, { children: n })
|
|
284
|
-
}
|
|
285
|
-
)
|
|
270
|
+
ref: d,
|
|
271
|
+
value: c,
|
|
272
|
+
onChange: (r) => f(r.target.value),
|
|
273
|
+
onKeyDown: E,
|
|
274
|
+
className: "w-full resize-none border-none bg-transparent p-0 focus:outline-none",
|
|
275
|
+
rows: Math.max(2, c.split(`
|
|
276
|
+
`).length)
|
|
286
277
|
}
|
|
287
|
-
),
|
|
288
|
-
|
|
278
|
+
) : /* @__PURE__ */ e("div", { className: "pointer-events-none", children: /* @__PURE__ */ e(
|
|
279
|
+
D,
|
|
280
|
+
{
|
|
281
|
+
fallback: /* @__PURE__ */ e("div", { className: "text-d-secondary-foreground", children: "Caricamento..." }),
|
|
282
|
+
children: /* @__PURE__ */ e(M, { children: b })
|
|
283
|
+
}
|
|
284
|
+
) }),
|
|
285
|
+
C && /* @__PURE__ */ e("div", { className: "absolute -top-2 -right-2 flex gap-1", children: a ? /* @__PURE__ */ n(T, { children: [
|
|
289
286
|
/* @__PURE__ */ e(
|
|
290
287
|
"button",
|
|
291
288
|
{
|
|
292
|
-
onClick:
|
|
289
|
+
onClick: x,
|
|
293
290
|
className: "bg-d-background border-d-border hover:bg-d-muted rounded-full border p-1 transition-colors",
|
|
294
291
|
title: "Cancel",
|
|
295
|
-
children: /* @__PURE__ */ e(
|
|
292
|
+
children: /* @__PURE__ */ e(O, { className: "h-3 w-3" })
|
|
296
293
|
}
|
|
297
294
|
),
|
|
298
295
|
/* @__PURE__ */ e(
|
|
299
296
|
"button",
|
|
300
297
|
{
|
|
301
|
-
onClick:
|
|
298
|
+
onClick: h,
|
|
302
299
|
className: "bg-d-background border-d-border hover:bg-d-muted rounded-full border p-1 transition-colors",
|
|
303
300
|
title: "Save",
|
|
304
|
-
children: /* @__PURE__ */ e(
|
|
301
|
+
children: /* @__PURE__ */ e(R, { className: "h-3 w-3" })
|
|
305
302
|
}
|
|
306
303
|
)
|
|
307
304
|
] }) : /* @__PURE__ */ e(
|
|
308
305
|
"button",
|
|
309
306
|
{
|
|
310
|
-
onClick:
|
|
307
|
+
onClick: S,
|
|
311
308
|
className: "bg-d-background border-d-border hover:bg-d-muted rounded-full border p-1 opacity-0 transition-opacity group-hover:opacity-100",
|
|
312
309
|
title: "Edit message",
|
|
313
|
-
children: /* @__PURE__ */ e(
|
|
310
|
+
children: /* @__PURE__ */ e(K, { className: "h-3 w-3" })
|
|
314
311
|
}
|
|
315
312
|
) }),
|
|
316
|
-
|
|
313
|
+
p && !a ? /* @__PURE__ */ e("div", { className: "bg-d-background text-foreground absolute right-2 -bottom-4 flex space-x-1 rounded-lg border p-1 opacity-0 transition-opacity group-hover/message:opacity-100", children: p }) : null
|
|
317
314
|
]
|
|
318
315
|
}
|
|
319
316
|
),
|
|
320
|
-
|
|
317
|
+
g && o ? /* @__PURE__ */ e(
|
|
321
318
|
"time",
|
|
322
319
|
{
|
|
323
|
-
dateTime:
|
|
320
|
+
dateTime: o.toISOString(),
|
|
324
321
|
className: l(
|
|
325
322
|
"mt-1 block px-1 text-xs opacity-50",
|
|
326
|
-
|
|
323
|
+
u !== "none" && "animate-in fade-in-0 duration-500"
|
|
327
324
|
),
|
|
328
|
-
children:
|
|
325
|
+
children: U
|
|
329
326
|
}
|
|
330
327
|
) : null
|
|
331
328
|
] });
|
|
332
329
|
};
|
|
333
|
-
function
|
|
334
|
-
const
|
|
335
|
-
return new Uint8Array(
|
|
330
|
+
function ee(s) {
|
|
331
|
+
const t = s.split(",")[1], o = Buffer.from(t, "base64");
|
|
332
|
+
return new Uint8Array(o);
|
|
336
333
|
}
|
|
337
|
-
const
|
|
338
|
-
const [
|
|
339
|
-
return /* @__PURE__ */ e("div", { className: "mb-2 flex flex-col items-start sm:max-w-[70%]", children: /* @__PURE__ */
|
|
340
|
-
|
|
334
|
+
const re = ({ part: s }) => {
|
|
335
|
+
const [t, o] = N(!1);
|
|
336
|
+
return /* @__PURE__ */ e("div", { className: "mb-2 flex flex-col items-start sm:max-w-[70%]", children: /* @__PURE__ */ n(
|
|
337
|
+
_,
|
|
341
338
|
{
|
|
342
|
-
open:
|
|
343
|
-
onOpenChange:
|
|
339
|
+
open: t,
|
|
340
|
+
onOpenChange: o,
|
|
344
341
|
className: "group bg-d-secondary/50 border-d-border w-full overflow-hidden rounded-lg",
|
|
345
342
|
children: [
|
|
346
|
-
/* @__PURE__ */ e("div", { className: "flex items-center p-2", children: /* @__PURE__ */ e(
|
|
347
|
-
/* @__PURE__ */ e(
|
|
343
|
+
/* @__PURE__ */ e("div", { className: "flex items-center p-2", children: /* @__PURE__ */ e(q, { asChild: !0, children: /* @__PURE__ */ n("button", { className: "text-d-secondary-foreground hover:text-d-foreground flex items-center gap-2 text-sm", children: [
|
|
344
|
+
/* @__PURE__ */ e(Q, { className: "h-4 w-4 transition-transform group-data-[state=open]:rotate-90" }),
|
|
348
345
|
/* @__PURE__ */ e("span", { children: "Thinking" })
|
|
349
346
|
] }) }) }),
|
|
350
|
-
/* @__PURE__ */ e(
|
|
351
|
-
|
|
347
|
+
/* @__PURE__ */ e(G, { forceMount: !0, children: /* @__PURE__ */ e(
|
|
348
|
+
J.div,
|
|
352
349
|
{
|
|
353
350
|
initial: !1,
|
|
354
|
-
animate:
|
|
351
|
+
animate: t ? "open" : "closed",
|
|
355
352
|
variants: {
|
|
356
353
|
open: { height: "auto", opacity: 1 },
|
|
357
354
|
closed: { height: 0, opacity: 0 }
|
|
358
355
|
},
|
|
359
356
|
transition: { duration: 0.3, ease: [0.04, 0.62, 0.23, 0.98] },
|
|
360
357
|
className: "border-d-border border-t",
|
|
361
|
-
children: /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e("div", { className: "text-xs whitespace-pre-wrap", children:
|
|
358
|
+
children: /* @__PURE__ */ e("div", { className: "p-2", children: /* @__PURE__ */ e("div", { className: "text-xs whitespace-pre-wrap", children: s.reasoning }) })
|
|
362
359
|
}
|
|
363
360
|
) })
|
|
364
361
|
]
|
|
365
362
|
}
|
|
366
363
|
) });
|
|
367
364
|
};
|
|
368
|
-
function
|
|
369
|
-
toolInvocations:
|
|
365
|
+
function L({
|
|
366
|
+
toolInvocations: s
|
|
370
367
|
}) {
|
|
371
|
-
return
|
|
372
|
-
if (
|
|
373
|
-
return /* @__PURE__ */
|
|
368
|
+
return s?.length ? /* @__PURE__ */ e("div", { className: "flex flex-col items-start gap-2", children: s.map((t, o) => {
|
|
369
|
+
if (t.state === "result" && t.result.__cancelled === !0)
|
|
370
|
+
return /* @__PURE__ */ n(
|
|
374
371
|
"div",
|
|
375
372
|
{
|
|
376
373
|
className: "bg-d-secondary/50 text-d-secondary-foreground border-d-border flex items-center gap-2 rounded-lg border px-3 py-2 text-sm",
|
|
377
374
|
children: [
|
|
378
|
-
/* @__PURE__ */ e(
|
|
379
|
-
/* @__PURE__ */
|
|
375
|
+
/* @__PURE__ */ e(W, { className: "h-4 w-4" }),
|
|
376
|
+
/* @__PURE__ */ n("span", { children: [
|
|
380
377
|
"Cancelled",
|
|
381
378
|
" ",
|
|
382
|
-
/* @__PURE__ */
|
|
379
|
+
/* @__PURE__ */ n("span", { className: "font-mono", children: [
|
|
383
380
|
"`",
|
|
384
|
-
|
|
381
|
+
t.toolName,
|
|
385
382
|
"`"
|
|
386
383
|
] })
|
|
387
384
|
] })
|
|
388
385
|
]
|
|
389
386
|
},
|
|
390
|
-
|
|
387
|
+
o
|
|
391
388
|
);
|
|
392
|
-
switch (
|
|
389
|
+
switch (t.state) {
|
|
393
390
|
case "partial-call":
|
|
394
391
|
case "call":
|
|
395
|
-
return /* @__PURE__ */
|
|
392
|
+
return /* @__PURE__ */ n(
|
|
396
393
|
"div",
|
|
397
394
|
{
|
|
398
395
|
className: "bg-d-secondary/50 text-d-secondary-foreground border-d-border flex items-center gap-2 rounded-lg border px-3 py-2 text-sm",
|
|
399
396
|
children: [
|
|
400
|
-
/* @__PURE__ */ e(
|
|
401
|
-
/* @__PURE__ */
|
|
397
|
+
/* @__PURE__ */ e(Z, { className: "h-4 w-4" }),
|
|
398
|
+
/* @__PURE__ */ n("span", { children: [
|
|
402
399
|
"Calling",
|
|
403
400
|
" ",
|
|
404
|
-
/* @__PURE__ */
|
|
401
|
+
/* @__PURE__ */ n("span", { className: "font-mono", children: [
|
|
405
402
|
"`",
|
|
406
|
-
|
|
403
|
+
t.toolName,
|
|
407
404
|
"`"
|
|
408
405
|
] }),
|
|
409
406
|
"..."
|
|
410
407
|
] }),
|
|
411
|
-
/* @__PURE__ */ e(
|
|
408
|
+
/* @__PURE__ */ e(A, { className: "h-3 w-3 animate-spin" })
|
|
412
409
|
]
|
|
413
410
|
},
|
|
414
|
-
|
|
411
|
+
o
|
|
415
412
|
);
|
|
416
413
|
case "result":
|
|
417
|
-
return /* @__PURE__ */
|
|
414
|
+
return /* @__PURE__ */ n(
|
|
418
415
|
"div",
|
|
419
416
|
{
|
|
420
417
|
className: "bg-d-secondary/50 border-d-border flex flex-col gap-1.5 rounded-lg border px-3 py-2 text-sm",
|
|
421
418
|
children: [
|
|
422
|
-
/* @__PURE__ */
|
|
423
|
-
/* @__PURE__ */ e(
|
|
424
|
-
/* @__PURE__ */
|
|
419
|
+
/* @__PURE__ */ n("div", { className: "text-d-secondary-foreground flex items-center gap-2", children: [
|
|
420
|
+
/* @__PURE__ */ e(Y, { className: "h-4 w-4" }),
|
|
421
|
+
/* @__PURE__ */ n("span", { children: [
|
|
425
422
|
"Result from",
|
|
426
423
|
" ",
|
|
427
|
-
/* @__PURE__ */
|
|
424
|
+
/* @__PURE__ */ n("span", { className: "font-mono", children: [
|
|
428
425
|
"`",
|
|
429
|
-
|
|
426
|
+
t.toolName,
|
|
430
427
|
"`"
|
|
431
428
|
] })
|
|
432
429
|
] })
|
|
433
430
|
] }),
|
|
434
|
-
/* @__PURE__ */ e("pre", { className: "text-d-foreground overflow-x-auto whitespace-pre-wrap", children: JSON.stringify(
|
|
431
|
+
/* @__PURE__ */ e("pre", { className: "text-d-foreground overflow-x-auto whitespace-pre-wrap", children: JSON.stringify(t.result, null, 2) })
|
|
435
432
|
]
|
|
436
433
|
},
|
|
437
|
-
|
|
434
|
+
o
|
|
438
435
|
);
|
|
439
436
|
default:
|
|
440
437
|
return null;
|
|
@@ -442,5 +439,5 @@ function K({
|
|
|
442
439
|
}) }) : null;
|
|
443
440
|
}
|
|
444
441
|
export {
|
|
445
|
-
|
|
442
|
+
xe as ChatMessage
|
|
446
443
|
};
|