@rodrigocoliveira/agno-react 2.0.0 → 2.1.1
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/README.md +35 -12
- package/dist/hooks/useAgnoToolExecution.d.ts +7 -11
- package/dist/hooks/useAgnoToolExecution.d.ts.map +1 -1
- package/dist/index.d.ts +3 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +645 -986
- package/dist/index.js.map +7 -10
- package/dist/index.mjs +564 -905
- package/dist/index.mjs.map +7 -10
- package/dist/ui/components/chart.d.ts +63 -0
- package/dist/ui/components/chart.d.ts.map +1 -0
- package/dist/ui/composed/agno-chat/agno-chat.d.ts +6 -4
- package/dist/ui/composed/agno-chat/agno-chat.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts +0 -4
- package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts.map +1 -1
- package/dist/ui/composed/agno-message/tools.d.ts.map +1 -1
- package/dist/ui/composed/generative-components/card-grid.d.ts +4 -0
- package/dist/ui/composed/generative-components/card-grid.d.ts.map +1 -0
- package/dist/ui/composed/generative-components/charts.d.ts +7 -0
- package/dist/ui/composed/generative-components/charts.d.ts.map +1 -0
- package/dist/ui/composed/index.d.ts +6 -2
- package/dist/ui/composed/index.d.ts.map +1 -1
- package/dist/ui/index.d.ts +8 -2
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui.js +586 -424
- package/dist/ui.js.map +9 -11
- package/dist/ui.mjs +606 -430
- package/dist/ui.mjs.map +9 -11
- package/package.json +7 -8
- package/dist/components/GenerativeUIRenderer.d.ts +0 -21
- package/dist/components/GenerativeUIRenderer.d.ts.map +0 -1
- package/dist/utils/component-registry.d.ts +0 -63
- package/dist/utils/component-registry.d.ts.map +0 -1
package/dist/ui.js
CHANGED
|
@@ -66,7 +66,6 @@ __export(exports_ui, {
|
|
|
66
66
|
ToolOutput: () => ToolOutput,
|
|
67
67
|
ToolInput: () => ToolInput,
|
|
68
68
|
ToolHeader: () => ToolHeader,
|
|
69
|
-
ToolGenerativeUI: () => ToolGenerativeUI,
|
|
70
69
|
ToolDebugCard: () => ToolDebugCard,
|
|
71
70
|
ToolContent: () => ToolContent,
|
|
72
71
|
Tool: () => Tool,
|
|
@@ -118,9 +117,11 @@ __export(exports_ui, {
|
|
|
118
117
|
PromptInputActionMenu: () => PromptInputActionMenu,
|
|
119
118
|
PromptInputActionAddAttachments: () => PromptInputActionAddAttachments,
|
|
120
119
|
PromptInput: () => PromptInput,
|
|
120
|
+
PieChart: () => PieChart,
|
|
121
121
|
MessageContent: () => MessageContent,
|
|
122
122
|
MessageAvatar: () => MessageAvatar,
|
|
123
123
|
Message: () => Message,
|
|
124
|
+
LineChart: () => LineChart,
|
|
124
125
|
InputGroupTextarea: () => InputGroupTextarea,
|
|
125
126
|
InputGroupText: () => InputGroupText,
|
|
126
127
|
InputGroupInput: () => InputGroupInput,
|
|
@@ -175,7 +176,15 @@ __export(exports_ui, {
|
|
|
175
176
|
Collapsible: () => Collapsible,
|
|
176
177
|
CodeBlockCopyButton: () => CodeBlockCopyButton,
|
|
177
178
|
CodeBlock: () => CodeBlock,
|
|
179
|
+
ChartTooltipContent: () => ChartTooltipContent,
|
|
180
|
+
ChartTooltip: () => ChartTooltip,
|
|
181
|
+
ChartStyle: () => ChartStyle,
|
|
182
|
+
ChartLegendContent: () => ChartLegendContent,
|
|
183
|
+
ChartLegend: () => ChartLegend,
|
|
184
|
+
ChartContainer: () => ChartContainer,
|
|
185
|
+
CardGrid: () => CardGrid,
|
|
178
186
|
Button: () => Button,
|
|
187
|
+
BarChart: () => BarChart,
|
|
179
188
|
Badge: () => Badge,
|
|
180
189
|
AvatarImage: () => AvatarImage,
|
|
181
190
|
AvatarFallback: () => AvatarFallback,
|
|
@@ -189,6 +198,7 @@ __export(exports_ui, {
|
|
|
189
198
|
ArtifactActions: () => ArtifactActions,
|
|
190
199
|
ArtifactAction: () => ArtifactAction,
|
|
191
200
|
Artifact: () => Artifact,
|
|
201
|
+
AreaChart: () => AreaChart,
|
|
192
202
|
AgnoMessageTools: () => AgnoMessageTools,
|
|
193
203
|
AgnoMessageReferences: () => AgnoMessageReferences,
|
|
194
204
|
AgnoMessageReasoning: () => AgnoMessageReasoning,
|
|
@@ -2886,7 +2896,7 @@ var PromptInputCommandSeparator = ({ className, ...props }) => /* @__PURE__ */ j
|
|
|
2886
2896
|
...props
|
|
2887
2897
|
});
|
|
2888
2898
|
// src/ui/composed/agno-message/message.tsx
|
|
2889
|
-
var
|
|
2899
|
+
var import_react16 = require("react");
|
|
2890
2900
|
var import_lucide_react23 = require("lucide-react");
|
|
2891
2901
|
|
|
2892
2902
|
// src/ui/composed/agno-message/context.ts
|
|
@@ -3209,311 +3219,25 @@ function useAgnoChatContext() {
|
|
|
3209
3219
|
return ctx;
|
|
3210
3220
|
}
|
|
3211
3221
|
|
|
3212
|
-
// src/components/GenerativeUIRenderer.tsx
|
|
3213
|
-
var import_react19 = __toESM(require("react"));
|
|
3214
|
-
|
|
3215
|
-
// src/utils/component-registry.ts
|
|
3216
|
-
class ComponentRegistry {
|
|
3217
|
-
static instance;
|
|
3218
|
-
components = new Map;
|
|
3219
|
-
constructor() {}
|
|
3220
|
-
static getInstance() {
|
|
3221
|
-
if (!ComponentRegistry.instance) {
|
|
3222
|
-
ComponentRegistry.instance = new ComponentRegistry;
|
|
3223
|
-
}
|
|
3224
|
-
return ComponentRegistry.instance;
|
|
3225
|
-
}
|
|
3226
|
-
register(type, renderer) {
|
|
3227
|
-
this.components.set(type, renderer);
|
|
3228
|
-
}
|
|
3229
|
-
registerBatch(components) {
|
|
3230
|
-
Object.entries(components).forEach(([type, renderer]) => {
|
|
3231
|
-
this.register(type, renderer);
|
|
3232
|
-
});
|
|
3233
|
-
}
|
|
3234
|
-
get(type) {
|
|
3235
|
-
return this.components.get(type);
|
|
3236
|
-
}
|
|
3237
|
-
has(type) {
|
|
3238
|
-
return this.components.has(type);
|
|
3239
|
-
}
|
|
3240
|
-
unregister(type) {
|
|
3241
|
-
this.components.delete(type);
|
|
3242
|
-
}
|
|
3243
|
-
getRegisteredTypes() {
|
|
3244
|
-
return Array.from(this.components.keys());
|
|
3245
|
-
}
|
|
3246
|
-
clear() {
|
|
3247
|
-
this.components.clear();
|
|
3248
|
-
}
|
|
3249
|
-
}
|
|
3250
|
-
function getComponentRegistry() {
|
|
3251
|
-
return ComponentRegistry.getInstance();
|
|
3252
|
-
}
|
|
3253
|
-
|
|
3254
|
-
// src/hooks/useAgnoToolExecution.ts
|
|
3255
|
-
var import_react18 = require("react");
|
|
3256
|
-
|
|
3257
|
-
// src/context/AgnoContext.tsx
|
|
3258
|
-
var import_react16 = require("react");
|
|
3259
|
-
var import_agno_client = require("@rodrigocoliveira/agno-client");
|
|
3260
|
-
var jsx_runtime37 = require("react/jsx-runtime");
|
|
3261
|
-
var AgnoContext = import_react16.createContext(null);
|
|
3262
|
-
|
|
3263
|
-
// src/context/ToolHandlerContext.tsx
|
|
3264
|
-
var import_react17 = require("react");
|
|
3265
|
-
var jsx_runtime38 = require("react/jsx-runtime");
|
|
3266
|
-
var ToolHandlerContext = import_react17.createContext(null);
|
|
3267
|
-
|
|
3268
|
-
// src/hooks/useAgnoToolExecution.ts
|
|
3269
|
-
var customRenderRegistry = new Map;
|
|
3270
|
-
function getCustomRender(key) {
|
|
3271
|
-
return customRenderRegistry.get(key);
|
|
3272
|
-
}
|
|
3273
|
-
|
|
3274
|
-
// src/components/GenerativeUIRenderer.tsx
|
|
3275
|
-
var jsx_runtime39 = require("react/jsx-runtime");
|
|
3276
|
-
|
|
3277
|
-
class UIErrorBoundary extends import_react19.default.Component {
|
|
3278
|
-
constructor(props) {
|
|
3279
|
-
super(props);
|
|
3280
|
-
this.state = { hasError: false };
|
|
3281
|
-
}
|
|
3282
|
-
static getDerivedStateFromError(error) {
|
|
3283
|
-
return { hasError: true, error };
|
|
3284
|
-
}
|
|
3285
|
-
componentDidCatch(error, errorInfo) {
|
|
3286
|
-
console.error("[GenerativeUIRenderer] Error rendering component:", error, errorInfo);
|
|
3287
|
-
this.props.onError?.(error);
|
|
3288
|
-
}
|
|
3289
|
-
render() {
|
|
3290
|
-
if (this.state.hasError) {
|
|
3291
|
-
return this.props.fallback || /* @__PURE__ */ jsx_runtime39.jsxs("div", {
|
|
3292
|
-
className: "p-4 border border-red-300 rounded-md bg-red-50 text-red-800",
|
|
3293
|
-
children: [
|
|
3294
|
-
/* @__PURE__ */ jsx_runtime39.jsx("p", {
|
|
3295
|
-
className: "font-semibold",
|
|
3296
|
-
children: "Failed to render UI component"
|
|
3297
|
-
}),
|
|
3298
|
-
/* @__PURE__ */ jsx_runtime39.jsx("p", {
|
|
3299
|
-
className: "text-sm mt-1",
|
|
3300
|
-
children: this.state.error?.message || "Unknown error"
|
|
3301
|
-
})
|
|
3302
|
-
]
|
|
3303
|
-
});
|
|
3304
|
-
}
|
|
3305
|
-
return this.props.children;
|
|
3306
|
-
}
|
|
3307
|
-
}
|
|
3308
|
-
function GenerativeUIRenderer({
|
|
3309
|
-
spec,
|
|
3310
|
-
className,
|
|
3311
|
-
onError
|
|
3312
|
-
}) {
|
|
3313
|
-
const registry = getComponentRegistry();
|
|
3314
|
-
if (spec.type === "custom") {
|
|
3315
|
-
const customSpec = spec;
|
|
3316
|
-
if (customSpec.renderKey) {
|
|
3317
|
-
const renderFn = getCustomRender(customSpec.renderKey);
|
|
3318
|
-
if (renderFn) {
|
|
3319
|
-
return /* @__PURE__ */ jsx_runtime39.jsx(UIErrorBoundary, {
|
|
3320
|
-
onError,
|
|
3321
|
-
children: /* @__PURE__ */ jsx_runtime39.jsx("div", {
|
|
3322
|
-
className,
|
|
3323
|
-
children: renderFn(customSpec.props || {})
|
|
3324
|
-
})
|
|
3325
|
-
});
|
|
3326
|
-
}
|
|
3327
|
-
}
|
|
3328
|
-
return /* @__PURE__ */ jsx_runtime39.jsxs("div", {
|
|
3329
|
-
className: `p-4 border border-yellow-300 rounded-md bg-yellow-50 text-yellow-800 ${className || ""}`,
|
|
3330
|
-
children: [
|
|
3331
|
-
/* @__PURE__ */ jsx_runtime39.jsx("p", {
|
|
3332
|
-
className: "font-semibold",
|
|
3333
|
-
children: "Custom component not available"
|
|
3334
|
-
}),
|
|
3335
|
-
/* @__PURE__ */ jsx_runtime39.jsx("p", {
|
|
3336
|
-
className: "text-sm mt-1",
|
|
3337
|
-
children: "The custom render function for this component is not available."
|
|
3338
|
-
})
|
|
3339
|
-
]
|
|
3340
|
-
});
|
|
3341
|
-
}
|
|
3342
|
-
if (spec.type === "chart") {
|
|
3343
|
-
const chartSpec = spec;
|
|
3344
|
-
const chartType = `chart:${chartSpec.component}`;
|
|
3345
|
-
if (registry.has(chartType)) {
|
|
3346
|
-
const ChartRenderer = registry.get(chartType);
|
|
3347
|
-
return /* @__PURE__ */ jsx_runtime39.jsx(UIErrorBoundary, {
|
|
3348
|
-
onError,
|
|
3349
|
-
children: /* @__PURE__ */ jsx_runtime39.jsxs("div", {
|
|
3350
|
-
className,
|
|
3351
|
-
children: [
|
|
3352
|
-
chartSpec.title && /* @__PURE__ */ jsx_runtime39.jsx("h3", {
|
|
3353
|
-
className: "font-semibold mb-2",
|
|
3354
|
-
children: chartSpec.title
|
|
3355
|
-
}),
|
|
3356
|
-
chartSpec.description && /* @__PURE__ */ jsx_runtime39.jsx("p", {
|
|
3357
|
-
className: "text-sm text-gray-600 mb-4",
|
|
3358
|
-
children: chartSpec.description
|
|
3359
|
-
}),
|
|
3360
|
-
/* @__PURE__ */ jsx_runtime39.jsx(ChartRenderer, {
|
|
3361
|
-
...chartSpec.props
|
|
3362
|
-
})
|
|
3363
|
-
]
|
|
3364
|
-
})
|
|
3365
|
-
});
|
|
3366
|
-
}
|
|
3367
|
-
return /* @__PURE__ */ jsx_runtime39.jsxs("div", {
|
|
3368
|
-
className: `p-4 border border-gray-300 rounded-md ${className || ""}`,
|
|
3369
|
-
children: [
|
|
3370
|
-
/* @__PURE__ */ jsx_runtime39.jsx("p", {
|
|
3371
|
-
className: "font-semibold mb-2",
|
|
3372
|
-
children: chartSpec.title || "Chart Data"
|
|
3373
|
-
}),
|
|
3374
|
-
chartSpec.description && /* @__PURE__ */ jsx_runtime39.jsx("p", {
|
|
3375
|
-
className: "text-sm text-gray-600 mb-2",
|
|
3376
|
-
children: chartSpec.description
|
|
3377
|
-
}),
|
|
3378
|
-
/* @__PURE__ */ jsx_runtime39.jsx("pre", {
|
|
3379
|
-
className: "text-xs bg-gray-100 p-2 rounded overflow-auto",
|
|
3380
|
-
children: JSON.stringify(chartSpec.props.data, null, 2)
|
|
3381
|
-
})
|
|
3382
|
-
]
|
|
3383
|
-
});
|
|
3384
|
-
}
|
|
3385
|
-
if (spec.type === "card-grid") {
|
|
3386
|
-
const cardGridSpec = spec;
|
|
3387
|
-
if (registry.has("card-grid")) {
|
|
3388
|
-
const CardGridRenderer = registry.get("card-grid");
|
|
3389
|
-
return /* @__PURE__ */ jsx_runtime39.jsx(UIErrorBoundary, {
|
|
3390
|
-
onError,
|
|
3391
|
-
children: /* @__PURE__ */ jsx_runtime39.jsxs("div", {
|
|
3392
|
-
className,
|
|
3393
|
-
children: [
|
|
3394
|
-
cardGridSpec.title && /* @__PURE__ */ jsx_runtime39.jsx("h3", {
|
|
3395
|
-
className: "font-semibold mb-2",
|
|
3396
|
-
children: cardGridSpec.title
|
|
3397
|
-
}),
|
|
3398
|
-
cardGridSpec.description && /* @__PURE__ */ jsx_runtime39.jsx("p", {
|
|
3399
|
-
className: "text-sm text-gray-600 mb-4",
|
|
3400
|
-
children: cardGridSpec.description
|
|
3401
|
-
}),
|
|
3402
|
-
/* @__PURE__ */ jsx_runtime39.jsx(CardGridRenderer, {
|
|
3403
|
-
...cardGridSpec.props
|
|
3404
|
-
})
|
|
3405
|
-
]
|
|
3406
|
-
})
|
|
3407
|
-
});
|
|
3408
|
-
}
|
|
3409
|
-
}
|
|
3410
|
-
if (spec.type === "table") {
|
|
3411
|
-
const tableSpec = spec;
|
|
3412
|
-
if (registry.has("table")) {
|
|
3413
|
-
const TableRenderer = registry.get("table");
|
|
3414
|
-
return /* @__PURE__ */ jsx_runtime39.jsx(UIErrorBoundary, {
|
|
3415
|
-
onError,
|
|
3416
|
-
children: /* @__PURE__ */ jsx_runtime39.jsxs("div", {
|
|
3417
|
-
className,
|
|
3418
|
-
children: [
|
|
3419
|
-
tableSpec.title && /* @__PURE__ */ jsx_runtime39.jsx("h3", {
|
|
3420
|
-
className: "font-semibold mb-2",
|
|
3421
|
-
children: tableSpec.title
|
|
3422
|
-
}),
|
|
3423
|
-
tableSpec.description && /* @__PURE__ */ jsx_runtime39.jsx("p", {
|
|
3424
|
-
className: "text-sm text-gray-600 mb-4",
|
|
3425
|
-
children: tableSpec.description
|
|
3426
|
-
}),
|
|
3427
|
-
/* @__PURE__ */ jsx_runtime39.jsx(TableRenderer, {
|
|
3428
|
-
...tableSpec.props
|
|
3429
|
-
})
|
|
3430
|
-
]
|
|
3431
|
-
})
|
|
3432
|
-
});
|
|
3433
|
-
}
|
|
3434
|
-
}
|
|
3435
|
-
if (spec.type === "markdown") {
|
|
3436
|
-
const markdownSpec = spec;
|
|
3437
|
-
if (registry.has("markdown")) {
|
|
3438
|
-
const MarkdownRenderer = registry.get("markdown");
|
|
3439
|
-
return /* @__PURE__ */ jsx_runtime39.jsx(UIErrorBoundary, {
|
|
3440
|
-
onError,
|
|
3441
|
-
children: /* @__PURE__ */ jsx_runtime39.jsx("div", {
|
|
3442
|
-
className,
|
|
3443
|
-
children: /* @__PURE__ */ jsx_runtime39.jsx(MarkdownRenderer, {
|
|
3444
|
-
...markdownSpec.props
|
|
3445
|
-
})
|
|
3446
|
-
})
|
|
3447
|
-
});
|
|
3448
|
-
}
|
|
3449
|
-
return /* @__PURE__ */ jsx_runtime39.jsx("div", {
|
|
3450
|
-
className,
|
|
3451
|
-
children: markdownSpec.props.content
|
|
3452
|
-
});
|
|
3453
|
-
}
|
|
3454
|
-
if (spec.type === "artifact") {
|
|
3455
|
-
const artifactSpec = spec;
|
|
3456
|
-
return /* @__PURE__ */ jsx_runtime39.jsx(UIErrorBoundary, {
|
|
3457
|
-
onError,
|
|
3458
|
-
children: /* @__PURE__ */ jsx_runtime39.jsxs("div", {
|
|
3459
|
-
className: `p-4 border rounded-md ${className || ""}`,
|
|
3460
|
-
children: [
|
|
3461
|
-
artifactSpec.title && /* @__PURE__ */ jsx_runtime39.jsx("h3", {
|
|
3462
|
-
className: "font-semibold mb-4",
|
|
3463
|
-
children: artifactSpec.title
|
|
3464
|
-
}),
|
|
3465
|
-
artifactSpec.description && /* @__PURE__ */ jsx_runtime39.jsx("p", {
|
|
3466
|
-
className: "text-sm text-gray-600 mb-4",
|
|
3467
|
-
children: artifactSpec.description
|
|
3468
|
-
}),
|
|
3469
|
-
/* @__PURE__ */ jsx_runtime39.jsx("div", {
|
|
3470
|
-
className: "space-y-4",
|
|
3471
|
-
children: artifactSpec.props.content?.map((childSpec, index) => /* @__PURE__ */ jsx_runtime39.jsx(GenerativeUIRenderer, {
|
|
3472
|
-
spec: childSpec,
|
|
3473
|
-
onError
|
|
3474
|
-
}, index))
|
|
3475
|
-
})
|
|
3476
|
-
]
|
|
3477
|
-
})
|
|
3478
|
-
});
|
|
3479
|
-
}
|
|
3480
|
-
return /* @__PURE__ */ jsx_runtime39.jsxs("div", {
|
|
3481
|
-
className: `p-4 border border-gray-300 rounded-md ${className || ""}`,
|
|
3482
|
-
children: [
|
|
3483
|
-
/* @__PURE__ */ jsx_runtime39.jsx("p", {
|
|
3484
|
-
className: "font-semibold",
|
|
3485
|
-
children: "Unsupported UI component"
|
|
3486
|
-
}),
|
|
3487
|
-
/* @__PURE__ */ jsx_runtime39.jsxs("p", {
|
|
3488
|
-
className: "text-sm text-gray-600 mt-1",
|
|
3489
|
-
children: [
|
|
3490
|
-
"Component type: ",
|
|
3491
|
-
spec.type
|
|
3492
|
-
]
|
|
3493
|
-
})
|
|
3494
|
-
]
|
|
3495
|
-
});
|
|
3496
|
-
}
|
|
3497
|
-
|
|
3498
3222
|
// src/ui/composed/agno-chat/tool-building-blocks.tsx
|
|
3499
|
-
var
|
|
3223
|
+
var jsx_runtime37 = require("react/jsx-runtime");
|
|
3500
3224
|
var getToolState = (tool) => tool.tool_call_error ? "output-error" : "output-available";
|
|
3501
3225
|
function ToolDebugCard({ tool, defaultOpen }) {
|
|
3502
3226
|
const output = tool.result ?? tool.content;
|
|
3503
|
-
return /* @__PURE__ */
|
|
3227
|
+
return /* @__PURE__ */ jsx_runtime37.jsxs(Tool, {
|
|
3504
3228
|
defaultOpen,
|
|
3505
3229
|
children: [
|
|
3506
|
-
/* @__PURE__ */
|
|
3230
|
+
/* @__PURE__ */ jsx_runtime37.jsx(ToolHeader, {
|
|
3507
3231
|
title: tool.tool_name,
|
|
3508
3232
|
type: "tool-use",
|
|
3509
3233
|
state: getToolState(tool)
|
|
3510
3234
|
}),
|
|
3511
|
-
/* @__PURE__ */
|
|
3235
|
+
/* @__PURE__ */ jsx_runtime37.jsxs(ToolContent, {
|
|
3512
3236
|
children: [
|
|
3513
|
-
/* @__PURE__ */
|
|
3237
|
+
/* @__PURE__ */ jsx_runtime37.jsx(ToolInput, {
|
|
3514
3238
|
input: tool.tool_args
|
|
3515
3239
|
}),
|
|
3516
|
-
output ? /* @__PURE__ */
|
|
3240
|
+
output ? /* @__PURE__ */ jsx_runtime37.jsx(ToolOutput, {
|
|
3517
3241
|
output,
|
|
3518
3242
|
errorText: tool.tool_call_error ? "Tool execution failed" : undefined
|
|
3519
3243
|
}) : null
|
|
@@ -3522,47 +3246,26 @@ function ToolDebugCard({ tool, defaultOpen }) {
|
|
|
3522
3246
|
]
|
|
3523
3247
|
});
|
|
3524
3248
|
}
|
|
3525
|
-
function ToolGenerativeUI({ tool }) {
|
|
3526
|
-
const uiComponent = tool.ui_component;
|
|
3527
|
-
if (!uiComponent)
|
|
3528
|
-
return null;
|
|
3529
|
-
return uiComponent.layout === "artifact" ? /* @__PURE__ */ jsx_runtime40.jsx(Artifact, {
|
|
3530
|
-
children: /* @__PURE__ */ jsx_runtime40.jsx(GenerativeUIRenderer, {
|
|
3531
|
-
spec: uiComponent,
|
|
3532
|
-
className: "w-full p-2"
|
|
3533
|
-
})
|
|
3534
|
-
}) : /* @__PURE__ */ jsx_runtime40.jsx(GenerativeUIRenderer, {
|
|
3535
|
-
spec: uiComponent,
|
|
3536
|
-
className: "w-full"
|
|
3537
|
-
});
|
|
3538
|
-
}
|
|
3539
3249
|
|
|
3540
3250
|
// src/ui/composed/agno-message/tools.tsx
|
|
3541
|
-
var
|
|
3251
|
+
var jsx_runtime38 = require("react/jsx-runtime");
|
|
3542
3252
|
function AgnoMessageTools({ renderTool: renderToolProp } = {}) {
|
|
3543
3253
|
const { message, classNames, renderTool: ctxMsgRenderTool } = useAgnoMessageContext();
|
|
3544
3254
|
const { renderTool: ctxChatRenderTool, isDebug } = useAgnoChatContext();
|
|
3545
3255
|
const renderTool = renderToolProp ?? ctxMsgRenderTool ?? ctxChatRenderTool;
|
|
3546
3256
|
if (!message.tool_calls || message.tool_calls.length === 0)
|
|
3547
3257
|
return null;
|
|
3548
|
-
return /* @__PURE__ */
|
|
3258
|
+
return /* @__PURE__ */ jsx_runtime38.jsx("div", {
|
|
3549
3259
|
className: cn("space-y-2 pt-1", classNames?.assistant?.toolCalls),
|
|
3550
3260
|
children: message.tool_calls.map((tool, idx) => {
|
|
3551
|
-
const defaultRender = () => /* @__PURE__ */
|
|
3552
|
-
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
}),
|
|
3556
|
-
isDebug ? /* @__PURE__ */ jsx_runtime41.jsx(ToolDebugCard, {
|
|
3557
|
-
tool,
|
|
3558
|
-
defaultOpen: idx === 0
|
|
3559
|
-
}) : null
|
|
3560
|
-
]
|
|
3561
|
-
});
|
|
3261
|
+
const defaultRender = () => isDebug ? /* @__PURE__ */ jsx_runtime38.jsx(ToolDebugCard, {
|
|
3262
|
+
tool,
|
|
3263
|
+
defaultOpen: idx === 0
|
|
3264
|
+
}) : null;
|
|
3562
3265
|
const node = renderTool ? renderTool(tool, { index: idx, isDebug, defaultRender }) : defaultRender();
|
|
3563
3266
|
if (node === null || node === undefined)
|
|
3564
3267
|
return null;
|
|
3565
|
-
return /* @__PURE__ */
|
|
3268
|
+
return /* @__PURE__ */ jsx_runtime38.jsx("div", {
|
|
3566
3269
|
children: node
|
|
3567
3270
|
}, tool.tool_call_id || idx);
|
|
3568
3271
|
})
|
|
@@ -3570,14 +3273,14 @@ function AgnoMessageTools({ renderTool: renderToolProp } = {}) {
|
|
|
3570
3273
|
}
|
|
3571
3274
|
|
|
3572
3275
|
// src/ui/composed/agno-message/content.tsx
|
|
3573
|
-
var
|
|
3276
|
+
var jsx_runtime39 = require("react/jsx-runtime");
|
|
3574
3277
|
function AgnoMessageContent() {
|
|
3575
3278
|
const { message } = useAgnoMessageContext();
|
|
3576
3279
|
if (!message.content)
|
|
3577
3280
|
return null;
|
|
3578
|
-
return /* @__PURE__ */
|
|
3281
|
+
return /* @__PURE__ */ jsx_runtime39.jsx("div", {
|
|
3579
3282
|
className: "prose prose-sm dark:prose-invert max-w-none prose-p:leading-relaxed prose-pre:bg-muted prose-pre:border prose-pre:border-border",
|
|
3580
|
-
children: /* @__PURE__ */
|
|
3283
|
+
children: /* @__PURE__ */ jsx_runtime39.jsx(Response, {
|
|
3581
3284
|
children: message.content
|
|
3582
3285
|
})
|
|
3583
3286
|
});
|
|
@@ -3585,19 +3288,19 @@ function AgnoMessageContent() {
|
|
|
3585
3288
|
|
|
3586
3289
|
// src/ui/composed/agno-message/references.tsx
|
|
3587
3290
|
var import_lucide_react21 = require("lucide-react");
|
|
3588
|
-
var
|
|
3291
|
+
var jsx_runtime40 = require("react/jsx-runtime");
|
|
3589
3292
|
function AgnoMessageReferences() {
|
|
3590
3293
|
const { message, classNames } = useAgnoMessageContext();
|
|
3591
3294
|
const references = message.extra_data?.references;
|
|
3592
3295
|
if (!references || references.length === 0)
|
|
3593
3296
|
return null;
|
|
3594
|
-
return /* @__PURE__ */
|
|
3297
|
+
return /* @__PURE__ */ jsx_runtime40.jsxs("div", {
|
|
3595
3298
|
className: cn("space-y-2 pt-1", classNames?.assistant?.references),
|
|
3596
3299
|
children: [
|
|
3597
|
-
/* @__PURE__ */
|
|
3300
|
+
/* @__PURE__ */ jsx_runtime40.jsxs("div", {
|
|
3598
3301
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3599
3302
|
children: [
|
|
3600
|
-
/* @__PURE__ */
|
|
3303
|
+
/* @__PURE__ */ jsx_runtime40.jsx(import_lucide_react21.FileText, {
|
|
3601
3304
|
className: "h-3.5 w-3.5"
|
|
3602
3305
|
}),
|
|
3603
3306
|
"References (",
|
|
@@ -3605,22 +3308,22 @@ function AgnoMessageReferences() {
|
|
|
3605
3308
|
")"
|
|
3606
3309
|
]
|
|
3607
3310
|
}),
|
|
3608
|
-
/* @__PURE__ */
|
|
3311
|
+
/* @__PURE__ */ jsx_runtime40.jsx("div", {
|
|
3609
3312
|
className: "space-y-2",
|
|
3610
|
-
children: references.map((refData, idx) => /* @__PURE__ */
|
|
3313
|
+
children: references.map((refData, idx) => /* @__PURE__ */ jsx_runtime40.jsxs("div", {
|
|
3611
3314
|
className: "text-xs space-y-1.5",
|
|
3612
3315
|
children: [
|
|
3613
|
-
refData.query && /* @__PURE__ */
|
|
3316
|
+
refData.query && /* @__PURE__ */ jsx_runtime40.jsxs("div", {
|
|
3614
3317
|
className: "font-medium text-foreground",
|
|
3615
3318
|
children: [
|
|
3616
3319
|
"Query: ",
|
|
3617
3320
|
refData.query
|
|
3618
3321
|
]
|
|
3619
3322
|
}),
|
|
3620
|
-
refData.references.map((ref, refIdx) => /* @__PURE__ */
|
|
3323
|
+
refData.references.map((ref, refIdx) => /* @__PURE__ */ jsx_runtime40.jsxs("div", {
|
|
3621
3324
|
className: "bg-muted/50 border border-border p-2.5 rounded-lg",
|
|
3622
3325
|
children: [
|
|
3623
|
-
/* @__PURE__ */
|
|
3326
|
+
/* @__PURE__ */ jsx_runtime40.jsxs("div", {
|
|
3624
3327
|
className: "italic text-muted-foreground mb-1",
|
|
3625
3328
|
children: [
|
|
3626
3329
|
'"',
|
|
@@ -3628,7 +3331,7 @@ function AgnoMessageReferences() {
|
|
|
3628
3331
|
'"'
|
|
3629
3332
|
]
|
|
3630
3333
|
}),
|
|
3631
|
-
/* @__PURE__ */
|
|
3334
|
+
/* @__PURE__ */ jsx_runtime40.jsxs("div", {
|
|
3632
3335
|
className: "text-muted-foreground/70",
|
|
3633
3336
|
children: [
|
|
3634
3337
|
"Source: ",
|
|
@@ -3651,7 +3354,7 @@ function AgnoMessageReferences() {
|
|
|
3651
3354
|
|
|
3652
3355
|
// src/ui/composed/agno-message/footer.tsx
|
|
3653
3356
|
var import_lucide_react22 = require("lucide-react");
|
|
3654
|
-
var
|
|
3357
|
+
var jsx_runtime41 = require("react/jsx-runtime");
|
|
3655
3358
|
function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
3656
3359
|
const { message, classNames, actions, isLastAssistantMessage, formatTimestamp } = useAgnoMessageContext();
|
|
3657
3360
|
const hasError = message.streamingError;
|
|
@@ -3659,7 +3362,7 @@ function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
|
3659
3362
|
const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
|
|
3660
3363
|
if (!actions?.assistant && !showTimestamp && !hasError)
|
|
3661
3364
|
return null;
|
|
3662
|
-
return /* @__PURE__ */
|
|
3365
|
+
return /* @__PURE__ */ jsx_runtime41.jsxs("div", {
|
|
3663
3366
|
className: "flex items-center gap-2 pt-1",
|
|
3664
3367
|
children: [
|
|
3665
3368
|
actions?.assistant && (() => {
|
|
@@ -3667,21 +3370,21 @@ function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
|
3667
3370
|
if (visibility === "last-assistant" && !isLastAssistantMessage)
|
|
3668
3371
|
return null;
|
|
3669
3372
|
const useHover = visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage;
|
|
3670
|
-
return /* @__PURE__ */
|
|
3373
|
+
return /* @__PURE__ */ jsx_runtime41.jsx("div", {
|
|
3671
3374
|
className: cn("flex items-center gap-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100", classNames?.assistant?.actions),
|
|
3672
3375
|
children: actions.assistant(message)
|
|
3673
3376
|
});
|
|
3674
3377
|
})(),
|
|
3675
|
-
hasError && /* @__PURE__ */
|
|
3378
|
+
hasError && /* @__PURE__ */ jsx_runtime41.jsxs("span", {
|
|
3676
3379
|
className: "flex items-center gap-1 text-[11px] text-destructive",
|
|
3677
3380
|
children: [
|
|
3678
|
-
/* @__PURE__ */
|
|
3381
|
+
/* @__PURE__ */ jsx_runtime41.jsx(import_lucide_react22.AlertCircle, {
|
|
3679
3382
|
className: "h-3 w-3"
|
|
3680
3383
|
}),
|
|
3681
3384
|
"Error"
|
|
3682
3385
|
]
|
|
3683
3386
|
}),
|
|
3684
|
-
showTimestamp && /* @__PURE__ */
|
|
3387
|
+
showTimestamp && /* @__PURE__ */ jsx_runtime41.jsx(SmartTimestamp, {
|
|
3685
3388
|
date: new Date(message.created_at * 1000),
|
|
3686
3389
|
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
3687
3390
|
className: "text-[11px] text-muted-foreground"
|
|
@@ -3691,16 +3394,16 @@ function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
|
3691
3394
|
}
|
|
3692
3395
|
|
|
3693
3396
|
// src/ui/composed/agno-message/message.tsx
|
|
3694
|
-
var
|
|
3397
|
+
var jsx_runtime42 = require("react/jsx-runtime");
|
|
3695
3398
|
function DefaultAssistantComposition({ showTimestamp }) {
|
|
3696
|
-
return /* @__PURE__ */
|
|
3399
|
+
return /* @__PURE__ */ jsx_runtime42.jsxs(jsx_runtime42.Fragment, {
|
|
3697
3400
|
children: [
|
|
3698
|
-
/* @__PURE__ */
|
|
3699
|
-
/* @__PURE__ */
|
|
3700
|
-
/* @__PURE__ */
|
|
3701
|
-
/* @__PURE__ */
|
|
3702
|
-
/* @__PURE__ */
|
|
3703
|
-
/* @__PURE__ */
|
|
3401
|
+
/* @__PURE__ */ jsx_runtime42.jsx(AgnoMessageReasoning, {}),
|
|
3402
|
+
/* @__PURE__ */ jsx_runtime42.jsx(AgnoMessageMedia, {}),
|
|
3403
|
+
/* @__PURE__ */ jsx_runtime42.jsx(AgnoMessageTools, {}),
|
|
3404
|
+
/* @__PURE__ */ jsx_runtime42.jsx(AgnoMessageContent, {}),
|
|
3405
|
+
/* @__PURE__ */ jsx_runtime42.jsx(AgnoMessageReferences, {}),
|
|
3406
|
+
/* @__PURE__ */ jsx_runtime42.jsx(AgnoMessageFooter, {
|
|
3704
3407
|
showTimestamp
|
|
3705
3408
|
})
|
|
3706
3409
|
]
|
|
@@ -3722,10 +3425,10 @@ function AgnoMessage({
|
|
|
3722
3425
|
}) {
|
|
3723
3426
|
const isUser = message.role === "user";
|
|
3724
3427
|
const hasError = message.streamingError;
|
|
3725
|
-
const [preview, setPreview] =
|
|
3428
|
+
const [preview, setPreview] = import_react16.useState(null);
|
|
3726
3429
|
const isCustomTimestamp = !!formatTimestamp;
|
|
3727
3430
|
const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
|
|
3728
|
-
const ctx =
|
|
3431
|
+
const ctx = import_react16.useMemo(() => ({
|
|
3729
3432
|
message,
|
|
3730
3433
|
isLastAssistantMessage,
|
|
3731
3434
|
classNames,
|
|
@@ -3757,12 +3460,12 @@ function AgnoMessage({
|
|
|
3757
3460
|
renderTool
|
|
3758
3461
|
]);
|
|
3759
3462
|
const closePreview = () => setPreview(null);
|
|
3760
|
-
return /* @__PURE__ */
|
|
3463
|
+
return /* @__PURE__ */ jsx_runtime42.jsx(AgnoMessageContext.Provider, {
|
|
3761
3464
|
value: ctx,
|
|
3762
|
-
children: /* @__PURE__ */
|
|
3465
|
+
children: /* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
3763
3466
|
className: cn("py-5 first:pt-2", isUser ? "flex justify-end" : "", classNames?.root, className),
|
|
3764
3467
|
children: [
|
|
3765
|
-
isUser ? /* @__PURE__ */
|
|
3468
|
+
isUser ? /* @__PURE__ */ jsx_runtime42.jsx(UserMessageLayout, {
|
|
3766
3469
|
message,
|
|
3767
3470
|
classNames,
|
|
3768
3471
|
avatars,
|
|
@@ -3775,19 +3478,19 @@ function AgnoMessage({
|
|
|
3775
3478
|
openImageLightbox: ctx.openImageLightbox,
|
|
3776
3479
|
openFilePreview: ctx.openFilePreview,
|
|
3777
3480
|
hasError
|
|
3778
|
-
}) : /* @__PURE__ */
|
|
3481
|
+
}) : /* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
3779
3482
|
className: "flex items-start gap-3 group/message",
|
|
3780
3483
|
children: [
|
|
3781
3484
|
avatars?.assistant,
|
|
3782
|
-
/* @__PURE__ */
|
|
3485
|
+
/* @__PURE__ */ jsx_runtime42.jsx("div", {
|
|
3783
3486
|
className: cn("flex-1 min-w-0 space-y-3", classNames?.assistant?.container),
|
|
3784
|
-
children: children ?? /* @__PURE__ */
|
|
3487
|
+
children: children ?? /* @__PURE__ */ jsx_runtime42.jsx(DefaultAssistantComposition, {
|
|
3785
3488
|
showTimestamp
|
|
3786
3489
|
})
|
|
3787
3490
|
})
|
|
3788
3491
|
]
|
|
3789
3492
|
}),
|
|
3790
|
-
preview?.type === "image" && /* @__PURE__ */
|
|
3493
|
+
preview?.type === "image" && /* @__PURE__ */ jsx_runtime42.jsx(ImageLightbox, {
|
|
3791
3494
|
open: true,
|
|
3792
3495
|
onOpenChange: (open) => {
|
|
3793
3496
|
if (!open)
|
|
@@ -3796,7 +3499,7 @@ function AgnoMessage({
|
|
|
3796
3499
|
images: preview.images,
|
|
3797
3500
|
initialIndex: preview.initialIndex
|
|
3798
3501
|
}),
|
|
3799
|
-
preview?.type === "file" && /* @__PURE__ */
|
|
3502
|
+
preview?.type === "file" && /* @__PURE__ */ jsx_runtime42.jsx(FilePreviewModal, {
|
|
3800
3503
|
open: true,
|
|
3801
3504
|
onOpenChange: (open) => {
|
|
3802
3505
|
if (!open)
|
|
@@ -3828,42 +3531,42 @@ function UserMessageLayout({
|
|
|
3828
3531
|
openFilePreview,
|
|
3829
3532
|
hasError
|
|
3830
3533
|
}) {
|
|
3831
|
-
return /* @__PURE__ */
|
|
3534
|
+
return /* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
3832
3535
|
className: "flex items-start gap-2.5 max-w-[80%] flex-row-reverse",
|
|
3833
3536
|
children: [
|
|
3834
3537
|
avatars?.user,
|
|
3835
|
-
/* @__PURE__ */
|
|
3538
|
+
/* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
3836
3539
|
className: "space-y-1.5 flex flex-col items-end min-w-0",
|
|
3837
3540
|
children: [
|
|
3838
|
-
(message.images && message.images.length > 0 || message.audio && message.audio.length > 0 || message.files && message.files.length > 0) && /* @__PURE__ */
|
|
3541
|
+
(message.images && message.images.length > 0 || message.audio && message.audio.length > 0 || message.files && message.files.length > 0) && /* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
3839
3542
|
className: "flex flex-wrap gap-2 justify-end",
|
|
3840
3543
|
children: [
|
|
3841
|
-
message.images?.map((img, idx) => /* @__PURE__ */
|
|
3544
|
+
message.images?.map((img, idx) => /* @__PURE__ */ jsx_runtime42.jsx(FilePreviewCard, {
|
|
3842
3545
|
file: { name: img.revised_prompt || `Image ${idx + 1}`, type: "image/png", url: img.url },
|
|
3843
3546
|
onClick: showImageLightbox ? () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx) : undefined
|
|
3844
3547
|
}, `img-${idx}`)),
|
|
3845
|
-
message.audio?.map((audio, idx) => /* @__PURE__ */
|
|
3548
|
+
message.audio?.map((audio, idx) => /* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
3846
3549
|
className: "flex items-center gap-1.5 rounded-lg border border-border bg-muted/50 px-2.5 py-1.5 text-xs text-foreground self-end",
|
|
3847
3550
|
children: [
|
|
3848
|
-
/* @__PURE__ */
|
|
3551
|
+
/* @__PURE__ */ jsx_runtime42.jsx(import_lucide_react23.Music, {
|
|
3849
3552
|
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
3850
3553
|
}),
|
|
3851
|
-
/* @__PURE__ */
|
|
3554
|
+
/* @__PURE__ */ jsx_runtime42.jsx("span", {
|
|
3852
3555
|
className: "truncate max-w-[150px]",
|
|
3853
3556
|
children: audio.id || `Audio ${idx + 1}`
|
|
3854
3557
|
})
|
|
3855
3558
|
]
|
|
3856
3559
|
}, `audio-${idx}`)),
|
|
3857
|
-
message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */
|
|
3560
|
+
message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx_runtime42.jsx(FilePreviewCard, {
|
|
3858
3561
|
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
3859
3562
|
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
3860
|
-
}, `file-${idx}`) : /* @__PURE__ */
|
|
3563
|
+
}, `file-${idx}`) : /* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
3861
3564
|
className: "flex items-center gap-1.5 rounded-lg border border-border bg-muted/50 px-2.5 py-1.5 text-xs text-foreground self-end",
|
|
3862
3565
|
children: [
|
|
3863
|
-
/* @__PURE__ */
|
|
3566
|
+
/* @__PURE__ */ jsx_runtime42.jsx(import_lucide_react23.FileIcon, {
|
|
3864
3567
|
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
3865
3568
|
}),
|
|
3866
|
-
/* @__PURE__ */
|
|
3569
|
+
/* @__PURE__ */ jsx_runtime42.jsx("span", {
|
|
3867
3570
|
className: "truncate max-w-[150px]",
|
|
3868
3571
|
children: file.name
|
|
3869
3572
|
})
|
|
@@ -3871,26 +3574,26 @@ function UserMessageLayout({
|
|
|
3871
3574
|
}, `file-${idx}`))
|
|
3872
3575
|
]
|
|
3873
3576
|
}),
|
|
3874
|
-
message.content && /* @__PURE__ */
|
|
3577
|
+
message.content && /* @__PURE__ */ jsx_runtime42.jsx("div", {
|
|
3875
3578
|
className: cn("rounded-2xl rounded-br-md px-4 py-2.5", classNames?.user?.bubble ?? "bg-primary text-primary-foreground", hasError && "opacity-70"),
|
|
3876
|
-
children: /* @__PURE__ */
|
|
3579
|
+
children: /* @__PURE__ */ jsx_runtime42.jsx("p", {
|
|
3877
3580
|
className: "text-sm whitespace-pre-wrap",
|
|
3878
3581
|
children: message.content
|
|
3879
3582
|
})
|
|
3880
3583
|
}),
|
|
3881
|
-
(showTimestamp || actions?.user) && /* @__PURE__ */
|
|
3584
|
+
(showTimestamp || actions?.user) && /* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
3882
3585
|
className: "flex items-center justify-end gap-1.5 px-1",
|
|
3883
3586
|
children: [
|
|
3884
|
-
actions?.user && /* @__PURE__ */
|
|
3587
|
+
actions?.user && /* @__PURE__ */ jsx_runtime42.jsx("div", {
|
|
3885
3588
|
className: "flex items-center gap-1",
|
|
3886
3589
|
children: actions.user(message)
|
|
3887
3590
|
}),
|
|
3888
|
-
/* @__PURE__ */
|
|
3591
|
+
/* @__PURE__ */ jsx_runtime42.jsx(SmartTimestamp, {
|
|
3889
3592
|
date: new Date(message.created_at * 1000),
|
|
3890
3593
|
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
3891
3594
|
className: "text-[11px] text-muted-foreground"
|
|
3892
3595
|
}),
|
|
3893
|
-
hasError && /* @__PURE__ */
|
|
3596
|
+
hasError && /* @__PURE__ */ jsx_runtime42.jsx(import_lucide_react23.AlertCircle, {
|
|
3894
3597
|
className: "h-3 w-3 text-destructive"
|
|
3895
3598
|
})
|
|
3896
3599
|
]
|
|
@@ -3902,7 +3605,7 @@ function UserMessageLayout({
|
|
|
3902
3605
|
}
|
|
3903
3606
|
|
|
3904
3607
|
// src/ui/composed/AgnoMessageItem.tsx
|
|
3905
|
-
var
|
|
3608
|
+
var jsx_runtime43 = require("react/jsx-runtime");
|
|
3906
3609
|
function AgnoMessageItem({
|
|
3907
3610
|
message,
|
|
3908
3611
|
className,
|
|
@@ -3918,7 +3621,7 @@ function AgnoMessageItem({
|
|
|
3918
3621
|
formatTimestamp,
|
|
3919
3622
|
renderTool
|
|
3920
3623
|
}) {
|
|
3921
|
-
return /* @__PURE__ */
|
|
3624
|
+
return /* @__PURE__ */ jsx_runtime43.jsxs(AgnoMessage, {
|
|
3922
3625
|
message,
|
|
3923
3626
|
className,
|
|
3924
3627
|
classNames,
|
|
@@ -3931,12 +3634,12 @@ function AgnoMessageItem({
|
|
|
3931
3634
|
formatTimestamp,
|
|
3932
3635
|
renderTool,
|
|
3933
3636
|
children: [
|
|
3934
|
-
showReasoning && /* @__PURE__ */
|
|
3935
|
-
/* @__PURE__ */
|
|
3936
|
-
/* @__PURE__ */
|
|
3937
|
-
/* @__PURE__ */
|
|
3938
|
-
showReferences && /* @__PURE__ */
|
|
3939
|
-
/* @__PURE__ */
|
|
3637
|
+
showReasoning && /* @__PURE__ */ jsx_runtime43.jsx(AgnoMessage.Reasoning, {}),
|
|
3638
|
+
/* @__PURE__ */ jsx_runtime43.jsx(AgnoMessage.Media, {}),
|
|
3639
|
+
/* @__PURE__ */ jsx_runtime43.jsx(AgnoMessage.Tools, {}),
|
|
3640
|
+
/* @__PURE__ */ jsx_runtime43.jsx(AgnoMessage.Content, {}),
|
|
3641
|
+
showReferences && /* @__PURE__ */ jsx_runtime43.jsx(AgnoMessage.References, {}),
|
|
3642
|
+
/* @__PURE__ */ jsx_runtime43.jsx(AgnoMessage.Footer, {
|
|
3940
3643
|
showTimestamp
|
|
3941
3644
|
})
|
|
3942
3645
|
]
|
|
@@ -3944,7 +3647,7 @@ function AgnoMessageItem({
|
|
|
3944
3647
|
}
|
|
3945
3648
|
// src/ui/composed/AgnoChatInput.tsx
|
|
3946
3649
|
var import_lucide_react24 = require("lucide-react");
|
|
3947
|
-
var
|
|
3650
|
+
var jsx_runtime44 = require("react/jsx-runtime");
|
|
3948
3651
|
var DEFAULT_ACCEPTED_FILE_TYPES = "image/*,audio/*,.pdf,.doc,.docx,.txt,.csv,.xlsx,.xls,.ppt,.pptx,.md,.json,.xml";
|
|
3949
3652
|
function normalizeAudio(audio) {
|
|
3950
3653
|
if (audio === true)
|
|
@@ -3964,14 +3667,14 @@ function dataUrlToBlob(dataUrl) {
|
|
|
3964
3667
|
return new Blob([buf], { type: mime });
|
|
3965
3668
|
}
|
|
3966
3669
|
function CancelButton({ onCancel }) {
|
|
3967
|
-
return /* @__PURE__ */
|
|
3670
|
+
return /* @__PURE__ */ jsx_runtime44.jsx(Button, {
|
|
3968
3671
|
type: "button",
|
|
3969
3672
|
variant: "destructive",
|
|
3970
3673
|
size: "icon",
|
|
3971
3674
|
className: "h-8 w-8 rounded-lg",
|
|
3972
3675
|
onClick: onCancel,
|
|
3973
3676
|
"aria-label": "Stop",
|
|
3974
|
-
children: /* @__PURE__ */
|
|
3677
|
+
children: /* @__PURE__ */ jsx_runtime44.jsx(import_lucide_react24.CircleStop, {
|
|
3975
3678
|
className: "size-4"
|
|
3976
3679
|
})
|
|
3977
3680
|
});
|
|
@@ -3979,7 +3682,7 @@ function CancelButton({ onCancel }) {
|
|
|
3979
3682
|
function SubmitButton({ disabled, status }) {
|
|
3980
3683
|
const { textInput } = usePromptInputController();
|
|
3981
3684
|
const hasText = textInput.value.trim().length > 0;
|
|
3982
|
-
return /* @__PURE__ */
|
|
3685
|
+
return /* @__PURE__ */ jsx_runtime44.jsx(PromptInputSubmit, {
|
|
3983
3686
|
disabled: disabled || !hasText,
|
|
3984
3687
|
status
|
|
3985
3688
|
});
|
|
@@ -3988,9 +3691,9 @@ function AttachmentHeader() {
|
|
|
3988
3691
|
const { files } = usePromptInputAttachments();
|
|
3989
3692
|
if (files.length === 0)
|
|
3990
3693
|
return null;
|
|
3991
|
-
return /* @__PURE__ */
|
|
3992
|
-
children: /* @__PURE__ */
|
|
3993
|
-
children: (attachment) => /* @__PURE__ */
|
|
3694
|
+
return /* @__PURE__ */ jsx_runtime44.jsx(PromptInputHeader, {
|
|
3695
|
+
children: /* @__PURE__ */ jsx_runtime44.jsx(PromptInputAttachments, {
|
|
3696
|
+
children: (attachment) => /* @__PURE__ */ jsx_runtime44.jsx(PromptInputAttachment, {
|
|
3994
3697
|
data: attachment
|
|
3995
3698
|
})
|
|
3996
3699
|
})
|
|
@@ -4005,7 +3708,7 @@ function TranscribeAudioRecorder({
|
|
|
4005
3708
|
labels
|
|
4006
3709
|
}) {
|
|
4007
3710
|
const { textInput } = usePromptInputController();
|
|
4008
|
-
return /* @__PURE__ */
|
|
3711
|
+
return /* @__PURE__ */ jsx_runtime44.jsx(AudioRecorder, {
|
|
4009
3712
|
mode: "transcribe",
|
|
4010
3713
|
transcriptionEndpoint: endpoint,
|
|
4011
3714
|
transcriptionHeaders: headers,
|
|
@@ -4069,8 +3772,8 @@ function AgnoChatInput({
|
|
|
4069
3772
|
};
|
|
4070
3773
|
const computedStatus = status ?? (disabled ? "submitted" : undefined);
|
|
4071
3774
|
const showCancelButton = allowCancelRun && isStreaming && onCancel;
|
|
4072
|
-
return /* @__PURE__ */
|
|
4073
|
-
children: /* @__PURE__ */
|
|
3775
|
+
return /* @__PURE__ */ jsx_runtime44.jsx(PromptInputProvider, {
|
|
3776
|
+
children: /* @__PURE__ */ jsx_runtime44.jsxs(PromptInput, {
|
|
4074
3777
|
onSubmit: handleSubmit,
|
|
4075
3778
|
accept: fileUpload?.accept ?? DEFAULT_ACCEPTED_FILE_TYPES,
|
|
4076
3779
|
multiple: fileUpload?.multiple ?? true,
|
|
@@ -4080,35 +3783,35 @@ function AgnoChatInput({
|
|
|
4080
3783
|
dragListenerTarget: dropZoneContainerRef,
|
|
4081
3784
|
className: cn("w-full", className),
|
|
4082
3785
|
children: [
|
|
4083
|
-
/* @__PURE__ */
|
|
4084
|
-
/* @__PURE__ */
|
|
4085
|
-
children: /* @__PURE__ */
|
|
3786
|
+
/* @__PURE__ */ jsx_runtime44.jsx(AttachmentHeader, {}),
|
|
3787
|
+
/* @__PURE__ */ jsx_runtime44.jsx(PromptInputBody, {
|
|
3788
|
+
children: /* @__PURE__ */ jsx_runtime44.jsx(PromptInputTextarea, {
|
|
4086
3789
|
placeholder: placeholder || "Type your message... (Enter to send, Shift+Enter for new line)",
|
|
4087
3790
|
disabled
|
|
4088
3791
|
})
|
|
4089
3792
|
}),
|
|
4090
|
-
/* @__PURE__ */
|
|
3793
|
+
/* @__PURE__ */ jsx_runtime44.jsxs(PromptInputFooter, {
|
|
4091
3794
|
children: [
|
|
4092
|
-
/* @__PURE__ */
|
|
3795
|
+
/* @__PURE__ */ jsx_runtime44.jsxs(PromptInputTools, {
|
|
4093
3796
|
children: [
|
|
4094
|
-
showAttachments && /* @__PURE__ */
|
|
3797
|
+
showAttachments && /* @__PURE__ */ jsx_runtime44.jsxs(PromptInputActionMenu, {
|
|
4095
3798
|
children: [
|
|
4096
|
-
/* @__PURE__ */
|
|
4097
|
-
/* @__PURE__ */
|
|
4098
|
-
children: /* @__PURE__ */
|
|
3799
|
+
/* @__PURE__ */ jsx_runtime44.jsx(PromptInputActionMenuTrigger, {}),
|
|
3800
|
+
/* @__PURE__ */ jsx_runtime44.jsx(PromptInputActionMenuContent, {
|
|
3801
|
+
children: /* @__PURE__ */ jsx_runtime44.jsx(PromptInputActionAddAttachments, {
|
|
4099
3802
|
label: "Add files"
|
|
4100
3803
|
})
|
|
4101
3804
|
})
|
|
4102
3805
|
]
|
|
4103
3806
|
}),
|
|
4104
|
-
audioEnabled && (audioMode === "transcribe" && resolvedAudio?.endpoint ? /* @__PURE__ */
|
|
3807
|
+
audioEnabled && (audioMode === "transcribe" && resolvedAudio?.endpoint ? /* @__PURE__ */ jsx_runtime44.jsx(TranscribeAudioRecorder, {
|
|
4105
3808
|
endpoint: resolvedAudio.endpoint,
|
|
4106
3809
|
headers: resolvedAudio.headers,
|
|
4107
3810
|
disabled,
|
|
4108
3811
|
parseResponse: resolvedAudio.parseResponse,
|
|
4109
3812
|
onRequestPermission: resolvedAudio.requestPermission,
|
|
4110
3813
|
labels: resolvedAudio.labels
|
|
4111
|
-
}) : /* @__PURE__ */
|
|
3814
|
+
}) : /* @__PURE__ */ jsx_runtime44.jsx(AudioRecorder, {
|
|
4112
3815
|
onRecordingComplete: handleAudioRecording,
|
|
4113
3816
|
disabled,
|
|
4114
3817
|
onRequestPermission: resolvedAudio?.requestPermission,
|
|
@@ -4117,15 +3820,15 @@ function AgnoChatInput({
|
|
|
4117
3820
|
extraTools
|
|
4118
3821
|
]
|
|
4119
3822
|
}),
|
|
4120
|
-
showCancelButton ? /* @__PURE__ */
|
|
3823
|
+
showCancelButton ? /* @__PURE__ */ jsx_runtime44.jsx(CancelButton, {
|
|
4121
3824
|
onCancel
|
|
4122
|
-
}) : /* @__PURE__ */
|
|
3825
|
+
}) : /* @__PURE__ */ jsx_runtime44.jsx(SubmitButton, {
|
|
4123
3826
|
disabled,
|
|
4124
3827
|
status: computedStatus
|
|
4125
3828
|
})
|
|
4126
3829
|
]
|
|
4127
3830
|
}),
|
|
4128
|
-
showAttachments && /* @__PURE__ */
|
|
3831
|
+
showAttachments && /* @__PURE__ */ jsx_runtime44.jsx(PromptInputDropZone, {
|
|
4129
3832
|
...dropZoneProps,
|
|
4130
3833
|
container: dropZoneContainerRef
|
|
4131
3834
|
})
|
|
@@ -4145,8 +3848,467 @@ function byToolName(map, fallback) {
|
|
|
4145
3848
|
return entry(tool, args);
|
|
4146
3849
|
};
|
|
4147
3850
|
}
|
|
3851
|
+
// src/ui/composed/generative-components/charts.tsx
|
|
3852
|
+
var import_recharts = require("recharts");
|
|
3853
|
+
|
|
3854
|
+
// src/ui/components/chart.tsx
|
|
3855
|
+
var React11 = __toESM(require("react"));
|
|
3856
|
+
var RechartsPrimitive = __toESM(require("recharts"));
|
|
3857
|
+
var jsx_runtime45 = require("react/jsx-runtime");
|
|
3858
|
+
var THEMES = { light: "", dark: ".dark" };
|
|
3859
|
+
var ChartContext = React11.createContext(null);
|
|
3860
|
+
function useChart() {
|
|
3861
|
+
const context = React11.useContext(ChartContext);
|
|
3862
|
+
if (!context) {
|
|
3863
|
+
throw new Error("useChart must be used within a <ChartContainer />");
|
|
3864
|
+
}
|
|
3865
|
+
return context;
|
|
3866
|
+
}
|
|
3867
|
+
var ChartContainer = React11.forwardRef(({ id, className, children, config, ...props }, ref) => {
|
|
3868
|
+
const uniqueId = React11.useId();
|
|
3869
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
3870
|
+
return /* @__PURE__ */ jsx_runtime45.jsx(ChartContext.Provider, {
|
|
3871
|
+
value: { config },
|
|
3872
|
+
children: /* @__PURE__ */ jsx_runtime45.jsxs("div", {
|
|
3873
|
+
"data-chart": chartId,
|
|
3874
|
+
ref,
|
|
3875
|
+
className: cn("flex aspect-video justify-center text-xs [&_.recharts-cartesian-axis-tick_text]:fill-muted-foreground [&_.recharts-cartesian-grid_line[stroke='#ccc']]:stroke-border/50 [&_.recharts-curve.recharts-tooltip-cursor]:stroke-border [&_.recharts-dot[stroke='#fff']]:stroke-transparent [&_.recharts-layer]:outline-none [&_.recharts-polar-grid_[stroke='#ccc']]:stroke-border [&_.recharts-radial-bar-background-sector]:fill-muted [&_.recharts-rectangle.recharts-tooltip-cursor]:fill-muted [&_.recharts-reference-line_[stroke='#ccc']]:stroke-border [&_.recharts-sector[stroke='#fff']]:stroke-transparent [&_.recharts-sector]:outline-none [&_.recharts-surface]:outline-none", className),
|
|
3876
|
+
...props,
|
|
3877
|
+
children: [
|
|
3878
|
+
/* @__PURE__ */ jsx_runtime45.jsx(ChartStyle, {
|
|
3879
|
+
id: chartId,
|
|
3880
|
+
config
|
|
3881
|
+
}),
|
|
3882
|
+
/* @__PURE__ */ jsx_runtime45.jsx(RechartsPrimitive.ResponsiveContainer, {
|
|
3883
|
+
children
|
|
3884
|
+
})
|
|
3885
|
+
]
|
|
3886
|
+
})
|
|
3887
|
+
});
|
|
3888
|
+
});
|
|
3889
|
+
ChartContainer.displayName = "Chart";
|
|
3890
|
+
var ChartStyle = ({ id, config }) => {
|
|
3891
|
+
const colorConfig = Object.entries(config).filter(([, config2]) => config2.theme || config2.color);
|
|
3892
|
+
if (!colorConfig.length) {
|
|
3893
|
+
return null;
|
|
3894
|
+
}
|
|
3895
|
+
return /* @__PURE__ */ jsx_runtime45.jsx("style", {
|
|
3896
|
+
dangerouslySetInnerHTML: {
|
|
3897
|
+
__html: Object.entries(THEMES).map(([theme, prefix]) => `
|
|
3898
|
+
${prefix} [data-chart=${id}] {
|
|
3899
|
+
${colorConfig.map(([key, itemConfig]) => {
|
|
3900
|
+
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
3901
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
3902
|
+
}).join(`
|
|
3903
|
+
`)}
|
|
3904
|
+
}
|
|
3905
|
+
`).join(`
|
|
3906
|
+
`)
|
|
3907
|
+
}
|
|
3908
|
+
});
|
|
3909
|
+
};
|
|
3910
|
+
var ChartTooltip = RechartsPrimitive.Tooltip;
|
|
3911
|
+
var ChartTooltipContent = React11.forwardRef(({
|
|
3912
|
+
active,
|
|
3913
|
+
payload,
|
|
3914
|
+
className,
|
|
3915
|
+
indicator = "dot",
|
|
3916
|
+
hideLabel = false,
|
|
3917
|
+
hideIndicator = false,
|
|
3918
|
+
label,
|
|
3919
|
+
labelFormatter,
|
|
3920
|
+
labelClassName,
|
|
3921
|
+
formatter,
|
|
3922
|
+
color,
|
|
3923
|
+
nameKey,
|
|
3924
|
+
labelKey
|
|
3925
|
+
}, ref) => {
|
|
3926
|
+
const { config } = useChart();
|
|
3927
|
+
const tooltipLabel = React11.useMemo(() => {
|
|
3928
|
+
if (hideLabel || !payload?.length) {
|
|
3929
|
+
return null;
|
|
3930
|
+
}
|
|
3931
|
+
const [item] = payload;
|
|
3932
|
+
const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
|
|
3933
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
3934
|
+
const value = !labelKey && typeof label === "string" ? config[label]?.label || label : itemConfig?.label;
|
|
3935
|
+
if (labelFormatter) {
|
|
3936
|
+
return /* @__PURE__ */ jsx_runtime45.jsx("div", {
|
|
3937
|
+
className: cn("font-medium", labelClassName),
|
|
3938
|
+
children: labelFormatter(value, payload)
|
|
3939
|
+
});
|
|
3940
|
+
}
|
|
3941
|
+
if (!value) {
|
|
3942
|
+
return null;
|
|
3943
|
+
}
|
|
3944
|
+
return /* @__PURE__ */ jsx_runtime45.jsx("div", {
|
|
3945
|
+
className: cn("font-medium", labelClassName),
|
|
3946
|
+
children: value
|
|
3947
|
+
});
|
|
3948
|
+
}, [
|
|
3949
|
+
label,
|
|
3950
|
+
labelFormatter,
|
|
3951
|
+
payload,
|
|
3952
|
+
hideLabel,
|
|
3953
|
+
labelClassName,
|
|
3954
|
+
config,
|
|
3955
|
+
labelKey
|
|
3956
|
+
]);
|
|
3957
|
+
if (!active || !payload?.length) {
|
|
3958
|
+
return null;
|
|
3959
|
+
}
|
|
3960
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
3961
|
+
return /* @__PURE__ */ jsx_runtime45.jsxs("div", {
|
|
3962
|
+
ref,
|
|
3963
|
+
className: cn("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl", className),
|
|
3964
|
+
children: [
|
|
3965
|
+
!nestLabel ? tooltipLabel : null,
|
|
3966
|
+
/* @__PURE__ */ jsx_runtime45.jsx("div", {
|
|
3967
|
+
className: "grid gap-1.5",
|
|
3968
|
+
children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
3969
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
3970
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
3971
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
|
3972
|
+
return /* @__PURE__ */ jsx_runtime45.jsx("div", {
|
|
3973
|
+
className: cn("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground", indicator === "dot" && "items-center"),
|
|
3974
|
+
children: formatter && item?.value !== undefined && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsx_runtime45.jsxs(jsx_runtime45.Fragment, {
|
|
3975
|
+
children: [
|
|
3976
|
+
itemConfig?.icon ? /* @__PURE__ */ jsx_runtime45.jsx(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsx_runtime45.jsx("div", {
|
|
3977
|
+
className: cn("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]", {
|
|
3978
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
3979
|
+
"w-1": indicator === "line",
|
|
3980
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
3981
|
+
"my-0.5": nestLabel && indicator === "dashed"
|
|
3982
|
+
}),
|
|
3983
|
+
style: {
|
|
3984
|
+
"--color-bg": indicatorColor,
|
|
3985
|
+
"--color-border": indicatorColor
|
|
3986
|
+
}
|
|
3987
|
+
}),
|
|
3988
|
+
/* @__PURE__ */ jsx_runtime45.jsxs("div", {
|
|
3989
|
+
className: cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center"),
|
|
3990
|
+
children: [
|
|
3991
|
+
/* @__PURE__ */ jsx_runtime45.jsxs("div", {
|
|
3992
|
+
className: "grid gap-1.5",
|
|
3993
|
+
children: [
|
|
3994
|
+
nestLabel ? tooltipLabel : null,
|
|
3995
|
+
/* @__PURE__ */ jsx_runtime45.jsx("span", {
|
|
3996
|
+
className: "text-muted-foreground",
|
|
3997
|
+
children: itemConfig?.label || item.name
|
|
3998
|
+
})
|
|
3999
|
+
]
|
|
4000
|
+
}),
|
|
4001
|
+
item.value && /* @__PURE__ */ jsx_runtime45.jsx("span", {
|
|
4002
|
+
className: "font-mono font-medium tabular-nums text-foreground",
|
|
4003
|
+
children: item.value.toLocaleString()
|
|
4004
|
+
})
|
|
4005
|
+
]
|
|
4006
|
+
})
|
|
4007
|
+
]
|
|
4008
|
+
})
|
|
4009
|
+
}, item.dataKey);
|
|
4010
|
+
})
|
|
4011
|
+
})
|
|
4012
|
+
]
|
|
4013
|
+
});
|
|
4014
|
+
});
|
|
4015
|
+
ChartTooltipContent.displayName = "ChartTooltip";
|
|
4016
|
+
var ChartLegend = RechartsPrimitive.Legend;
|
|
4017
|
+
var ChartLegendContent = React11.forwardRef(({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, ref) => {
|
|
4018
|
+
const { config } = useChart();
|
|
4019
|
+
if (!payload?.length) {
|
|
4020
|
+
return null;
|
|
4021
|
+
}
|
|
4022
|
+
return /* @__PURE__ */ jsx_runtime45.jsx("div", {
|
|
4023
|
+
ref,
|
|
4024
|
+
className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className),
|
|
4025
|
+
children: payload.filter((item) => item.type !== "none").map((item) => {
|
|
4026
|
+
const key = `${nameKey || item.dataKey || "value"}`;
|
|
4027
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
4028
|
+
return /* @__PURE__ */ jsx_runtime45.jsxs("div", {
|
|
4029
|
+
className: cn("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),
|
|
4030
|
+
children: [
|
|
4031
|
+
itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx_runtime45.jsx(itemConfig.icon, {}) : /* @__PURE__ */ jsx_runtime45.jsx("div", {
|
|
4032
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
4033
|
+
style: {
|
|
4034
|
+
backgroundColor: item.color
|
|
4035
|
+
}
|
|
4036
|
+
}),
|
|
4037
|
+
itemConfig?.label
|
|
4038
|
+
]
|
|
4039
|
+
}, item.value);
|
|
4040
|
+
})
|
|
4041
|
+
});
|
|
4042
|
+
});
|
|
4043
|
+
ChartLegendContent.displayName = "ChartLegend";
|
|
4044
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
4045
|
+
if (typeof payload !== "object" || payload === null) {
|
|
4046
|
+
return;
|
|
4047
|
+
}
|
|
4048
|
+
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : undefined;
|
|
4049
|
+
let configLabelKey = key;
|
|
4050
|
+
if (key in payload && typeof payload[key] === "string") {
|
|
4051
|
+
configLabelKey = payload[key];
|
|
4052
|
+
} else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
|
|
4053
|
+
configLabelKey = payloadPayload[key];
|
|
4054
|
+
}
|
|
4055
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
4056
|
+
}
|
|
4057
|
+
|
|
4058
|
+
// src/ui/composed/generative-components/charts.tsx
|
|
4059
|
+
var jsx_runtime46 = require("react/jsx-runtime");
|
|
4060
|
+
var DEFAULT_COLORS = [
|
|
4061
|
+
"hsl(var(--chart-1))",
|
|
4062
|
+
"hsl(var(--chart-2))",
|
|
4063
|
+
"hsl(var(--chart-3))",
|
|
4064
|
+
"hsl(var(--chart-4))",
|
|
4065
|
+
"hsl(var(--chart-5))"
|
|
4066
|
+
];
|
|
4067
|
+
function generateChartConfig(series = []) {
|
|
4068
|
+
const config = {};
|
|
4069
|
+
series.forEach((item, index) => {
|
|
4070
|
+
config[item.key] = {
|
|
4071
|
+
label: item.label || item.key,
|
|
4072
|
+
color: item.color || DEFAULT_COLORS[index % DEFAULT_COLORS.length]
|
|
4073
|
+
};
|
|
4074
|
+
});
|
|
4075
|
+
return config;
|
|
4076
|
+
}
|
|
4077
|
+
function EmptyState({ message = "No data available" }) {
|
|
4078
|
+
return /* @__PURE__ */ jsx_runtime46.jsx("div", {
|
|
4079
|
+
className: "flex items-center justify-center h-[350px] border rounded-md bg-muted/10",
|
|
4080
|
+
children: /* @__PURE__ */ jsx_runtime46.jsx("p", {
|
|
4081
|
+
className: "text-sm text-muted-foreground",
|
|
4082
|
+
children: message
|
|
4083
|
+
})
|
|
4084
|
+
});
|
|
4085
|
+
}
|
|
4086
|
+
function BarChart(props) {
|
|
4087
|
+
const { data, xKey, bars = [], showLegend = true, showGrid = true, height = 350 } = props;
|
|
4088
|
+
if (!data || data.length === 0)
|
|
4089
|
+
return /* @__PURE__ */ jsx_runtime46.jsx(EmptyState, {});
|
|
4090
|
+
const config = generateChartConfig(bars);
|
|
4091
|
+
return /* @__PURE__ */ jsx_runtime46.jsx(ChartContainer, {
|
|
4092
|
+
config,
|
|
4093
|
+
className: "h-[350px]",
|
|
4094
|
+
children: /* @__PURE__ */ jsx_runtime46.jsxs(import_recharts.BarChart, {
|
|
4095
|
+
data,
|
|
4096
|
+
height,
|
|
4097
|
+
children: [
|
|
4098
|
+
showGrid && /* @__PURE__ */ jsx_runtime46.jsx(import_recharts.CartesianGrid, {
|
|
4099
|
+
strokeDasharray: "3 3"
|
|
4100
|
+
}),
|
|
4101
|
+
/* @__PURE__ */ jsx_runtime46.jsx(import_recharts.XAxis, {
|
|
4102
|
+
dataKey: xKey
|
|
4103
|
+
}),
|
|
4104
|
+
/* @__PURE__ */ jsx_runtime46.jsx(import_recharts.YAxis, {}),
|
|
4105
|
+
/* @__PURE__ */ jsx_runtime46.jsx(ChartTooltip, {
|
|
4106
|
+
content: /* @__PURE__ */ jsx_runtime46.jsx(ChartTooltipContent, {})
|
|
4107
|
+
}),
|
|
4108
|
+
showLegend && /* @__PURE__ */ jsx_runtime46.jsx(import_recharts.Legend, {}),
|
|
4109
|
+
bars.map((bar) => /* @__PURE__ */ jsx_runtime46.jsx(import_recharts.Bar, {
|
|
4110
|
+
dataKey: bar.key,
|
|
4111
|
+
fill: bar.color || `var(--color-${bar.key})`,
|
|
4112
|
+
radius: [4, 4, 0, 0]
|
|
4113
|
+
}, bar.key))
|
|
4114
|
+
]
|
|
4115
|
+
})
|
|
4116
|
+
});
|
|
4117
|
+
}
|
|
4118
|
+
function LineChart(props) {
|
|
4119
|
+
const { data, xKey, lines = [], showLegend = true, showGrid = true, height = 350 } = props;
|
|
4120
|
+
if (!data || data.length === 0)
|
|
4121
|
+
return /* @__PURE__ */ jsx_runtime46.jsx(EmptyState, {});
|
|
4122
|
+
const config = generateChartConfig(lines);
|
|
4123
|
+
return /* @__PURE__ */ jsx_runtime46.jsx(ChartContainer, {
|
|
4124
|
+
config,
|
|
4125
|
+
className: "h-[350px]",
|
|
4126
|
+
children: /* @__PURE__ */ jsx_runtime46.jsxs(import_recharts.LineChart, {
|
|
4127
|
+
data,
|
|
4128
|
+
height,
|
|
4129
|
+
children: [
|
|
4130
|
+
showGrid && /* @__PURE__ */ jsx_runtime46.jsx(import_recharts.CartesianGrid, {
|
|
4131
|
+
strokeDasharray: "3 3"
|
|
4132
|
+
}),
|
|
4133
|
+
/* @__PURE__ */ jsx_runtime46.jsx(import_recharts.XAxis, {
|
|
4134
|
+
dataKey: xKey
|
|
4135
|
+
}),
|
|
4136
|
+
/* @__PURE__ */ jsx_runtime46.jsx(import_recharts.YAxis, {}),
|
|
4137
|
+
/* @__PURE__ */ jsx_runtime46.jsx(ChartTooltip, {
|
|
4138
|
+
content: /* @__PURE__ */ jsx_runtime46.jsx(ChartTooltipContent, {})
|
|
4139
|
+
}),
|
|
4140
|
+
showLegend && /* @__PURE__ */ jsx_runtime46.jsx(import_recharts.Legend, {}),
|
|
4141
|
+
lines.map((line) => /* @__PURE__ */ jsx_runtime46.jsx(import_recharts.Line, {
|
|
4142
|
+
type: "monotone",
|
|
4143
|
+
dataKey: line.key,
|
|
4144
|
+
stroke: line.color || `var(--color-${line.key})`,
|
|
4145
|
+
strokeWidth: 2,
|
|
4146
|
+
dot: { r: 4 }
|
|
4147
|
+
}, line.key))
|
|
4148
|
+
]
|
|
4149
|
+
})
|
|
4150
|
+
});
|
|
4151
|
+
}
|
|
4152
|
+
function AreaChart(props) {
|
|
4153
|
+
const { data, xKey, areas = [], showLegend = true, showGrid = true, height = 350 } = props;
|
|
4154
|
+
if (!data || data.length === 0)
|
|
4155
|
+
return /* @__PURE__ */ jsx_runtime46.jsx(EmptyState, {});
|
|
4156
|
+
const config = generateChartConfig(areas);
|
|
4157
|
+
return /* @__PURE__ */ jsx_runtime46.jsx(ChartContainer, {
|
|
4158
|
+
config,
|
|
4159
|
+
className: "h-[350px]",
|
|
4160
|
+
children: /* @__PURE__ */ jsx_runtime46.jsxs(import_recharts.AreaChart, {
|
|
4161
|
+
data,
|
|
4162
|
+
height,
|
|
4163
|
+
children: [
|
|
4164
|
+
showGrid && /* @__PURE__ */ jsx_runtime46.jsx(import_recharts.CartesianGrid, {
|
|
4165
|
+
strokeDasharray: "3 3"
|
|
4166
|
+
}),
|
|
4167
|
+
/* @__PURE__ */ jsx_runtime46.jsx(import_recharts.XAxis, {
|
|
4168
|
+
dataKey: xKey
|
|
4169
|
+
}),
|
|
4170
|
+
/* @__PURE__ */ jsx_runtime46.jsx(import_recharts.YAxis, {}),
|
|
4171
|
+
/* @__PURE__ */ jsx_runtime46.jsx(ChartTooltip, {
|
|
4172
|
+
content: /* @__PURE__ */ jsx_runtime46.jsx(ChartTooltipContent, {})
|
|
4173
|
+
}),
|
|
4174
|
+
showLegend && /* @__PURE__ */ jsx_runtime46.jsx(import_recharts.Legend, {}),
|
|
4175
|
+
areas.map((area) => /* @__PURE__ */ jsx_runtime46.jsx(import_recharts.Area, {
|
|
4176
|
+
type: "monotone",
|
|
4177
|
+
dataKey: area.key,
|
|
4178
|
+
stroke: area.color || `var(--color-${area.key})`,
|
|
4179
|
+
fill: area.color || `var(--color-${area.key})`,
|
|
4180
|
+
fillOpacity: 0.6
|
|
4181
|
+
}, area.key))
|
|
4182
|
+
]
|
|
4183
|
+
})
|
|
4184
|
+
});
|
|
4185
|
+
}
|
|
4186
|
+
function PieChart(props) {
|
|
4187
|
+
const { data, pie, showLegend = true, height = 350 } = props;
|
|
4188
|
+
if (!data || data.length === 0 || !pie)
|
|
4189
|
+
return /* @__PURE__ */ jsx_runtime46.jsx(EmptyState, {});
|
|
4190
|
+
const nameKey = pie.nameKey || "name";
|
|
4191
|
+
const config = generateChartConfig(data.map((item) => ({
|
|
4192
|
+
key: item[nameKey],
|
|
4193
|
+
label: item[nameKey]
|
|
4194
|
+
})));
|
|
4195
|
+
return /* @__PURE__ */ jsx_runtime46.jsx(ChartContainer, {
|
|
4196
|
+
config,
|
|
4197
|
+
className: "h-[350px]",
|
|
4198
|
+
children: /* @__PURE__ */ jsx_runtime46.jsxs(import_recharts.PieChart, {
|
|
4199
|
+
height,
|
|
4200
|
+
children: [
|
|
4201
|
+
/* @__PURE__ */ jsx_runtime46.jsx(import_recharts.Pie, {
|
|
4202
|
+
data,
|
|
4203
|
+
dataKey: pie.dataKey,
|
|
4204
|
+
nameKey,
|
|
4205
|
+
cx: "50%",
|
|
4206
|
+
cy: "50%",
|
|
4207
|
+
outerRadius: 100,
|
|
4208
|
+
label: pie.label,
|
|
4209
|
+
children: data.map((_entry, index) => /* @__PURE__ */ jsx_runtime46.jsx(import_recharts.Cell, {
|
|
4210
|
+
fill: DEFAULT_COLORS[index % DEFAULT_COLORS.length]
|
|
4211
|
+
}, `cell-${index}`))
|
|
4212
|
+
}),
|
|
4213
|
+
/* @__PURE__ */ jsx_runtime46.jsx(ChartTooltip, {
|
|
4214
|
+
content: /* @__PURE__ */ jsx_runtime46.jsx(ChartTooltipContent, {})
|
|
4215
|
+
}),
|
|
4216
|
+
showLegend && /* @__PURE__ */ jsx_runtime46.jsx(import_recharts.Legend, {})
|
|
4217
|
+
]
|
|
4218
|
+
})
|
|
4219
|
+
});
|
|
4220
|
+
}
|
|
4221
|
+
// src/ui/composed/generative-components/card-grid.tsx
|
|
4222
|
+
var jsx_runtime47 = require("react/jsx-runtime");
|
|
4223
|
+
function CardGrid(props) {
|
|
4224
|
+
const { cards, columns = { default: 1, md: 2, lg: 3 }, variant = "default" } = props;
|
|
4225
|
+
if (!cards || cards.length === 0) {
|
|
4226
|
+
return /* @__PURE__ */ jsx_runtime47.jsx("div", {
|
|
4227
|
+
className: "flex items-center justify-center p-8 border rounded-md bg-muted/10",
|
|
4228
|
+
children: /* @__PURE__ */ jsx_runtime47.jsx("p", {
|
|
4229
|
+
className: "text-sm text-muted-foreground",
|
|
4230
|
+
children: "No items available"
|
|
4231
|
+
})
|
|
4232
|
+
});
|
|
4233
|
+
}
|
|
4234
|
+
const gridCols = {
|
|
4235
|
+
default: columns.default || 1,
|
|
4236
|
+
sm: columns.sm,
|
|
4237
|
+
md: columns.md || 2,
|
|
4238
|
+
lg: columns.lg || 3,
|
|
4239
|
+
xl: columns.xl
|
|
4240
|
+
};
|
|
4241
|
+
const gridClass = cn("grid gap-4", gridCols.default === 1 ? "grid-cols-1" : `grid-cols-${gridCols.default}`, gridCols.sm && `sm:grid-cols-${gridCols.sm}`, gridCols.md && `md:grid-cols-${gridCols.md}`, gridCols.lg && `lg:grid-cols-${gridCols.lg}`, gridCols.xl && `xl:grid-cols-${gridCols.xl}`);
|
|
4242
|
+
const cardClass = cn("rounded-lg border bg-card text-card-foreground shadow-sm", variant === "bordered" && "border-2", variant === "elevated" && "shadow-lg");
|
|
4243
|
+
return /* @__PURE__ */ jsx_runtime47.jsx("div", {
|
|
4244
|
+
className: gridClass,
|
|
4245
|
+
children: cards.map((card) => /* @__PURE__ */ jsx_runtime47.jsxs("div", {
|
|
4246
|
+
className: cardClass,
|
|
4247
|
+
children: [
|
|
4248
|
+
card.image && /* @__PURE__ */ jsx_runtime47.jsx("div", {
|
|
4249
|
+
className: "aspect-video w-full overflow-hidden rounded-t-lg",
|
|
4250
|
+
children: /* @__PURE__ */ jsx_runtime47.jsx("img", {
|
|
4251
|
+
src: card.image,
|
|
4252
|
+
alt: card.title,
|
|
4253
|
+
className: "h-full w-full object-cover"
|
|
4254
|
+
})
|
|
4255
|
+
}),
|
|
4256
|
+
/* @__PURE__ */ jsx_runtime47.jsxs("div", {
|
|
4257
|
+
className: "flex flex-col space-y-1.5 p-6",
|
|
4258
|
+
children: [
|
|
4259
|
+
/* @__PURE__ */ jsx_runtime47.jsx("h3", {
|
|
4260
|
+
className: "text-lg font-semibold leading-none tracking-tight",
|
|
4261
|
+
children: card.title
|
|
4262
|
+
}),
|
|
4263
|
+
card.description && /* @__PURE__ */ jsx_runtime47.jsx("p", {
|
|
4264
|
+
className: "text-sm text-muted-foreground",
|
|
4265
|
+
children: card.description
|
|
4266
|
+
})
|
|
4267
|
+
]
|
|
4268
|
+
}),
|
|
4269
|
+
card.metadata && Object.keys(card.metadata).length > 0 && /* @__PURE__ */ jsx_runtime47.jsx("div", {
|
|
4270
|
+
className: "px-6 pb-4",
|
|
4271
|
+
children: /* @__PURE__ */ jsx_runtime47.jsx("dl", {
|
|
4272
|
+
className: "space-y-1 text-sm",
|
|
4273
|
+
children: Object.entries(card.metadata).map(([key, value]) => /* @__PURE__ */ jsx_runtime47.jsxs("div", {
|
|
4274
|
+
className: "flex justify-between",
|
|
4275
|
+
children: [
|
|
4276
|
+
/* @__PURE__ */ jsx_runtime47.jsxs("dt", {
|
|
4277
|
+
className: "text-muted-foreground",
|
|
4278
|
+
children: [
|
|
4279
|
+
key,
|
|
4280
|
+
":"
|
|
4281
|
+
]
|
|
4282
|
+
}),
|
|
4283
|
+
/* @__PURE__ */ jsx_runtime47.jsx("dd", {
|
|
4284
|
+
className: "font-medium",
|
|
4285
|
+
children: String(value)
|
|
4286
|
+
})
|
|
4287
|
+
]
|
|
4288
|
+
}, key))
|
|
4289
|
+
})
|
|
4290
|
+
}),
|
|
4291
|
+
card.actions && card.actions.length > 0 && /* @__PURE__ */ jsx_runtime47.jsx("div", {
|
|
4292
|
+
className: "flex items-center gap-2 p-6 pt-0",
|
|
4293
|
+
children: card.actions.map((action, index) => /* @__PURE__ */ jsx_runtime47.jsx(Button, {
|
|
4294
|
+
variant: action.variant || "default",
|
|
4295
|
+
size: "sm",
|
|
4296
|
+
onClick: () => {
|
|
4297
|
+
if (action.onClick) {
|
|
4298
|
+
window.dispatchEvent(new CustomEvent("generative-ui-action", {
|
|
4299
|
+
detail: { action: action.onClick, cardId: card.id }
|
|
4300
|
+
}));
|
|
4301
|
+
}
|
|
4302
|
+
},
|
|
4303
|
+
children: action.label
|
|
4304
|
+
}, index))
|
|
4305
|
+
})
|
|
4306
|
+
]
|
|
4307
|
+
}, card.id))
|
|
4308
|
+
});
|
|
4309
|
+
}
|
|
4148
4310
|
// src/ui/composed/agno-chat/agno-chat.tsx
|
|
4149
|
-
var
|
|
4311
|
+
var import_react17 = require("react");
|
|
4150
4312
|
var import_agno_react = require("@rodrigocoliveira/agno-react");
|
|
4151
4313
|
var jsx_runtime48 = require("react/jsx-runtime");
|
|
4152
4314
|
function resolveDebug(debug) {
|
|
@@ -4160,19 +4322,19 @@ function AgnoChatRoot({
|
|
|
4160
4322
|
autoExecuteTools = true,
|
|
4161
4323
|
renderTool,
|
|
4162
4324
|
debug,
|
|
4163
|
-
|
|
4325
|
+
skipToolsOnSessionLoad,
|
|
4164
4326
|
className,
|
|
4165
4327
|
...divProps
|
|
4166
4328
|
}) {
|
|
4167
4329
|
const chat = import_agno_react.useAgnoChat();
|
|
4168
4330
|
const toolExec = import_agno_react.useAgnoToolExecution(toolHandlers, autoExecuteTools, {
|
|
4169
|
-
|
|
4331
|
+
skipToolsOnSessionLoad
|
|
4170
4332
|
});
|
|
4171
|
-
const containerRef =
|
|
4333
|
+
const containerRef = import_react17.useRef(null);
|
|
4172
4334
|
const isDebug = resolveDebug(debug);
|
|
4173
|
-
const sendRef =
|
|
4335
|
+
const sendRef = import_react17.useRef(chat.sendMessage);
|
|
4174
4336
|
sendRef.current = chat.sendMessage;
|
|
4175
|
-
const handleSend =
|
|
4337
|
+
const handleSend = import_react17.useCallback(async (message) => {
|
|
4176
4338
|
try {
|
|
4177
4339
|
await sendRef.current(message);
|
|
4178
4340
|
} catch {}
|
|
@@ -4198,7 +4360,7 @@ function AgnoChatRoot({
|
|
|
4198
4360
|
continueWithResults,
|
|
4199
4361
|
executionError
|
|
4200
4362
|
} = toolExec;
|
|
4201
|
-
const contextValue =
|
|
4363
|
+
const contextValue = import_react17.useMemo(() => ({
|
|
4202
4364
|
messages,
|
|
4203
4365
|
sendMessage,
|
|
4204
4366
|
clearMessages,
|
|
@@ -4255,7 +4417,7 @@ function AgnoChatRoot({
|
|
|
4255
4417
|
}
|
|
4256
4418
|
|
|
4257
4419
|
// src/ui/composed/agno-chat/messages.tsx
|
|
4258
|
-
var
|
|
4420
|
+
var import_react18 = require("react");
|
|
4259
4421
|
|
|
4260
4422
|
// src/ui/composed/agno-chat/suggested-prompts.tsx
|
|
4261
4423
|
var jsx_runtime49 = require("react/jsx-runtime");
|
|
@@ -4287,8 +4449,8 @@ var import_lucide_react25 = require("lucide-react");
|
|
|
4287
4449
|
var jsx_runtime50 = require("react/jsx-runtime");
|
|
4288
4450
|
function ScrollOnNewUserMessage({ messageCount }) {
|
|
4289
4451
|
const { scrollToBottom } = import_use_stick_to_bottom2.useStickToBottomContext();
|
|
4290
|
-
const prevCount =
|
|
4291
|
-
|
|
4452
|
+
const prevCount = import_react18.useRef(messageCount);
|
|
4453
|
+
import_react18.useEffect(() => {
|
|
4292
4454
|
if (messageCount > prevCount.current) {
|
|
4293
4455
|
scrollToBottom("smooth");
|
|
4294
4456
|
}
|
|
@@ -4330,7 +4492,7 @@ function AgnoChatMessages({
|
|
|
4330
4492
|
if (scrollToBottomButton === undefined || scrollToBottomButton === true) {
|
|
4331
4493
|
return /* @__PURE__ */ jsx_runtime50.jsx(ConversationScrollButton, {});
|
|
4332
4494
|
}
|
|
4333
|
-
if (
|
|
4495
|
+
if (import_react18.isValidElement(scrollToBottomButton))
|
|
4334
4496
|
return scrollToBottomButton;
|
|
4335
4497
|
if (typeof scrollToBottomButton === "object" && scrollToBottomButton !== null && "className" in scrollToBottomButton) {
|
|
4336
4498
|
return /* @__PURE__ */ jsx_runtime50.jsx(ConversationScrollButton, {
|
|
@@ -4441,7 +4603,7 @@ function AgnoChatEmptyState({ children, className, ...props }) {
|
|
|
4441
4603
|
}
|
|
4442
4604
|
|
|
4443
4605
|
// src/ui/composed/agno-chat/error-bar.tsx
|
|
4444
|
-
var
|
|
4606
|
+
var import_react19 = require("react");
|
|
4445
4607
|
var jsx_runtime52 = require("react/jsx-runtime");
|
|
4446
4608
|
function AgnoChatErrorBar({
|
|
4447
4609
|
className,
|
|
@@ -4452,10 +4614,10 @@ function AgnoChatErrorBar({
|
|
|
4452
4614
|
children
|
|
4453
4615
|
}) {
|
|
4454
4616
|
const { error, executionError } = useAgnoChatContext();
|
|
4455
|
-
const [hidden, setHidden] =
|
|
4456
|
-
const timerRef =
|
|
4617
|
+
const [hidden, setHidden] = import_react19.useState(false);
|
|
4618
|
+
const timerRef = import_react19.useRef(null);
|
|
4457
4619
|
const rawMessage = error || executionError;
|
|
4458
|
-
|
|
4620
|
+
import_react19.useEffect(() => {
|
|
4459
4621
|
if (!rawMessage)
|
|
4460
4622
|
return;
|
|
4461
4623
|
setHidden(false);
|
|
@@ -4572,4 +4734,4 @@ var AgnoChat = Object.assign(AgnoChatRoot, {
|
|
|
4572
4734
|
Input: AgnoChatInputArea
|
|
4573
4735
|
});
|
|
4574
4736
|
|
|
4575
|
-
//# debugId=
|
|
4737
|
+
//# debugId=DF0422349E1C62CD64756E2164756E21
|