@mieweb/ui 0.6.1-dev.149 → 0.6.1-dev.151
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/brands/index.cjs +22 -22
- package/dist/brands/index.js +5 -5
- package/dist/chunk-2T4JU5RH.cjs +1156 -0
- package/dist/chunk-2T4JU5RH.cjs.map +1 -0
- package/dist/chunk-3SSXDWD7.js +363 -0
- package/dist/chunk-3SSXDWD7.js.map +1 -0
- package/dist/{chunk-MARLXJQO.cjs → chunk-6R2ZPDN7.cjs} +7 -7
- package/dist/{chunk-MARLXJQO.cjs.map → chunk-6R2ZPDN7.cjs.map} +1 -1
- package/dist/{chunk-WHUD3XHR.cjs → chunk-7PA26KBF.cjs} +15 -3
- package/dist/chunk-7PA26KBF.cjs.map +1 -0
- package/dist/chunk-ASLZUFH4.js +1967 -0
- package/dist/chunk-ASLZUFH4.js.map +1 -0
- package/dist/chunk-FADQVM4M.cjs +2017 -0
- package/dist/chunk-FADQVM4M.cjs.map +1 -0
- package/dist/{chunk-DFT7TYKL.cjs → chunk-H4T5T65N.cjs} +6 -3
- package/dist/chunk-H4T5T65N.cjs.map +1 -0
- package/dist/chunk-I6CY5C6A.js +12 -0
- package/dist/chunk-I6CY5C6A.js.map +1 -0
- package/dist/chunk-JFLC7SHM.cjs +35 -0
- package/dist/chunk-JFLC7SHM.cjs.map +1 -0
- package/dist/chunk-LZPPH5BW.cjs +368 -0
- package/dist/chunk-LZPPH5BW.cjs.map +1 -0
- package/dist/{chunk-3OHVUXDG.js → chunk-M7BLVBL4.js} +6 -3
- package/dist/chunk-M7BLVBL4.js.map +1 -0
- package/dist/chunk-PM2I3QKM.cjs +1419 -0
- package/dist/chunk-PM2I3QKM.cjs.map +1 -0
- package/dist/{chunk-TW6DXMSD.js → chunk-R6PBBPU3.js} +2 -2
- package/dist/{chunk-TW6DXMSD.js.map → chunk-R6PBBPU3.js.map} +1 -1
- package/dist/{chunk-33PO3J4O.js → chunk-RXY5SD3O.js} +15 -3
- package/dist/chunk-RXY5SD3O.js.map +1 -0
- package/dist/{chunk-AEGYWRSL.js → chunk-TXYTMU3K.js} +3 -3
- package/dist/{chunk-AEGYWRSL.js.map → chunk-TXYTMU3K.js.map} +1 -1
- package/dist/chunk-UHPQYBXQ.js +1124 -0
- package/dist/chunk-UHPQYBXQ.js.map +1 -0
- package/dist/chunk-XQE26F3G.js +1383 -0
- package/dist/chunk-XQE26F3G.js.map +1 -0
- package/dist/{chunk-26YNFCOC.cjs → chunk-Z6NRP4Z5.cjs} +2 -2
- package/dist/{chunk-26YNFCOC.cjs.map → chunk-Z6NRP4Z5.cjs.map} +1 -1
- package/dist/components/Dropdown/index.cjs +7 -7
- package/dist/components/Dropdown/index.d.cts +1 -1
- package/dist/components/Dropdown/index.d.ts +1 -1
- package/dist/components/Dropdown/index.js +1 -1
- package/dist/components/RichTextEditor/index.cjs +5 -5
- package/dist/components/RichTextEditor/index.js +2 -2
- package/dist/components/SuperChat/index.cjs +1319 -0
- package/dist/components/SuperChat/index.cjs.map +1 -0
- package/dist/components/SuperChat/index.d.cts +189 -0
- package/dist/components/SuperChat/index.d.ts +189 -0
- package/dist/components/SuperChat/index.js +1282 -0
- package/dist/components/SuperChat/index.js.map +1 -0
- package/dist/components/SuperChat/plugins/index.cjs +1221 -0
- package/dist/components/SuperChat/plugins/index.cjs.map +1 -0
- package/dist/components/SuperChat/plugins/index.d.cts +253 -0
- package/dist/components/SuperChat/plugins/index.d.ts +253 -0
- package/dist/components/SuperChat/plugins/index.js +1181 -0
- package/dist/components/SuperChat/plugins/index.js.map +1 -0
- package/dist/datavis.cjs +18 -362
- package/dist/datavis.cjs.map +1 -1
- package/dist/datavis.js +1 -361
- package/dist/datavis.js.map +1 -1
- package/dist/index.cjs +1297 -5412
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +44 -240
- package/dist/index.d.ts +44 -240
- package/dist/index.js +759 -5037
- package/dist/index.js.map +1 -1
- package/dist/nitroTableGrid-FWRCDE4N.js +22 -0
- package/dist/nitroTableGrid-FWRCDE4N.js.map +1 -0
- package/dist/nitroTableGrid-IY75TQJ2.cjs +44 -0
- package/dist/nitroTableGrid-IY75TQJ2.cjs.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/tailwind-preset.cjs +4 -4
- package/dist/tailwind-preset.js +1 -1
- package/dist/types-BFFgW6qy.d.ts +240 -0
- package/dist/types-BzeY_kYO.d.cts +242 -0
- package/dist/types-BzeY_kYO.d.ts +242 -0
- package/dist/types-CRt5IPNL.d.cts +240 -0
- package/package.json +42 -5
- package/dist/chunk-33PO3J4O.js.map +0 -1
- package/dist/chunk-3OHVUXDG.js.map +0 -1
- package/dist/chunk-DFT7TYKL.cjs.map +0 -1
- package/dist/chunk-WHUD3XHR.cjs.map +0 -1
|
@@ -0,0 +1,1383 @@
|
|
|
1
|
+
import { cn } from './chunk-F3SOEIN2.js';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { cva } from 'class-variance-authority';
|
|
5
|
+
|
|
6
|
+
var sizeClasses = {
|
|
7
|
+
sm: "h-4 w-4",
|
|
8
|
+
md: "h-5 w-5",
|
|
9
|
+
lg: "h-7 w-7"
|
|
10
|
+
};
|
|
11
|
+
function SparklesIcon({ className, size = "md" }) {
|
|
12
|
+
return /* @__PURE__ */ jsxs(
|
|
13
|
+
"svg",
|
|
14
|
+
{
|
|
15
|
+
"aria-hidden": "true",
|
|
16
|
+
className: cn(sizeClasses[size], className),
|
|
17
|
+
viewBox: "0 0 24 24",
|
|
18
|
+
fill: "currentColor",
|
|
19
|
+
children: [
|
|
20
|
+
/* @__PURE__ */ jsx("path", { d: "M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z" }),
|
|
21
|
+
/* @__PURE__ */ jsx(
|
|
22
|
+
"path",
|
|
23
|
+
{
|
|
24
|
+
d: "M20 3v4",
|
|
25
|
+
stroke: "currentColor",
|
|
26
|
+
strokeWidth: "2",
|
|
27
|
+
strokeLinecap: "round"
|
|
28
|
+
}
|
|
29
|
+
),
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
"path",
|
|
32
|
+
{
|
|
33
|
+
d: "M22 5h-4",
|
|
34
|
+
stroke: "currentColor",
|
|
35
|
+
strokeWidth: "2",
|
|
36
|
+
strokeLinecap: "round"
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
function AILogoIcon({ className, size = "md" }) {
|
|
44
|
+
return /* @__PURE__ */ jsxs(
|
|
45
|
+
"svg",
|
|
46
|
+
{
|
|
47
|
+
"aria-hidden": "true",
|
|
48
|
+
className: cn(sizeClasses[size], className),
|
|
49
|
+
viewBox: "0 0 24 24",
|
|
50
|
+
fill: "none",
|
|
51
|
+
children: [
|
|
52
|
+
/* @__PURE__ */ jsx(
|
|
53
|
+
"path",
|
|
54
|
+
{
|
|
55
|
+
d: "M12 2L2 7L12 12L22 7L12 2Z",
|
|
56
|
+
stroke: "currentColor",
|
|
57
|
+
strokeWidth: "1.5",
|
|
58
|
+
strokeLinecap: "round",
|
|
59
|
+
strokeLinejoin: "round",
|
|
60
|
+
fill: "currentColor",
|
|
61
|
+
fillOpacity: "0.2"
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ jsx(
|
|
65
|
+
"path",
|
|
66
|
+
{
|
|
67
|
+
d: "M2 17L12 22L22 17",
|
|
68
|
+
stroke: "currentColor",
|
|
69
|
+
strokeWidth: "1.5",
|
|
70
|
+
strokeLinecap: "round",
|
|
71
|
+
strokeLinejoin: "round"
|
|
72
|
+
}
|
|
73
|
+
),
|
|
74
|
+
/* @__PURE__ */ jsx(
|
|
75
|
+
"path",
|
|
76
|
+
{
|
|
77
|
+
d: "M2 12L12 17L22 12",
|
|
78
|
+
stroke: "currentColor",
|
|
79
|
+
strokeWidth: "1.5",
|
|
80
|
+
strokeLinecap: "round",
|
|
81
|
+
strokeLinejoin: "round"
|
|
82
|
+
}
|
|
83
|
+
)
|
|
84
|
+
]
|
|
85
|
+
}
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
function CloseIcon({ className }) {
|
|
89
|
+
return /* @__PURE__ */ jsx(
|
|
90
|
+
"svg",
|
|
91
|
+
{
|
|
92
|
+
"aria-hidden": "true",
|
|
93
|
+
className: cn("h-5 w-5", className),
|
|
94
|
+
fill: "none",
|
|
95
|
+
viewBox: "0 0 24 24",
|
|
96
|
+
stroke: "currentColor",
|
|
97
|
+
strokeWidth: "2",
|
|
98
|
+
children: /* @__PURE__ */ jsx(
|
|
99
|
+
"path",
|
|
100
|
+
{
|
|
101
|
+
strokeLinecap: "round",
|
|
102
|
+
strokeLinejoin: "round",
|
|
103
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
104
|
+
}
|
|
105
|
+
)
|
|
106
|
+
}
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
function RefreshIcon({ className }) {
|
|
110
|
+
return /* @__PURE__ */ jsx(
|
|
111
|
+
"svg",
|
|
112
|
+
{
|
|
113
|
+
"aria-hidden": "true",
|
|
114
|
+
className: cn("h-5 w-5", className),
|
|
115
|
+
fill: "none",
|
|
116
|
+
viewBox: "0 0 24 24",
|
|
117
|
+
stroke: "currentColor",
|
|
118
|
+
strokeWidth: "1.5",
|
|
119
|
+
children: /* @__PURE__ */ jsx(
|
|
120
|
+
"path",
|
|
121
|
+
{
|
|
122
|
+
strokeLinecap: "round",
|
|
123
|
+
strokeLinejoin: "round",
|
|
124
|
+
d: "M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0l3.181 3.183a8.25 8.25 0 0013.803-3.7M4.031 9.865a8.25 8.25 0 0113.803-3.7l3.181 3.182m0-4.991v4.99"
|
|
125
|
+
}
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
var chevronRotation = {
|
|
131
|
+
up: "-rotate-180",
|
|
132
|
+
down: "",
|
|
133
|
+
left: "rotate-90",
|
|
134
|
+
right: "-rotate-90"
|
|
135
|
+
};
|
|
136
|
+
function ChevronIcon({
|
|
137
|
+
className,
|
|
138
|
+
direction = "down"
|
|
139
|
+
}) {
|
|
140
|
+
return /* @__PURE__ */ jsx(
|
|
141
|
+
"svg",
|
|
142
|
+
{
|
|
143
|
+
"aria-hidden": "true",
|
|
144
|
+
className: cn("h-4 w-4", chevronRotation[direction], className),
|
|
145
|
+
fill: "none",
|
|
146
|
+
viewBox: "0 0 24 24",
|
|
147
|
+
stroke: "currentColor",
|
|
148
|
+
strokeWidth: "2",
|
|
149
|
+
children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
function SendIcon({ className }) {
|
|
154
|
+
return /* @__PURE__ */ jsx(
|
|
155
|
+
"svg",
|
|
156
|
+
{
|
|
157
|
+
"aria-hidden": "true",
|
|
158
|
+
className: cn("h-5 w-5", className),
|
|
159
|
+
fill: "none",
|
|
160
|
+
viewBox: "0 0 24 24",
|
|
161
|
+
stroke: "currentColor",
|
|
162
|
+
children: /* @__PURE__ */ jsx(
|
|
163
|
+
"path",
|
|
164
|
+
{
|
|
165
|
+
strokeLinecap: "round",
|
|
166
|
+
strokeLinejoin: "round",
|
|
167
|
+
strokeWidth: 2,
|
|
168
|
+
d: "M12 19l9 2-9-18-9 18 9-2zm0 0v-8"
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
function SpinnerIcon({ className }) {
|
|
175
|
+
return /* @__PURE__ */ jsxs(
|
|
176
|
+
"svg",
|
|
177
|
+
{
|
|
178
|
+
"aria-hidden": "true",
|
|
179
|
+
className: cn("h-5 w-5 animate-spin", className),
|
|
180
|
+
fill: "none",
|
|
181
|
+
viewBox: "0 0 24 24",
|
|
182
|
+
children: [
|
|
183
|
+
/* @__PURE__ */ jsx(
|
|
184
|
+
"circle",
|
|
185
|
+
{
|
|
186
|
+
className: "opacity-25",
|
|
187
|
+
cx: "12",
|
|
188
|
+
cy: "12",
|
|
189
|
+
r: "10",
|
|
190
|
+
stroke: "currentColor",
|
|
191
|
+
strokeWidth: "4"
|
|
192
|
+
}
|
|
193
|
+
),
|
|
194
|
+
/* @__PURE__ */ jsx(
|
|
195
|
+
"path",
|
|
196
|
+
{
|
|
197
|
+
className: "opacity-75",
|
|
198
|
+
fill: "currentColor",
|
|
199
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
200
|
+
}
|
|
201
|
+
)
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
var statusIconVariants = cva(
|
|
207
|
+
"flex h-5 w-5 items-center justify-center rounded-full",
|
|
208
|
+
{
|
|
209
|
+
variants: {
|
|
210
|
+
status: {
|
|
211
|
+
pending: "bg-neutral-200 dark:bg-neutral-700",
|
|
212
|
+
running: "bg-primary-100 dark:bg-primary-900/50",
|
|
213
|
+
success: "bg-green-100 dark:bg-green-900/50",
|
|
214
|
+
error: "bg-red-100 dark:bg-red-900/50",
|
|
215
|
+
cancelled: "bg-neutral-200 dark:bg-neutral-700"
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
defaultVariants: {
|
|
219
|
+
status: "pending"
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
);
|
|
223
|
+
function ToolStatusIcon({ status, className }) {
|
|
224
|
+
return /* @__PURE__ */ jsxs(
|
|
225
|
+
"span",
|
|
226
|
+
{
|
|
227
|
+
"data-slot": "ai-tool-status-icon",
|
|
228
|
+
className: cn(statusIconVariants({ status }), className),
|
|
229
|
+
children: [
|
|
230
|
+
status === "pending" && /* @__PURE__ */ jsx(
|
|
231
|
+
"svg",
|
|
232
|
+
{
|
|
233
|
+
"aria-hidden": "true",
|
|
234
|
+
className: "h-3 w-3 text-neutral-500",
|
|
235
|
+
fill: "currentColor",
|
|
236
|
+
viewBox: "0 0 20 20",
|
|
237
|
+
children: /* @__PURE__ */ jsx("circle", { cx: "10", cy: "10", r: "3" })
|
|
238
|
+
}
|
|
239
|
+
),
|
|
240
|
+
status === "running" && /* @__PURE__ */ jsxs(
|
|
241
|
+
"svg",
|
|
242
|
+
{
|
|
243
|
+
"aria-hidden": "true",
|
|
244
|
+
className: "text-primary-800 dark:text-primary-400 h-3 w-3 animate-spin",
|
|
245
|
+
fill: "none",
|
|
246
|
+
viewBox: "0 0 24 24",
|
|
247
|
+
children: [
|
|
248
|
+
/* @__PURE__ */ jsx(
|
|
249
|
+
"circle",
|
|
250
|
+
{
|
|
251
|
+
className: "opacity-25",
|
|
252
|
+
cx: "12",
|
|
253
|
+
cy: "12",
|
|
254
|
+
r: "10",
|
|
255
|
+
stroke: "currentColor",
|
|
256
|
+
strokeWidth: "4"
|
|
257
|
+
}
|
|
258
|
+
),
|
|
259
|
+
/* @__PURE__ */ jsx(
|
|
260
|
+
"path",
|
|
261
|
+
{
|
|
262
|
+
className: "opacity-75",
|
|
263
|
+
fill: "currentColor",
|
|
264
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"
|
|
265
|
+
}
|
|
266
|
+
)
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
),
|
|
270
|
+
status === "success" && /* @__PURE__ */ jsx(
|
|
271
|
+
"svg",
|
|
272
|
+
{
|
|
273
|
+
"aria-hidden": "true",
|
|
274
|
+
className: "h-3 w-3 text-green-600 dark:text-green-400",
|
|
275
|
+
fill: "none",
|
|
276
|
+
viewBox: "0 0 24 24",
|
|
277
|
+
stroke: "currentColor",
|
|
278
|
+
strokeWidth: "3",
|
|
279
|
+
children: /* @__PURE__ */ jsx(
|
|
280
|
+
"path",
|
|
281
|
+
{
|
|
282
|
+
strokeLinecap: "round",
|
|
283
|
+
strokeLinejoin: "round",
|
|
284
|
+
d: "M5 13l4 4L19 7"
|
|
285
|
+
}
|
|
286
|
+
)
|
|
287
|
+
}
|
|
288
|
+
),
|
|
289
|
+
status === "error" && /* @__PURE__ */ jsx(
|
|
290
|
+
"svg",
|
|
291
|
+
{
|
|
292
|
+
"aria-hidden": "true",
|
|
293
|
+
className: "h-3 w-3 text-red-600 dark:text-red-400",
|
|
294
|
+
fill: "none",
|
|
295
|
+
viewBox: "0 0 24 24",
|
|
296
|
+
stroke: "currentColor",
|
|
297
|
+
strokeWidth: "3",
|
|
298
|
+
children: /* @__PURE__ */ jsx(
|
|
299
|
+
"path",
|
|
300
|
+
{
|
|
301
|
+
strokeLinecap: "round",
|
|
302
|
+
strokeLinejoin: "round",
|
|
303
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
304
|
+
}
|
|
305
|
+
)
|
|
306
|
+
}
|
|
307
|
+
),
|
|
308
|
+
status === "cancelled" && /* @__PURE__ */ jsx(
|
|
309
|
+
"svg",
|
|
310
|
+
{
|
|
311
|
+
"aria-hidden": "true",
|
|
312
|
+
className: "h-3 w-3 text-neutral-500",
|
|
313
|
+
fill: "none",
|
|
314
|
+
viewBox: "0 0 24 24",
|
|
315
|
+
stroke: "currentColor",
|
|
316
|
+
strokeWidth: "3",
|
|
317
|
+
children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M18 12H6" })
|
|
318
|
+
}
|
|
319
|
+
)
|
|
320
|
+
]
|
|
321
|
+
}
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
var TOOL_ICONS = {
|
|
325
|
+
// Patient tools
|
|
326
|
+
create_patient: /* @__PURE__ */ jsx(
|
|
327
|
+
"svg",
|
|
328
|
+
{
|
|
329
|
+
"aria-hidden": "true",
|
|
330
|
+
className: "h-4 w-4",
|
|
331
|
+
fill: "none",
|
|
332
|
+
viewBox: "0 0 24 24",
|
|
333
|
+
stroke: "currentColor",
|
|
334
|
+
strokeWidth: "1.5",
|
|
335
|
+
children: /* @__PURE__ */ jsx(
|
|
336
|
+
"path",
|
|
337
|
+
{
|
|
338
|
+
strokeLinecap: "round",
|
|
339
|
+
strokeLinejoin: "round",
|
|
340
|
+
d: "M18 7.5v3m0 0v3m0-3h3m-3 0h-3m-2.25-4.125a3.375 3.375 0 11-6.75 0 3.375 3.375 0 016.75 0zM3 19.235v-.11a6.375 6.375 0 0112.75 0v.109A12.318 12.318 0 019.374 21c-2.331 0-4.512-.645-6.374-1.766z"
|
|
341
|
+
}
|
|
342
|
+
)
|
|
343
|
+
}
|
|
344
|
+
),
|
|
345
|
+
get_patient: /* @__PURE__ */ jsx(
|
|
346
|
+
"svg",
|
|
347
|
+
{
|
|
348
|
+
"aria-hidden": "true",
|
|
349
|
+
className: "h-4 w-4",
|
|
350
|
+
fill: "none",
|
|
351
|
+
viewBox: "0 0 24 24",
|
|
352
|
+
stroke: "currentColor",
|
|
353
|
+
strokeWidth: "1.5",
|
|
354
|
+
children: /* @__PURE__ */ jsx(
|
|
355
|
+
"path",
|
|
356
|
+
{
|
|
357
|
+
strokeLinecap: "round",
|
|
358
|
+
strokeLinejoin: "round",
|
|
359
|
+
d: "M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"
|
|
360
|
+
}
|
|
361
|
+
)
|
|
362
|
+
}
|
|
363
|
+
),
|
|
364
|
+
search_patients: /* @__PURE__ */ jsx(
|
|
365
|
+
"svg",
|
|
366
|
+
{
|
|
367
|
+
"aria-hidden": "true",
|
|
368
|
+
className: "h-4 w-4",
|
|
369
|
+
fill: "none",
|
|
370
|
+
viewBox: "0 0 24 24",
|
|
371
|
+
stroke: "currentColor",
|
|
372
|
+
strokeWidth: "1.5",
|
|
373
|
+
children: /* @__PURE__ */ jsx(
|
|
374
|
+
"path",
|
|
375
|
+
{
|
|
376
|
+
strokeLinecap: "round",
|
|
377
|
+
strokeLinejoin: "round",
|
|
378
|
+
d: "M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"
|
|
379
|
+
}
|
|
380
|
+
)
|
|
381
|
+
}
|
|
382
|
+
),
|
|
383
|
+
// Appointment tools
|
|
384
|
+
schedule_appointment: /* @__PURE__ */ jsx(
|
|
385
|
+
"svg",
|
|
386
|
+
{
|
|
387
|
+
"aria-hidden": "true",
|
|
388
|
+
className: "h-4 w-4",
|
|
389
|
+
fill: "none",
|
|
390
|
+
viewBox: "0 0 24 24",
|
|
391
|
+
stroke: "currentColor",
|
|
392
|
+
strokeWidth: "1.5",
|
|
393
|
+
children: /* @__PURE__ */ jsx(
|
|
394
|
+
"path",
|
|
395
|
+
{
|
|
396
|
+
strokeLinecap: "round",
|
|
397
|
+
strokeLinejoin: "round",
|
|
398
|
+
d: "M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5m-9-6h.008v.008H12v-.008zM12 15h.008v.008H12V15zm0 2.25h.008v.008H12v-.008zM9.75 15h.008v.008H9.75V15zm0 2.25h.008v.008H9.75v-.008zM7.5 15h.008v.008H7.5V15zm0 2.25h.008v.008H7.5v-.008zm6.75-4.5h.008v.008h-.008v-.008zm0 2.25h.008v.008h-.008V15zm0 2.25h.008v.008h-.008v-.008zm2.25-4.5h.008v.008H16.5v-.008zm0 2.25h.008v.008H16.5V15z"
|
|
399
|
+
}
|
|
400
|
+
)
|
|
401
|
+
}
|
|
402
|
+
),
|
|
403
|
+
// Document tools
|
|
404
|
+
create_document: /* @__PURE__ */ jsx(
|
|
405
|
+
"svg",
|
|
406
|
+
{
|
|
407
|
+
"aria-hidden": "true",
|
|
408
|
+
className: "h-4 w-4",
|
|
409
|
+
fill: "none",
|
|
410
|
+
viewBox: "0 0 24 24",
|
|
411
|
+
stroke: "currentColor",
|
|
412
|
+
strokeWidth: "1.5",
|
|
413
|
+
children: /* @__PURE__ */ jsx(
|
|
414
|
+
"path",
|
|
415
|
+
{
|
|
416
|
+
strokeLinecap: "round",
|
|
417
|
+
strokeLinejoin: "round",
|
|
418
|
+
d: "M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m3.75 9v6m3-3H9m1.5-12H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"
|
|
419
|
+
}
|
|
420
|
+
)
|
|
421
|
+
}
|
|
422
|
+
),
|
|
423
|
+
// Provider tools
|
|
424
|
+
search_providers: /* @__PURE__ */ jsxs(
|
|
425
|
+
"svg",
|
|
426
|
+
{
|
|
427
|
+
"aria-hidden": "true",
|
|
428
|
+
className: "h-4 w-4",
|
|
429
|
+
fill: "none",
|
|
430
|
+
viewBox: "0 0 24 24",
|
|
431
|
+
stroke: "currentColor",
|
|
432
|
+
strokeWidth: "1.5",
|
|
433
|
+
children: [
|
|
434
|
+
/* @__PURE__ */ jsx(
|
|
435
|
+
"path",
|
|
436
|
+
{
|
|
437
|
+
strokeLinecap: "round",
|
|
438
|
+
strokeLinejoin: "round",
|
|
439
|
+
d: "M15 10.5a3 3 0 11-6 0 3 3 0 016 0z"
|
|
440
|
+
}
|
|
441
|
+
),
|
|
442
|
+
/* @__PURE__ */ jsx(
|
|
443
|
+
"path",
|
|
444
|
+
{
|
|
445
|
+
strokeLinecap: "round",
|
|
446
|
+
strokeLinejoin: "round",
|
|
447
|
+
d: "M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1115 0z"
|
|
448
|
+
}
|
|
449
|
+
)
|
|
450
|
+
]
|
|
451
|
+
}
|
|
452
|
+
),
|
|
453
|
+
// Default tool icon
|
|
454
|
+
default: /* @__PURE__ */ jsx(
|
|
455
|
+
"svg",
|
|
456
|
+
{
|
|
457
|
+
"aria-hidden": "true",
|
|
458
|
+
className: "h-4 w-4",
|
|
459
|
+
fill: "none",
|
|
460
|
+
viewBox: "0 0 24 24",
|
|
461
|
+
stroke: "currentColor",
|
|
462
|
+
strokeWidth: "1.5",
|
|
463
|
+
children: /* @__PURE__ */ jsx(
|
|
464
|
+
"path",
|
|
465
|
+
{
|
|
466
|
+
strokeLinecap: "round",
|
|
467
|
+
strokeLinejoin: "round",
|
|
468
|
+
d: "M11.42 15.17L17.25 21A2.652 2.652 0 0021 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 11-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 004.486-6.336l-3.276 3.277a3.004 3.004 0 01-2.25-2.25l3.276-3.276a4.5 4.5 0 00-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437l1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008z"
|
|
469
|
+
}
|
|
470
|
+
)
|
|
471
|
+
}
|
|
472
|
+
)
|
|
473
|
+
};
|
|
474
|
+
function getToolIcon(toolName) {
|
|
475
|
+
return TOOL_ICONS[toolName] || TOOL_ICONS.default;
|
|
476
|
+
}
|
|
477
|
+
function ResourceLink({ link, onClick, className }) {
|
|
478
|
+
const handleClick = (e) => {
|
|
479
|
+
if (onClick) {
|
|
480
|
+
e.preventDefault();
|
|
481
|
+
onClick(link);
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
const linkTypeIcons = {
|
|
485
|
+
patient: /* @__PURE__ */ jsx(
|
|
486
|
+
"svg",
|
|
487
|
+
{
|
|
488
|
+
"aria-hidden": "true",
|
|
489
|
+
className: "h-4 w-4",
|
|
490
|
+
fill: "none",
|
|
491
|
+
viewBox: "0 0 24 24",
|
|
492
|
+
stroke: "currentColor",
|
|
493
|
+
strokeWidth: "1.5",
|
|
494
|
+
children: /* @__PURE__ */ jsx(
|
|
495
|
+
"path",
|
|
496
|
+
{
|
|
497
|
+
strokeLinecap: "round",
|
|
498
|
+
strokeLinejoin: "round",
|
|
499
|
+
d: "M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"
|
|
500
|
+
}
|
|
501
|
+
)
|
|
502
|
+
}
|
|
503
|
+
),
|
|
504
|
+
document: /* @__PURE__ */ jsx(
|
|
505
|
+
"svg",
|
|
506
|
+
{
|
|
507
|
+
"aria-hidden": "true",
|
|
508
|
+
className: "h-4 w-4",
|
|
509
|
+
fill: "none",
|
|
510
|
+
viewBox: "0 0 24 24",
|
|
511
|
+
stroke: "currentColor",
|
|
512
|
+
strokeWidth: "1.5",
|
|
513
|
+
children: /* @__PURE__ */ jsx(
|
|
514
|
+
"path",
|
|
515
|
+
{
|
|
516
|
+
strokeLinecap: "round",
|
|
517
|
+
strokeLinejoin: "round",
|
|
518
|
+
d: "M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"
|
|
519
|
+
}
|
|
520
|
+
)
|
|
521
|
+
}
|
|
522
|
+
),
|
|
523
|
+
appointment: /* @__PURE__ */ jsx(
|
|
524
|
+
"svg",
|
|
525
|
+
{
|
|
526
|
+
"aria-hidden": "true",
|
|
527
|
+
className: "h-4 w-4",
|
|
528
|
+
fill: "none",
|
|
529
|
+
viewBox: "0 0 24 24",
|
|
530
|
+
stroke: "currentColor",
|
|
531
|
+
strokeWidth: "1.5",
|
|
532
|
+
children: /* @__PURE__ */ jsx(
|
|
533
|
+
"path",
|
|
534
|
+
{
|
|
535
|
+
strokeLinecap: "round",
|
|
536
|
+
strokeLinejoin: "round",
|
|
537
|
+
d: "M6.75 3v2.25M17.25 3v2.25M3 18.75V7.5a2.25 2.25 0 012.25-2.25h13.5A2.25 2.25 0 0121 7.5v11.25m-18 0A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75m-18 0v-7.5A2.25 2.25 0 015.25 9h13.5A2.25 2.25 0 0121 11.25v7.5"
|
|
538
|
+
}
|
|
539
|
+
)
|
|
540
|
+
}
|
|
541
|
+
),
|
|
542
|
+
order: /* @__PURE__ */ jsx(
|
|
543
|
+
"svg",
|
|
544
|
+
{
|
|
545
|
+
"aria-hidden": "true",
|
|
546
|
+
className: "h-4 w-4",
|
|
547
|
+
fill: "none",
|
|
548
|
+
viewBox: "0 0 24 24",
|
|
549
|
+
stroke: "currentColor",
|
|
550
|
+
strokeWidth: "1.5",
|
|
551
|
+
children: /* @__PURE__ */ jsx(
|
|
552
|
+
"path",
|
|
553
|
+
{
|
|
554
|
+
strokeLinecap: "round",
|
|
555
|
+
strokeLinejoin: "round",
|
|
556
|
+
d: "M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 002.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 00-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 00.75-.75 2.25 2.25 0 00-.1-.664m-5.8 0A2.251 2.251 0 0113.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25z"
|
|
557
|
+
}
|
|
558
|
+
)
|
|
559
|
+
}
|
|
560
|
+
),
|
|
561
|
+
provider: /* @__PURE__ */ jsxs(
|
|
562
|
+
"svg",
|
|
563
|
+
{
|
|
564
|
+
"aria-hidden": "true",
|
|
565
|
+
className: "h-4 w-4",
|
|
566
|
+
fill: "none",
|
|
567
|
+
viewBox: "0 0 24 24",
|
|
568
|
+
stroke: "currentColor",
|
|
569
|
+
strokeWidth: "1.5",
|
|
570
|
+
children: [
|
|
571
|
+
/* @__PURE__ */ jsx(
|
|
572
|
+
"path",
|
|
573
|
+
{
|
|
574
|
+
strokeLinecap: "round",
|
|
575
|
+
strokeLinejoin: "round",
|
|
576
|
+
d: "M15 10.5a3 3 0 11-6 0 3 3 0 016 0z"
|
|
577
|
+
}
|
|
578
|
+
),
|
|
579
|
+
/* @__PURE__ */ jsx(
|
|
580
|
+
"path",
|
|
581
|
+
{
|
|
582
|
+
strokeLinecap: "round",
|
|
583
|
+
strokeLinejoin: "round",
|
|
584
|
+
d: "M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1115 0z"
|
|
585
|
+
}
|
|
586
|
+
)
|
|
587
|
+
]
|
|
588
|
+
}
|
|
589
|
+
),
|
|
590
|
+
external: /* @__PURE__ */ jsx(
|
|
591
|
+
"svg",
|
|
592
|
+
{
|
|
593
|
+
"aria-hidden": "true",
|
|
594
|
+
className: "h-4 w-4",
|
|
595
|
+
fill: "none",
|
|
596
|
+
viewBox: "0 0 24 24",
|
|
597
|
+
stroke: "currentColor",
|
|
598
|
+
strokeWidth: "1.5",
|
|
599
|
+
children: /* @__PURE__ */ jsx(
|
|
600
|
+
"path",
|
|
601
|
+
{
|
|
602
|
+
strokeLinecap: "round",
|
|
603
|
+
strokeLinejoin: "round",
|
|
604
|
+
d: "M13.5 6H5.25A2.25 2.25 0 003 8.25v10.5A2.25 2.25 0 005.25 21h10.5A2.25 2.25 0 0018 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"
|
|
605
|
+
}
|
|
606
|
+
)
|
|
607
|
+
}
|
|
608
|
+
),
|
|
609
|
+
internal: /* @__PURE__ */ jsx(
|
|
610
|
+
"svg",
|
|
611
|
+
{
|
|
612
|
+
"aria-hidden": "true",
|
|
613
|
+
className: "h-4 w-4",
|
|
614
|
+
fill: "none",
|
|
615
|
+
viewBox: "0 0 24 24",
|
|
616
|
+
stroke: "currentColor",
|
|
617
|
+
strokeWidth: "1.5",
|
|
618
|
+
children: /* @__PURE__ */ jsx(
|
|
619
|
+
"path",
|
|
620
|
+
{
|
|
621
|
+
strokeLinecap: "round",
|
|
622
|
+
strokeLinejoin: "round",
|
|
623
|
+
d: "M13.19 8.688a4.5 4.5 0 011.242 7.244l-4.5 4.5a4.5 4.5 0 01-6.364-6.364l1.757-1.757m13.35-.622l1.757-1.757a4.5 4.5 0 00-6.364-6.364l-4.5 4.5a4.5 4.5 0 001.242 7.244"
|
|
624
|
+
}
|
|
625
|
+
)
|
|
626
|
+
}
|
|
627
|
+
)
|
|
628
|
+
};
|
|
629
|
+
const icon = link.type ? linkTypeIcons[link.type] : linkTypeIcons.internal;
|
|
630
|
+
return /* @__PURE__ */ jsxs(
|
|
631
|
+
"a",
|
|
632
|
+
{
|
|
633
|
+
href: link.href,
|
|
634
|
+
onClick: handleClick,
|
|
635
|
+
className: cn(
|
|
636
|
+
"inline-flex items-center gap-1.5 rounded-md px-2.5 py-1.5",
|
|
637
|
+
"bg-primary-50 text-primary-900 hover:bg-primary-100",
|
|
638
|
+
"dark:bg-primary-900/30 dark:text-primary-300 dark:hover:bg-primary-900/50",
|
|
639
|
+
"text-sm font-medium transition-colors",
|
|
640
|
+
"focus:ring-primary-500 focus:ring-2 focus:ring-offset-2 focus:outline-none",
|
|
641
|
+
"dark:focus:ring-offset-neutral-900",
|
|
642
|
+
className
|
|
643
|
+
),
|
|
644
|
+
children: [
|
|
645
|
+
icon,
|
|
646
|
+
/* @__PURE__ */ jsx("span", { children: link.label }),
|
|
647
|
+
link.type === "external" && /* @__PURE__ */ jsx(
|
|
648
|
+
"svg",
|
|
649
|
+
{
|
|
650
|
+
"aria-hidden": "true",
|
|
651
|
+
className: "h-3 w-3 opacity-60",
|
|
652
|
+
fill: "none",
|
|
653
|
+
viewBox: "0 0 24 24",
|
|
654
|
+
stroke: "currentColor",
|
|
655
|
+
strokeWidth: "2",
|
|
656
|
+
children: /* @__PURE__ */ jsx(
|
|
657
|
+
"path",
|
|
658
|
+
{
|
|
659
|
+
strokeLinecap: "round",
|
|
660
|
+
strokeLinejoin: "round",
|
|
661
|
+
d: "M4.5 19.5l15-15m0 0H8.25m11.25 0v11.25"
|
|
662
|
+
}
|
|
663
|
+
)
|
|
664
|
+
}
|
|
665
|
+
)
|
|
666
|
+
]
|
|
667
|
+
}
|
|
668
|
+
);
|
|
669
|
+
}
|
|
670
|
+
function ToolResultDisplay({
|
|
671
|
+
result,
|
|
672
|
+
onLinkClick,
|
|
673
|
+
showRawData = false,
|
|
674
|
+
className
|
|
675
|
+
}) {
|
|
676
|
+
const [showJson, setShowJson] = React.useState(false);
|
|
677
|
+
if (result.type === "error") {
|
|
678
|
+
return /* @__PURE__ */ jsx(
|
|
679
|
+
"div",
|
|
680
|
+
{
|
|
681
|
+
className: cn(
|
|
682
|
+
"mt-2 rounded-md bg-red-50 p-3 dark:bg-red-900/20",
|
|
683
|
+
className
|
|
684
|
+
),
|
|
685
|
+
children: /* @__PURE__ */ jsx("p", { className: "text-sm text-red-700 dark:text-red-300", children: typeof result.data === "string" ? String(result.data) : "An error occurred" })
|
|
686
|
+
}
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
const hasRawData = result.type === "json" && result.data !== void 0 && result.data !== null;
|
|
690
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("space-y-2", className), children: [
|
|
691
|
+
result.summary && /* @__PURE__ */ jsx("p", { className: "text-sm text-neutral-700 dark:text-neutral-300", children: result.summary }),
|
|
692
|
+
result.link && /* @__PURE__ */ jsx(ResourceLink, { link: result.link, onClick: onLinkClick }),
|
|
693
|
+
result.resources && result.resources.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex flex-wrap gap-2", children: result.resources.map((resource) => /* @__PURE__ */ jsx(
|
|
694
|
+
ResourceLink,
|
|
695
|
+
{
|
|
696
|
+
link: {
|
|
697
|
+
href: resource.uri || "#",
|
|
698
|
+
label: resource.name,
|
|
699
|
+
type: resource.type
|
|
700
|
+
},
|
|
701
|
+
onClick: onLinkClick
|
|
702
|
+
},
|
|
703
|
+
resource.id
|
|
704
|
+
)) }),
|
|
705
|
+
hasRawData && showRawData && /* @__PURE__ */ jsxs("div", { className: "mt-2", children: [
|
|
706
|
+
/* @__PURE__ */ jsxs(
|
|
707
|
+
"button",
|
|
708
|
+
{
|
|
709
|
+
onClick: () => setShowJson(!showJson),
|
|
710
|
+
className: "flex items-center gap-1 text-xs text-neutral-600 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-300",
|
|
711
|
+
children: [
|
|
712
|
+
/* @__PURE__ */ jsx(
|
|
713
|
+
"svg",
|
|
714
|
+
{
|
|
715
|
+
"aria-hidden": "true",
|
|
716
|
+
className: cn(
|
|
717
|
+
"h-3 w-3 transition-transform",
|
|
718
|
+
showJson && "rotate-90"
|
|
719
|
+
),
|
|
720
|
+
fill: "none",
|
|
721
|
+
viewBox: "0 0 24 24",
|
|
722
|
+
stroke: "currentColor",
|
|
723
|
+
strokeWidth: "2",
|
|
724
|
+
children: /* @__PURE__ */ jsx(
|
|
725
|
+
"path",
|
|
726
|
+
{
|
|
727
|
+
strokeLinecap: "round",
|
|
728
|
+
strokeLinejoin: "round",
|
|
729
|
+
d: "M9 5l7 7-7 7"
|
|
730
|
+
}
|
|
731
|
+
)
|
|
732
|
+
}
|
|
733
|
+
),
|
|
734
|
+
showJson ? "Hide" : "Show",
|
|
735
|
+
" raw data"
|
|
736
|
+
]
|
|
737
|
+
}
|
|
738
|
+
),
|
|
739
|
+
showJson && /* @__PURE__ */ jsx("pre", { className: "mt-2 max-h-40 overflow-auto rounded-md bg-neutral-100 p-2 text-xs dark:bg-neutral-800", children: JSON.stringify(result.data, null, 2) })
|
|
740
|
+
] })
|
|
741
|
+
] });
|
|
742
|
+
}
|
|
743
|
+
var toolCallVariants = cva(
|
|
744
|
+
["rounded-lg border", "overflow-hidden", "transition-all duration-200"],
|
|
745
|
+
{
|
|
746
|
+
variants: {
|
|
747
|
+
status: {
|
|
748
|
+
pending: "border-neutral-200 bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-800/50",
|
|
749
|
+
running: "border-primary-200 bg-primary-50/50 dark:border-primary-800 dark:bg-primary-900/20",
|
|
750
|
+
success: "border-green-200 bg-green-50/50 dark:border-green-800 dark:bg-green-900/20",
|
|
751
|
+
error: "border-red-200 bg-red-50/50 dark:border-red-800 dark:bg-red-900/20",
|
|
752
|
+
cancelled: "border-neutral-200 bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-800/50 opacity-60"
|
|
753
|
+
},
|
|
754
|
+
compact: {
|
|
755
|
+
true: "p-2",
|
|
756
|
+
false: "p-3"
|
|
757
|
+
}
|
|
758
|
+
},
|
|
759
|
+
defaultVariants: {
|
|
760
|
+
status: "pending",
|
|
761
|
+
compact: false
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
);
|
|
765
|
+
var TOOL_FRIENDLY_NAMES = {
|
|
766
|
+
create_patient: "Creating patient",
|
|
767
|
+
get_patient: "Looking up patient",
|
|
768
|
+
search_patients: "Searching patients",
|
|
769
|
+
update_patient: "Updating patient",
|
|
770
|
+
delete_patient: "Removing patient",
|
|
771
|
+
schedule_appointment: "Scheduling appointment",
|
|
772
|
+
cancel_appointment: "Canceling appointment",
|
|
773
|
+
update_appointment: "Updating appointment",
|
|
774
|
+
create_document: "Creating document",
|
|
775
|
+
upload_document: "Uploading document",
|
|
776
|
+
get_document: "Retrieving document",
|
|
777
|
+
search_documents: "Searching documents",
|
|
778
|
+
create_order: "Creating order",
|
|
779
|
+
send_message: "Sending message",
|
|
780
|
+
search: "Searching",
|
|
781
|
+
search_providers: "Searching for providers"
|
|
782
|
+
};
|
|
783
|
+
function getToolFriendlyName(toolName, status) {
|
|
784
|
+
const baseName = TOOL_FRIENDLY_NAMES[toolName] || toolName.replace(/_/g, " ");
|
|
785
|
+
if (status === "success") {
|
|
786
|
+
if (baseName.startsWith("Creating"))
|
|
787
|
+
return baseName.replace("Creating", "Created");
|
|
788
|
+
if (baseName.startsWith("Scheduling"))
|
|
789
|
+
return baseName.replace("Scheduling", "Scheduled");
|
|
790
|
+
if (baseName.startsWith("Searching for"))
|
|
791
|
+
return baseName.replace("Searching for", "Found");
|
|
792
|
+
if (baseName.startsWith("Searching"))
|
|
793
|
+
return baseName.replace("Searching", "Found");
|
|
794
|
+
if (baseName.startsWith("Looking"))
|
|
795
|
+
return baseName.replace("Looking", "Found");
|
|
796
|
+
if (baseName.startsWith("Updating"))
|
|
797
|
+
return baseName.replace("Updating", "Updated");
|
|
798
|
+
if (baseName.startsWith("Removing"))
|
|
799
|
+
return baseName.replace("Removing", "Removed");
|
|
800
|
+
if (baseName.startsWith("Canceling"))
|
|
801
|
+
return baseName.replace("Canceling", "Canceled");
|
|
802
|
+
if (baseName.startsWith("Retrieving"))
|
|
803
|
+
return baseName.replace("Retrieving", "Retrieved");
|
|
804
|
+
if (baseName.startsWith("Uploading"))
|
|
805
|
+
return baseName.replace("Uploading", "Uploaded");
|
|
806
|
+
if (baseName.startsWith("Sending"))
|
|
807
|
+
return baseName.replace("Sending", "Sent");
|
|
808
|
+
}
|
|
809
|
+
return baseName;
|
|
810
|
+
}
|
|
811
|
+
function getParameterSummary(toolName, params) {
|
|
812
|
+
const paramMap = Object.fromEntries(params.map((p) => [p.name, p.value]));
|
|
813
|
+
if (toolName === "create_patient" && paramMap.firstName && paramMap.lastName) {
|
|
814
|
+
return `${paramMap.firstName} ${paramMap.lastName}`;
|
|
815
|
+
}
|
|
816
|
+
if (toolName.includes("search") && paramMap.query) {
|
|
817
|
+
return `"${paramMap.query}"`;
|
|
818
|
+
}
|
|
819
|
+
if (toolName.includes("appointment") && paramMap.patientName) {
|
|
820
|
+
const date = paramMap.preferredDate || paramMap.date;
|
|
821
|
+
return date ? `${paramMap.patientName} on ${date}` : String(paramMap.patientName);
|
|
822
|
+
}
|
|
823
|
+
if (toolName === "search_providers" && paramMap.zipcode) {
|
|
824
|
+
const service = paramMap.service;
|
|
825
|
+
return service ? `${service} near ${paramMap.zipcode}` : `near ${paramMap.zipcode}`;
|
|
826
|
+
}
|
|
827
|
+
return null;
|
|
828
|
+
}
|
|
829
|
+
function MCPToolCallDisplay({
|
|
830
|
+
toolCall,
|
|
831
|
+
showParameters = true,
|
|
832
|
+
collapsible = true,
|
|
833
|
+
defaultCollapsed = true,
|
|
834
|
+
compact,
|
|
835
|
+
onLinkClick,
|
|
836
|
+
className
|
|
837
|
+
}) {
|
|
838
|
+
const [showDetails, setShowDetails] = React.useState(!defaultCollapsed);
|
|
839
|
+
const formatDuration = (ms) => {
|
|
840
|
+
if (!ms) return null;
|
|
841
|
+
if (ms < 1e3) return `${ms}ms`;
|
|
842
|
+
return `${(ms / 1e3).toFixed(1)}s`;
|
|
843
|
+
};
|
|
844
|
+
const friendlyName = getToolFriendlyName(toolCall.toolName, toolCall.status);
|
|
845
|
+
const paramSummary = getParameterSummary(
|
|
846
|
+
toolCall.toolName,
|
|
847
|
+
toolCall.parameters
|
|
848
|
+
);
|
|
849
|
+
return /* @__PURE__ */ jsx(
|
|
850
|
+
"div",
|
|
851
|
+
{
|
|
852
|
+
"data-slot": "ai-tool-call",
|
|
853
|
+
className: cn(
|
|
854
|
+
toolCallVariants({ status: toolCall.status, compact }),
|
|
855
|
+
className
|
|
856
|
+
),
|
|
857
|
+
children: /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
858
|
+
/* @__PURE__ */ jsx(
|
|
859
|
+
"div",
|
|
860
|
+
{
|
|
861
|
+
"data-slot": "ai-tool-icon",
|
|
862
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-white/50 text-neutral-600 dark:bg-neutral-700/50 dark:text-neutral-400",
|
|
863
|
+
children: getToolIcon(toolCall.toolName)
|
|
864
|
+
}
|
|
865
|
+
),
|
|
866
|
+
/* @__PURE__ */ jsxs("div", { "data-slot": "ai-tool-content", className: "min-w-0 flex-1", children: [
|
|
867
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
868
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium text-neutral-900 dark:text-white", children: friendlyName }),
|
|
869
|
+
/* @__PURE__ */ jsx(ToolStatusIcon, { status: toolCall.status }),
|
|
870
|
+
toolCall.duration && /* @__PURE__ */ jsx("span", { className: "text-xs text-neutral-600 dark:text-neutral-400", children: formatDuration(toolCall.duration) })
|
|
871
|
+
] }),
|
|
872
|
+
paramSummary && toolCall.status !== "success" && /* @__PURE__ */ jsx("p", { className: "text-muted-foreground mt-0.5 text-sm", children: paramSummary }),
|
|
873
|
+
toolCall.result && /* @__PURE__ */ jsx("div", { "data-slot": "ai-tool-result", className: "mt-2", children: /* @__PURE__ */ jsx(
|
|
874
|
+
ToolResultDisplay,
|
|
875
|
+
{
|
|
876
|
+
result: toolCall.result,
|
|
877
|
+
onLinkClick,
|
|
878
|
+
showRawData: showDetails
|
|
879
|
+
}
|
|
880
|
+
) }),
|
|
881
|
+
toolCall.error && /* @__PURE__ */ jsx("div", { className: "mt-2 rounded-md bg-red-100 p-2 dark:bg-red-900/30", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-red-700 dark:text-red-300", children: toolCall.error }) }),
|
|
882
|
+
collapsible && showParameters && toolCall.parameters.length > 0 && /* @__PURE__ */ jsxs(
|
|
883
|
+
"button",
|
|
884
|
+
{
|
|
885
|
+
onClick: () => setShowDetails(!showDetails),
|
|
886
|
+
className: "mt-2 flex items-center gap-1 text-xs text-neutral-600 hover:text-neutral-700 dark:text-neutral-400 dark:hover:text-neutral-300",
|
|
887
|
+
children: [
|
|
888
|
+
/* @__PURE__ */ jsx(
|
|
889
|
+
"svg",
|
|
890
|
+
{
|
|
891
|
+
"aria-hidden": "true",
|
|
892
|
+
className: cn(
|
|
893
|
+
"h-3 w-3 transition-transform",
|
|
894
|
+
showDetails && "rotate-90"
|
|
895
|
+
),
|
|
896
|
+
fill: "none",
|
|
897
|
+
viewBox: "0 0 24 24",
|
|
898
|
+
stroke: "currentColor",
|
|
899
|
+
strokeWidth: "2",
|
|
900
|
+
children: /* @__PURE__ */ jsx(
|
|
901
|
+
"path",
|
|
902
|
+
{
|
|
903
|
+
strokeLinecap: "round",
|
|
904
|
+
strokeLinejoin: "round",
|
|
905
|
+
d: "M9 5l7 7-7 7"
|
|
906
|
+
}
|
|
907
|
+
)
|
|
908
|
+
}
|
|
909
|
+
),
|
|
910
|
+
showDetails ? "Hide" : "Show",
|
|
911
|
+
" details"
|
|
912
|
+
]
|
|
913
|
+
}
|
|
914
|
+
),
|
|
915
|
+
showDetails && showParameters && toolCall.parameters.length > 0 && /* @__PURE__ */ jsxs(
|
|
916
|
+
"div",
|
|
917
|
+
{
|
|
918
|
+
"data-slot": "ai-tool-parameters",
|
|
919
|
+
className: "mt-3 rounded-md bg-neutral-100 p-2 dark:bg-neutral-800",
|
|
920
|
+
children: [
|
|
921
|
+
/* @__PURE__ */ jsx("h4", { className: "mb-1.5 text-xs font-medium tracking-wide text-neutral-600 uppercase dark:text-neutral-400", children: "Parameters" }),
|
|
922
|
+
/* @__PURE__ */ jsx("div", { className: "space-y-0.5", children: toolCall.parameters.map((param) => /* @__PURE__ */ jsxs(
|
|
923
|
+
"div",
|
|
924
|
+
{
|
|
925
|
+
className: "flex items-start gap-2 text-xs",
|
|
926
|
+
children: [
|
|
927
|
+
/* @__PURE__ */ jsxs("span", { className: "font-mono text-neutral-600 dark:text-neutral-400", children: [
|
|
928
|
+
param.name,
|
|
929
|
+
":"
|
|
930
|
+
] }),
|
|
931
|
+
/* @__PURE__ */ jsx("span", { className: "font-mono text-neutral-700 dark:text-neutral-300", children: typeof param.value === "string" ? param.value : JSON.stringify(param.value) })
|
|
932
|
+
]
|
|
933
|
+
},
|
|
934
|
+
param.name
|
|
935
|
+
)) })
|
|
936
|
+
]
|
|
937
|
+
}
|
|
938
|
+
)
|
|
939
|
+
] })
|
|
940
|
+
] })
|
|
941
|
+
}
|
|
942
|
+
);
|
|
943
|
+
}
|
|
944
|
+
var avatarVariants = cva(
|
|
945
|
+
"flex shrink-0 items-center justify-center rounded-full",
|
|
946
|
+
{
|
|
947
|
+
variants: {
|
|
948
|
+
role: {
|
|
949
|
+
user: "bg-primary-100 text-primary-900 dark:bg-primary-900/50 dark:text-primary-300",
|
|
950
|
+
assistant: "bg-primary-800 text-white dark:bg-primary-800",
|
|
951
|
+
system: "bg-neutral-200 text-neutral-600 dark:bg-neutral-700 dark:text-neutral-400",
|
|
952
|
+
tool: "bg-amber-100 text-amber-700 dark:bg-amber-900/50 dark:text-amber-300"
|
|
953
|
+
},
|
|
954
|
+
size: {
|
|
955
|
+
sm: "h-6 w-6 text-xs",
|
|
956
|
+
md: "h-8 w-8 text-sm",
|
|
957
|
+
lg: "h-10 w-10 text-base"
|
|
958
|
+
}
|
|
959
|
+
},
|
|
960
|
+
defaultVariants: {
|
|
961
|
+
role: "user",
|
|
962
|
+
size: "md"
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
);
|
|
966
|
+
function MessageAvatar({
|
|
967
|
+
role,
|
|
968
|
+
size,
|
|
969
|
+
userName,
|
|
970
|
+
className
|
|
971
|
+
}) {
|
|
972
|
+
const getInitials = (name) => {
|
|
973
|
+
if (!name) return "?";
|
|
974
|
+
return name.split(" ").map((n) => n[0]).join("").substring(0, 2).toUpperCase();
|
|
975
|
+
};
|
|
976
|
+
return /* @__PURE__ */ jsx(
|
|
977
|
+
"div",
|
|
978
|
+
{
|
|
979
|
+
"data-slot": "ai-message-avatar",
|
|
980
|
+
className: cn(avatarVariants({ role, size }), className),
|
|
981
|
+
children: role === "assistant" ? /* @__PURE__ */ jsx(SparklesIcon, { size: "md" }) : role === "user" ? /* @__PURE__ */ jsx("span", { className: "font-medium", children: getInitials(userName) }) : role === "system" ? /* @__PURE__ */ jsx(
|
|
982
|
+
"svg",
|
|
983
|
+
{
|
|
984
|
+
"aria-hidden": "true",
|
|
985
|
+
className: "h-4 w-4",
|
|
986
|
+
fill: "none",
|
|
987
|
+
viewBox: "0 0 24 24",
|
|
988
|
+
stroke: "currentColor",
|
|
989
|
+
strokeWidth: "1.5",
|
|
990
|
+
children: /* @__PURE__ */ jsx(
|
|
991
|
+
"path",
|
|
992
|
+
{
|
|
993
|
+
strokeLinecap: "round",
|
|
994
|
+
strokeLinejoin: "round",
|
|
995
|
+
d: "M11.25 11.25l.041-.02a.75.75 0 011.063.852l-.708 2.836a.75.75 0 001.063.853l.041-.021M21 12a9 9 0 11-18 0 9 9 0 0118 0zm-9-3.75h.008v.008H12V8.25z"
|
|
996
|
+
}
|
|
997
|
+
)
|
|
998
|
+
}
|
|
999
|
+
) : /* @__PURE__ */ jsx(
|
|
1000
|
+
"svg",
|
|
1001
|
+
{
|
|
1002
|
+
"aria-hidden": "true",
|
|
1003
|
+
className: "h-4 w-4",
|
|
1004
|
+
fill: "none",
|
|
1005
|
+
viewBox: "0 0 24 24",
|
|
1006
|
+
stroke: "currentColor",
|
|
1007
|
+
strokeWidth: "1.5",
|
|
1008
|
+
children: /* @__PURE__ */ jsx(
|
|
1009
|
+
"path",
|
|
1010
|
+
{
|
|
1011
|
+
strokeLinecap: "round",
|
|
1012
|
+
strokeLinejoin: "round",
|
|
1013
|
+
d: "M11.42 15.17L17.25 21A2.652 2.652 0 0021 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 11-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 004.486-6.336l-3.276 3.277a3.004 3.004 0 01-2.25-2.25l3.276-3.276a4.5 4.5 0 00-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437l1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008z"
|
|
1014
|
+
}
|
|
1015
|
+
)
|
|
1016
|
+
}
|
|
1017
|
+
)
|
|
1018
|
+
}
|
|
1019
|
+
);
|
|
1020
|
+
}
|
|
1021
|
+
function AITypingIndicator({ className }) {
|
|
1022
|
+
const dotStyle = {
|
|
1023
|
+
width: "6px",
|
|
1024
|
+
height: "6px",
|
|
1025
|
+
minWidth: "6px",
|
|
1026
|
+
minHeight: "6px",
|
|
1027
|
+
flexShrink: 0
|
|
1028
|
+
};
|
|
1029
|
+
return /* @__PURE__ */ jsxs(
|
|
1030
|
+
"div",
|
|
1031
|
+
{
|
|
1032
|
+
"data-slot": "ai-typing-indicator",
|
|
1033
|
+
className: cn("inline-flex items-center justify-center gap-2", className),
|
|
1034
|
+
children: [
|
|
1035
|
+
/* @__PURE__ */ jsx(
|
|
1036
|
+
"span",
|
|
1037
|
+
{
|
|
1038
|
+
className: "rounded-full bg-neutral-500 dark:bg-neutral-400",
|
|
1039
|
+
style: {
|
|
1040
|
+
...dotStyle,
|
|
1041
|
+
animation: "typing-dot 1.4s infinite ease-in-out both",
|
|
1042
|
+
animationDelay: "-0.32s"
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
),
|
|
1046
|
+
/* @__PURE__ */ jsx(
|
|
1047
|
+
"span",
|
|
1048
|
+
{
|
|
1049
|
+
className: "rounded-full bg-neutral-500 dark:bg-neutral-400",
|
|
1050
|
+
style: {
|
|
1051
|
+
...dotStyle,
|
|
1052
|
+
animation: "typing-dot 1.4s infinite ease-in-out both",
|
|
1053
|
+
animationDelay: "-0.16s"
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
),
|
|
1057
|
+
/* @__PURE__ */ jsx(
|
|
1058
|
+
"span",
|
|
1059
|
+
{
|
|
1060
|
+
className: "rounded-full bg-neutral-500 dark:bg-neutral-400",
|
|
1061
|
+
style: {
|
|
1062
|
+
...dotStyle,
|
|
1063
|
+
animation: "typing-dot 1.4s infinite ease-in-out both"
|
|
1064
|
+
}
|
|
1065
|
+
}
|
|
1066
|
+
),
|
|
1067
|
+
/* @__PURE__ */ jsx("style", { children: `
|
|
1068
|
+
@keyframes typing-dot {
|
|
1069
|
+
0%, 80%, 100% { opacity: 0.4; }
|
|
1070
|
+
40% { opacity: 1; }
|
|
1071
|
+
}
|
|
1072
|
+
` })
|
|
1073
|
+
]
|
|
1074
|
+
}
|
|
1075
|
+
);
|
|
1076
|
+
}
|
|
1077
|
+
function ContentBlock({
|
|
1078
|
+
content,
|
|
1079
|
+
onLinkClick,
|
|
1080
|
+
messageId,
|
|
1081
|
+
streaming,
|
|
1082
|
+
role,
|
|
1083
|
+
renderTextContent
|
|
1084
|
+
}) {
|
|
1085
|
+
const [isCollapsed, setIsCollapsed] = React.useState(
|
|
1086
|
+
content.collapsed ?? false
|
|
1087
|
+
);
|
|
1088
|
+
if (content.type === "text" && content.text) {
|
|
1089
|
+
if (renderTextContent) {
|
|
1090
|
+
return /* @__PURE__ */ jsx("div", { className: "prose prose-sm dark:prose-invert max-w-none", children: renderTextContent(content.text, { messageId, streaming, role }) });
|
|
1091
|
+
}
|
|
1092
|
+
return /* @__PURE__ */ jsx("div", { className: "prose prose-sm dark:prose-invert max-w-none", children: /* @__PURE__ */ jsx("p", { className: "whitespace-pre-wrap", children: content.text }) });
|
|
1093
|
+
}
|
|
1094
|
+
if (content.type === "tool_use" && content.toolCall) {
|
|
1095
|
+
return /* @__PURE__ */ jsx(
|
|
1096
|
+
MCPToolCallDisplay,
|
|
1097
|
+
{
|
|
1098
|
+
toolCall: content.toolCall,
|
|
1099
|
+
onLinkClick,
|
|
1100
|
+
defaultCollapsed: content.collapsed
|
|
1101
|
+
}
|
|
1102
|
+
);
|
|
1103
|
+
}
|
|
1104
|
+
if (content.type === "thinking" && content.text) {
|
|
1105
|
+
return /* @__PURE__ */ jsxs(
|
|
1106
|
+
"div",
|
|
1107
|
+
{
|
|
1108
|
+
"data-slot": "ai-message-thinking",
|
|
1109
|
+
className: "rounded-lg border border-neutral-200 bg-neutral-50 dark:border-neutral-700 dark:bg-neutral-800/50",
|
|
1110
|
+
children: [
|
|
1111
|
+
/* @__PURE__ */ jsxs(
|
|
1112
|
+
"button",
|
|
1113
|
+
{
|
|
1114
|
+
onClick: () => setIsCollapsed(!isCollapsed),
|
|
1115
|
+
className: "flex w-full items-center justify-between px-3 py-2 text-left",
|
|
1116
|
+
children: [
|
|
1117
|
+
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground flex items-center gap-2 text-sm", children: [
|
|
1118
|
+
/* @__PURE__ */ jsx(
|
|
1119
|
+
"svg",
|
|
1120
|
+
{
|
|
1121
|
+
"aria-hidden": "true",
|
|
1122
|
+
className: "h-4 w-4",
|
|
1123
|
+
fill: "none",
|
|
1124
|
+
viewBox: "0 0 24 24",
|
|
1125
|
+
stroke: "currentColor",
|
|
1126
|
+
strokeWidth: "1.5",
|
|
1127
|
+
children: /* @__PURE__ */ jsx(
|
|
1128
|
+
"path",
|
|
1129
|
+
{
|
|
1130
|
+
strokeLinecap: "round",
|
|
1131
|
+
strokeLinejoin: "round",
|
|
1132
|
+
d: "M9.813 15.904L9 18.75l-.813-2.846a4.5 4.5 0 00-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 003.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 003.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 00-3.09 3.09zM18.259 8.715L18 9.75l-.259-1.035a3.375 3.375 0 00-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 002.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 002.456 2.456L21.75 6l-1.035.259a3.375 3.375 0 00-2.456 2.456zM16.894 20.567L16.5 21.75l-.394-1.183a2.25 2.25 0 00-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 001.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 001.423 1.423l1.183.394-1.183.394a2.25 2.25 0 00-1.423 1.423z"
|
|
1133
|
+
}
|
|
1134
|
+
)
|
|
1135
|
+
}
|
|
1136
|
+
),
|
|
1137
|
+
"Thinking..."
|
|
1138
|
+
] }),
|
|
1139
|
+
/* @__PURE__ */ jsx(
|
|
1140
|
+
ChevronIcon,
|
|
1141
|
+
{
|
|
1142
|
+
direction: isCollapsed ? "right" : "down",
|
|
1143
|
+
className: "text-neutral-400"
|
|
1144
|
+
}
|
|
1145
|
+
)
|
|
1146
|
+
]
|
|
1147
|
+
}
|
|
1148
|
+
),
|
|
1149
|
+
!isCollapsed && /* @__PURE__ */ jsx("div", { className: "border-t border-neutral-200 px-3 py-2 dark:border-neutral-700", children: /* @__PURE__ */ jsx("p", { className: "text-sm text-neutral-600 italic dark:text-neutral-400", children: content.text }) })
|
|
1150
|
+
]
|
|
1151
|
+
}
|
|
1152
|
+
);
|
|
1153
|
+
}
|
|
1154
|
+
if (content.type === "code" && content.text) {
|
|
1155
|
+
return /* @__PURE__ */ jsx(
|
|
1156
|
+
"pre",
|
|
1157
|
+
{
|
|
1158
|
+
"data-slot": "ai-message-code",
|
|
1159
|
+
className: "rounded-lg bg-neutral-900 p-3 text-sm dark:bg-neutral-950",
|
|
1160
|
+
children: /* @__PURE__ */ jsx(
|
|
1161
|
+
"code",
|
|
1162
|
+
{
|
|
1163
|
+
className: content.language ? `language-${content.language}` : "",
|
|
1164
|
+
children: content.text
|
|
1165
|
+
}
|
|
1166
|
+
)
|
|
1167
|
+
}
|
|
1168
|
+
);
|
|
1169
|
+
}
|
|
1170
|
+
if (content.type === "image" && content.imageUrl) {
|
|
1171
|
+
const safeHref = /^\s*javascript:/i.test(content.imageUrl) ? void 0 : content.imageUrl;
|
|
1172
|
+
return /* @__PURE__ */ jsx(
|
|
1173
|
+
"a",
|
|
1174
|
+
{
|
|
1175
|
+
href: safeHref,
|
|
1176
|
+
target: "_blank",
|
|
1177
|
+
rel: "noopener noreferrer",
|
|
1178
|
+
className: "block w-fit transition-transform hover:scale-[1.02]",
|
|
1179
|
+
"aria-label": `View ${content.name || "Uploaded image"}`,
|
|
1180
|
+
children: /* @__PURE__ */ jsx(
|
|
1181
|
+
"img",
|
|
1182
|
+
{
|
|
1183
|
+
src: content.imageUrl,
|
|
1184
|
+
alt: content.name || "Uploaded image",
|
|
1185
|
+
loading: "lazy",
|
|
1186
|
+
className: "my-1 max-h-64 w-auto rounded-lg object-cover"
|
|
1187
|
+
}
|
|
1188
|
+
)
|
|
1189
|
+
}
|
|
1190
|
+
);
|
|
1191
|
+
}
|
|
1192
|
+
if (content.type === "file") {
|
|
1193
|
+
const sizeLabel = typeof content.fileSize === "number" ? formatFileSize(content.fileSize) : void 0;
|
|
1194
|
+
const card = /* @__PURE__ */ jsxs("div", { className: "my-1 flex items-center gap-3 rounded-lg bg-neutral-100 p-3 transition-colors dark:bg-neutral-800", children: [
|
|
1195
|
+
/* @__PURE__ */ jsx("div", { className: "rounded-lg bg-neutral-200 p-2 dark:bg-neutral-700", children: /* @__PURE__ */ jsx(
|
|
1196
|
+
"svg",
|
|
1197
|
+
{
|
|
1198
|
+
"aria-hidden": "true",
|
|
1199
|
+
className: "h-6 w-6",
|
|
1200
|
+
fill: "none",
|
|
1201
|
+
viewBox: "0 0 24 24",
|
|
1202
|
+
stroke: "currentColor",
|
|
1203
|
+
strokeWidth: 2,
|
|
1204
|
+
children: /* @__PURE__ */ jsx(
|
|
1205
|
+
"path",
|
|
1206
|
+
{
|
|
1207
|
+
strokeLinecap: "round",
|
|
1208
|
+
strokeLinejoin: "round",
|
|
1209
|
+
d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"
|
|
1210
|
+
}
|
|
1211
|
+
)
|
|
1212
|
+
}
|
|
1213
|
+
) }),
|
|
1214
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1215
|
+
/* @__PURE__ */ jsx("p", { className: "truncate text-sm font-medium", children: content.name || "Document" }),
|
|
1216
|
+
sizeLabel && /* @__PURE__ */ jsx("p", { className: "text-xs opacity-70", children: sizeLabel })
|
|
1217
|
+
] })
|
|
1218
|
+
] });
|
|
1219
|
+
if (content.fileUrl) {
|
|
1220
|
+
const safeFileHref = /^\s*javascript:/i.test(content.fileUrl) ? void 0 : content.fileUrl;
|
|
1221
|
+
return /* @__PURE__ */ jsx(
|
|
1222
|
+
"a",
|
|
1223
|
+
{
|
|
1224
|
+
href: safeFileHref,
|
|
1225
|
+
target: "_blank",
|
|
1226
|
+
rel: "noopener noreferrer",
|
|
1227
|
+
className: "block w-fit no-underline",
|
|
1228
|
+
children: card
|
|
1229
|
+
}
|
|
1230
|
+
);
|
|
1231
|
+
}
|
|
1232
|
+
return card;
|
|
1233
|
+
}
|
|
1234
|
+
return null;
|
|
1235
|
+
}
|
|
1236
|
+
function formatFileSize(bytes) {
|
|
1237
|
+
if (bytes < 1024) return `${bytes} B`;
|
|
1238
|
+
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
|
1239
|
+
return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
|
|
1240
|
+
}
|
|
1241
|
+
var messageVariants = cva("flex gap-3", {
|
|
1242
|
+
variants: {
|
|
1243
|
+
role: {
|
|
1244
|
+
user: "flex-row-reverse",
|
|
1245
|
+
assistant: "flex-row",
|
|
1246
|
+
system: "flex-row justify-center",
|
|
1247
|
+
tool: "flex-row"
|
|
1248
|
+
}
|
|
1249
|
+
},
|
|
1250
|
+
defaultVariants: {
|
|
1251
|
+
role: "assistant"
|
|
1252
|
+
}
|
|
1253
|
+
});
|
|
1254
|
+
var bubbleVariants = cva("rounded-2xl px-4 py-2.5 w-fit max-w-[85%]", {
|
|
1255
|
+
variants: {
|
|
1256
|
+
variant: {
|
|
1257
|
+
user: "bg-primary-800 text-white dark:bg-primary-800",
|
|
1258
|
+
assistant: "bg-neutral-100 text-neutral-900 dark:bg-neutral-800 dark:text-white",
|
|
1259
|
+
system: "bg-neutral-100 text-neutral-600 dark:bg-neutral-800 dark:text-neutral-400 text-center text-sm max-w-[95%]",
|
|
1260
|
+
tool: "bg-transparent p-0 max-w-full w-full"
|
|
1261
|
+
}
|
|
1262
|
+
},
|
|
1263
|
+
defaultVariants: {
|
|
1264
|
+
variant: "assistant"
|
|
1265
|
+
}
|
|
1266
|
+
});
|
|
1267
|
+
var ChatBubble = React.forwardRef(
|
|
1268
|
+
({ className, variant, hasError, accent, style, children, ...props }, ref) => {
|
|
1269
|
+
return /* @__PURE__ */ jsx(
|
|
1270
|
+
"div",
|
|
1271
|
+
{
|
|
1272
|
+
ref,
|
|
1273
|
+
"data-slot": "chat-bubble",
|
|
1274
|
+
className: cn(
|
|
1275
|
+
bubbleVariants({ variant }),
|
|
1276
|
+
hasError && "border border-red-300 dark:border-red-700",
|
|
1277
|
+
className
|
|
1278
|
+
),
|
|
1279
|
+
style: accent ? { borderLeft: `3px solid ${accent}`, ...style } : style,
|
|
1280
|
+
...props,
|
|
1281
|
+
children
|
|
1282
|
+
}
|
|
1283
|
+
);
|
|
1284
|
+
}
|
|
1285
|
+
);
|
|
1286
|
+
ChatBubble.displayName = "ChatBubble";
|
|
1287
|
+
function AIMessageDisplay({
|
|
1288
|
+
message,
|
|
1289
|
+
userName,
|
|
1290
|
+
showAvatar = true,
|
|
1291
|
+
showTimestamp = false,
|
|
1292
|
+
onLinkClick,
|
|
1293
|
+
renderTextContent,
|
|
1294
|
+
className
|
|
1295
|
+
}) {
|
|
1296
|
+
const isStreaming = message.status === "streaming";
|
|
1297
|
+
const hasContent = message.content.length > 0;
|
|
1298
|
+
const formatTime = (timestamp) => {
|
|
1299
|
+
const date = new Date(timestamp);
|
|
1300
|
+
return date.toLocaleTimeString(void 0, {
|
|
1301
|
+
hour: "numeric",
|
|
1302
|
+
minute: "2-digit"
|
|
1303
|
+
});
|
|
1304
|
+
};
|
|
1305
|
+
if (message.role === "tool") {
|
|
1306
|
+
return /* @__PURE__ */ jsxs(
|
|
1307
|
+
"div",
|
|
1308
|
+
{
|
|
1309
|
+
"data-slot": "ai-message",
|
|
1310
|
+
className: cn(messageVariants({ role: message.role }), className),
|
|
1311
|
+
children: [
|
|
1312
|
+
showAvatar && /* @__PURE__ */ jsx(MessageAvatar, { role: message.role }),
|
|
1313
|
+
/* @__PURE__ */ jsx("div", { className: "flex-1 space-y-2", children: message.content.map((content, index) => /* @__PURE__ */ jsx(
|
|
1314
|
+
ContentBlock,
|
|
1315
|
+
{
|
|
1316
|
+
content,
|
|
1317
|
+
onLinkClick,
|
|
1318
|
+
messageId: message.id,
|
|
1319
|
+
streaming: isStreaming,
|
|
1320
|
+
role: message.role,
|
|
1321
|
+
renderTextContent
|
|
1322
|
+
},
|
|
1323
|
+
index
|
|
1324
|
+
)) })
|
|
1325
|
+
]
|
|
1326
|
+
}
|
|
1327
|
+
);
|
|
1328
|
+
}
|
|
1329
|
+
return /* @__PURE__ */ jsxs(
|
|
1330
|
+
"div",
|
|
1331
|
+
{
|
|
1332
|
+
"data-slot": "ai-message",
|
|
1333
|
+
className: cn(messageVariants({ role: message.role }), className),
|
|
1334
|
+
children: [
|
|
1335
|
+
showAvatar && message.role !== "system" && /* @__PURE__ */ jsx(MessageAvatar, { role: message.role, userName }),
|
|
1336
|
+
/* @__PURE__ */ jsxs(
|
|
1337
|
+
"div",
|
|
1338
|
+
{
|
|
1339
|
+
className: cn(
|
|
1340
|
+
"flex min-w-0 flex-1 flex-col gap-1",
|
|
1341
|
+
message.role === "user" && "items-end"
|
|
1342
|
+
),
|
|
1343
|
+
children: [
|
|
1344
|
+
/* @__PURE__ */ jsx(
|
|
1345
|
+
ChatBubble,
|
|
1346
|
+
{
|
|
1347
|
+
"data-slot": "ai-message-bubble",
|
|
1348
|
+
variant: message.role,
|
|
1349
|
+
hasError: message.status === "error",
|
|
1350
|
+
children: hasContent ? /* @__PURE__ */ jsx("div", { className: "space-y-3", children: message.content.map((content, index) => /* @__PURE__ */ jsx(
|
|
1351
|
+
ContentBlock,
|
|
1352
|
+
{
|
|
1353
|
+
content,
|
|
1354
|
+
onLinkClick,
|
|
1355
|
+
messageId: message.id,
|
|
1356
|
+
streaming: isStreaming,
|
|
1357
|
+
role: message.role,
|
|
1358
|
+
renderTextContent
|
|
1359
|
+
},
|
|
1360
|
+
index
|
|
1361
|
+
)) }) : isStreaming ? /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ jsx(AITypingIndicator, {}) }) : null
|
|
1362
|
+
}
|
|
1363
|
+
),
|
|
1364
|
+
showTimestamp && /* @__PURE__ */ jsx(
|
|
1365
|
+
"span",
|
|
1366
|
+
{
|
|
1367
|
+
"data-slot": "ai-message-timestamp",
|
|
1368
|
+
className: "px-2 text-xs text-neutral-500",
|
|
1369
|
+
children: formatTime(message.timestamp)
|
|
1370
|
+
}
|
|
1371
|
+
),
|
|
1372
|
+
message.status === "error" && /* @__PURE__ */ jsx("span", { className: "px-2 text-xs text-red-500", children: message.role === "user" ? "Failed to send" : "An error occurred" })
|
|
1373
|
+
]
|
|
1374
|
+
}
|
|
1375
|
+
)
|
|
1376
|
+
]
|
|
1377
|
+
}
|
|
1378
|
+
);
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
export { AILogoIcon, AIMessageDisplay, AITypingIndicator, ChatBubble, ChevronIcon, CloseIcon, MCPToolCallDisplay, MessageAvatar, RefreshIcon, ResourceLink, SendIcon, SparklesIcon, SpinnerIcon, ToolStatusIcon, getToolIcon };
|
|
1382
|
+
//# sourceMappingURL=chunk-XQE26F3G.js.map
|
|
1383
|
+
//# sourceMappingURL=chunk-XQE26F3G.js.map
|