@rodrigocoliveira/agno-react 1.4.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -46
- package/dist/hooks/useAgnoToolExecution.d.ts +7 -11
- package/dist/hooks/useAgnoToolExecution.d.ts.map +1 -1
- package/dist/index.d.ts +7 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2353 -1043
- package/dist/index.js.map +31 -6
- package/dist/index.mjs +2371 -1040
- package/dist/index.mjs.map +31 -6
- package/dist/ui/components/chart.d.ts +63 -0
- package/dist/ui/components/chart.d.ts.map +1 -0
- package/dist/ui/composed/AgnoMessageItem.d.ts +12 -24
- package/dist/ui/composed/AgnoMessageItem.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/agno-chat.d.ts +25 -3
- package/dist/ui/composed/agno-chat/agno-chat.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/context.d.ts +4 -3
- package/dist/ui/composed/agno-chat/context.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/messages.d.ts +9 -15
- package/dist/ui/composed/agno-chat/messages.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/render-tool.d.ts +11 -0
- package/dist/ui/composed/agno-chat/render-tool.d.ts.map +1 -0
- package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts +7 -0
- package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/content.d.ts +2 -0
- package/dist/ui/composed/agno-message/content.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/context.d.ts +21 -0
- package/dist/ui/composed/agno-message/context.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/footer.d.ts +6 -0
- package/dist/ui/composed/agno-message/footer.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/index.d.ts +13 -0
- package/dist/ui/composed/agno-message/index.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/media.d.ts +2 -0
- package/dist/ui/composed/agno-message/media.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/message.d.ts +41 -0
- package/dist/ui/composed/agno-message/message.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/reasoning.d.ts +2 -0
- package/dist/ui/composed/agno-message/reasoning.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/references.d.ts +2 -0
- package/dist/ui/composed/agno-message/references.d.ts.map +1 -0
- package/dist/ui/composed/agno-message/tools.d.ts +7 -0
- package/dist/ui/composed/agno-message/tools.d.ts.map +1 -0
- 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 +10 -0
- package/dist/ui/composed/index.d.ts.map +1 -1
- package/dist/ui/index.d.ts +12 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/primitives/badge.d.ts +1 -1
- package/dist/ui/primitives/button.d.ts +1 -1
- package/dist/ui/primitives/command.d.ts +1 -1
- package/dist/ui.js +1305 -640
- package/dist/ui.js.map +20 -7
- package/dist/ui.mjs +1306 -636
- package/dist/ui.mjs.map +20 -7
- package/package.json +8 -3
- 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
|
@@ -47,6 +47,7 @@ __export(exports_ui, {
|
|
|
47
47
|
usePromptInputDropZone: () => usePromptInputDropZone,
|
|
48
48
|
usePromptInputController: () => usePromptInputController,
|
|
49
49
|
usePromptInputAttachments: () => usePromptInputAttachments,
|
|
50
|
+
useAgnoMessageContext: () => useAgnoMessageContext,
|
|
50
51
|
useAgnoChatContext: () => useAgnoChatContext,
|
|
51
52
|
isPreviewable: () => isPreviewable,
|
|
52
53
|
getFilePreviewType: () => getFilePreviewType,
|
|
@@ -55,6 +56,7 @@ __export(exports_ui, {
|
|
|
55
56
|
formatFullTimestamp: () => formatFullTimestamp,
|
|
56
57
|
formatFileSize: () => formatFileSize,
|
|
57
58
|
cn: () => cn,
|
|
59
|
+
byToolName: () => byToolName,
|
|
58
60
|
buttonVariants: () => buttonVariants,
|
|
59
61
|
badgeVariants: () => badgeVariants,
|
|
60
62
|
TooltipTrigger: () => TooltipTrigger,
|
|
@@ -64,6 +66,7 @@ __export(exports_ui, {
|
|
|
64
66
|
ToolOutput: () => ToolOutput,
|
|
65
67
|
ToolInput: () => ToolInput,
|
|
66
68
|
ToolHeader: () => ToolHeader,
|
|
69
|
+
ToolDebugCard: () => ToolDebugCard,
|
|
67
70
|
ToolContent: () => ToolContent,
|
|
68
71
|
Tool: () => Tool,
|
|
69
72
|
StreamingIndicator: () => StreamingIndicator,
|
|
@@ -114,9 +117,11 @@ __export(exports_ui, {
|
|
|
114
117
|
PromptInputActionMenu: () => PromptInputActionMenu,
|
|
115
118
|
PromptInputActionAddAttachments: () => PromptInputActionAddAttachments,
|
|
116
119
|
PromptInput: () => PromptInput,
|
|
120
|
+
PieChart: () => PieChart,
|
|
117
121
|
MessageContent: () => MessageContent,
|
|
118
122
|
MessageAvatar: () => MessageAvatar,
|
|
119
123
|
Message: () => Message,
|
|
124
|
+
LineChart: () => LineChart,
|
|
120
125
|
InputGroupTextarea: () => InputGroupTextarea,
|
|
121
126
|
InputGroupText: () => InputGroupText,
|
|
122
127
|
InputGroupInput: () => InputGroupInput,
|
|
@@ -171,7 +176,15 @@ __export(exports_ui, {
|
|
|
171
176
|
Collapsible: () => Collapsible,
|
|
172
177
|
CodeBlockCopyButton: () => CodeBlockCopyButton,
|
|
173
178
|
CodeBlock: () => CodeBlock,
|
|
179
|
+
ChartTooltipContent: () => ChartTooltipContent,
|
|
180
|
+
ChartTooltip: () => ChartTooltip,
|
|
181
|
+
ChartStyle: () => ChartStyle,
|
|
182
|
+
ChartLegendContent: () => ChartLegendContent,
|
|
183
|
+
ChartLegend: () => ChartLegend,
|
|
184
|
+
ChartContainer: () => ChartContainer,
|
|
185
|
+
CardGrid: () => CardGrid,
|
|
174
186
|
Button: () => Button,
|
|
187
|
+
BarChart: () => BarChart,
|
|
175
188
|
Badge: () => Badge,
|
|
176
189
|
AvatarImage: () => AvatarImage,
|
|
177
190
|
AvatarFallback: () => AvatarFallback,
|
|
@@ -185,7 +198,16 @@ __export(exports_ui, {
|
|
|
185
198
|
ArtifactActions: () => ArtifactActions,
|
|
186
199
|
ArtifactAction: () => ArtifactAction,
|
|
187
200
|
Artifact: () => Artifact,
|
|
201
|
+
AreaChart: () => AreaChart,
|
|
202
|
+
AgnoMessageTools: () => AgnoMessageTools,
|
|
203
|
+
AgnoMessageReferences: () => AgnoMessageReferences,
|
|
204
|
+
AgnoMessageReasoning: () => AgnoMessageReasoning,
|
|
205
|
+
AgnoMessageMedia: () => AgnoMessageMedia,
|
|
188
206
|
AgnoMessageItem: () => AgnoMessageItem,
|
|
207
|
+
AgnoMessageFooter: () => AgnoMessageFooter,
|
|
208
|
+
AgnoMessageContext: () => AgnoMessageContext,
|
|
209
|
+
AgnoMessageContent: () => AgnoMessageContent,
|
|
210
|
+
AgnoMessage: () => AgnoMessage,
|
|
189
211
|
AgnoChatSuggestedPrompts: () => AgnoChatSuggestedPrompts,
|
|
190
212
|
AgnoChatRoot: () => AgnoChatRoot,
|
|
191
213
|
AgnoChatMessages: () => AgnoChatMessages,
|
|
@@ -2873,573 +2895,759 @@ var PromptInputCommandSeparator = ({ className, ...props }) => /* @__PURE__ */ j
|
|
|
2873
2895
|
className: cn(className),
|
|
2874
2896
|
...props
|
|
2875
2897
|
});
|
|
2876
|
-
// src/ui/composed/
|
|
2898
|
+
// src/ui/composed/agno-message/message.tsx
|
|
2899
|
+
var import_react16 = require("react");
|
|
2900
|
+
var import_lucide_react23 = require("lucide-react");
|
|
2901
|
+
|
|
2902
|
+
// src/ui/composed/agno-message/context.ts
|
|
2877
2903
|
var import_react14 = require("react");
|
|
2878
|
-
var
|
|
2904
|
+
var AgnoMessageContext = import_react14.createContext(null);
|
|
2905
|
+
function useAgnoMessageContext() {
|
|
2906
|
+
const ctx = import_react14.useContext(AgnoMessageContext);
|
|
2907
|
+
if (!ctx) {
|
|
2908
|
+
throw new Error("useAgnoMessageContext must be used within an <AgnoMessage> provider. " + "Wrap your slots with <AgnoMessage message={...}>.");
|
|
2909
|
+
}
|
|
2910
|
+
return ctx;
|
|
2911
|
+
}
|
|
2912
|
+
|
|
2913
|
+
// src/ui/composed/agno-message/reasoning.tsx
|
|
2879
2914
|
var import_lucide_react19 = require("lucide-react");
|
|
2880
2915
|
var jsx_runtime35 = require("react/jsx-runtime");
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2916
|
+
function AgnoMessageReasoning() {
|
|
2917
|
+
const { message, classNames } = useAgnoMessageContext();
|
|
2918
|
+
const steps = message.extra_data?.reasoning_steps;
|
|
2919
|
+
if (!steps || steps.length === 0)
|
|
2920
|
+
return null;
|
|
2921
|
+
return /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
2922
|
+
className: cn("space-y-2 pt-1", classNames?.assistant?.reasoning),
|
|
2923
|
+
children: [
|
|
2924
|
+
/* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
2925
|
+
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2926
|
+
children: [
|
|
2927
|
+
/* @__PURE__ */ jsx_runtime35.jsx(import_lucide_react19.Lightbulb, {
|
|
2928
|
+
className: "h-3.5 w-3.5"
|
|
2929
|
+
}),
|
|
2930
|
+
"Reasoning (",
|
|
2931
|
+
steps.length,
|
|
2932
|
+
" steps)"
|
|
2933
|
+
]
|
|
2934
|
+
}),
|
|
2935
|
+
/* @__PURE__ */ jsx_runtime35.jsx(Accordion, {
|
|
2936
|
+
type: "multiple",
|
|
2937
|
+
className: "w-full",
|
|
2938
|
+
children: steps.map((step, idx) => /* @__PURE__ */ jsx_runtime35.jsxs(AccordionItem, {
|
|
2939
|
+
value: `reasoning-${idx}`,
|
|
2940
|
+
className: "border-muted",
|
|
2941
|
+
children: [
|
|
2942
|
+
/* @__PURE__ */ jsx_runtime35.jsx(AccordionTrigger, {
|
|
2943
|
+
className: "text-xs py-1.5 hover:no-underline",
|
|
2944
|
+
children: step.title || `Step ${idx + 1}`
|
|
2945
|
+
}),
|
|
2946
|
+
/* @__PURE__ */ jsx_runtime35.jsxs(AccordionContent, {
|
|
2947
|
+
className: "space-y-1.5 text-xs text-muted-foreground",
|
|
2948
|
+
children: [
|
|
2949
|
+
step.action && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
2950
|
+
children: [
|
|
2951
|
+
/* @__PURE__ */ jsx_runtime35.jsx("span", {
|
|
2952
|
+
className: "font-medium text-foreground",
|
|
2953
|
+
children: "Action:"
|
|
2954
|
+
}),
|
|
2955
|
+
" ",
|
|
2956
|
+
step.action
|
|
2957
|
+
]
|
|
2958
|
+
}),
|
|
2959
|
+
step.reasoning && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
2960
|
+
children: [
|
|
2961
|
+
/* @__PURE__ */ jsx_runtime35.jsx("span", {
|
|
2962
|
+
className: "font-medium text-foreground",
|
|
2963
|
+
children: "Reasoning:"
|
|
2964
|
+
}),
|
|
2965
|
+
" ",
|
|
2966
|
+
step.reasoning
|
|
2967
|
+
]
|
|
2968
|
+
}),
|
|
2969
|
+
step.result && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
2970
|
+
children: [
|
|
2971
|
+
/* @__PURE__ */ jsx_runtime35.jsx("span", {
|
|
2972
|
+
className: "font-medium text-foreground",
|
|
2973
|
+
children: "Result:"
|
|
2974
|
+
}),
|
|
2975
|
+
" ",
|
|
2976
|
+
step.result
|
|
2977
|
+
]
|
|
2978
|
+
}),
|
|
2979
|
+
step.confidence !== undefined && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
2980
|
+
children: [
|
|
2981
|
+
/* @__PURE__ */ jsx_runtime35.jsx("span", {
|
|
2982
|
+
className: "font-medium text-foreground",
|
|
2983
|
+
children: "Confidence:"
|
|
2984
|
+
}),
|
|
2985
|
+
" ",
|
|
2986
|
+
(step.confidence * 100).toFixed(1),
|
|
2987
|
+
"%"
|
|
2988
|
+
]
|
|
2989
|
+
})
|
|
2990
|
+
]
|
|
2991
|
+
})
|
|
2992
|
+
]
|
|
2993
|
+
}, idx))
|
|
2994
|
+
})
|
|
2995
|
+
]
|
|
2996
|
+
});
|
|
2997
|
+
}
|
|
2998
|
+
|
|
2999
|
+
// src/ui/composed/agno-message/media.tsx
|
|
3000
|
+
var import_lucide_react20 = require("lucide-react");
|
|
3001
|
+
var jsx_runtime36 = require("react/jsx-runtime");
|
|
3002
|
+
function AgnoMessageMedia() {
|
|
3003
|
+
const {
|
|
3004
|
+
message,
|
|
3005
|
+
classNames,
|
|
3006
|
+
showImageLightbox,
|
|
3007
|
+
showFilePreview,
|
|
3008
|
+
openImageLightbox,
|
|
3009
|
+
openFilePreview
|
|
3010
|
+
} = useAgnoMessageContext();
|
|
3011
|
+
const mediaClassName = classNames?.assistant?.media;
|
|
3012
|
+
const hasImages = !!message.images && message.images.length > 0;
|
|
3013
|
+
const hasVideos = !!message.videos && message.videos.length > 0;
|
|
3014
|
+
const hasAudio = !!message.audio && message.audio.length > 0;
|
|
3015
|
+
const hasFiles = !!message.files && message.files.length > 0;
|
|
3016
|
+
const hasResponseAudio = !!message.response_audio;
|
|
3017
|
+
if (!hasImages && !hasVideos && !hasAudio && !hasFiles && !hasResponseAudio)
|
|
3018
|
+
return null;
|
|
3019
|
+
return /* @__PURE__ */ jsx_runtime36.jsxs(jsx_runtime36.Fragment, {
|
|
3020
|
+
children: [
|
|
3021
|
+
hasImages && /* @__PURE__ */ jsx_runtime36.jsxs("div", {
|
|
3022
|
+
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3023
|
+
children: [
|
|
3024
|
+
/* @__PURE__ */ jsx_runtime36.jsxs("div", {
|
|
3025
|
+
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3026
|
+
children: [
|
|
3027
|
+
/* @__PURE__ */ jsx_runtime36.jsx(import_lucide_react20.Image, {
|
|
3028
|
+
className: "h-3.5 w-3.5"
|
|
3029
|
+
}),
|
|
3030
|
+
"Images (",
|
|
3031
|
+
message.images.length,
|
|
3032
|
+
")"
|
|
3033
|
+
]
|
|
3034
|
+
}),
|
|
3035
|
+
/* @__PURE__ */ jsx_runtime36.jsx("div", {
|
|
3036
|
+
className: "grid grid-cols-2 gap-2",
|
|
3037
|
+
children: message.images.map((img, idx) => /* @__PURE__ */ jsx_runtime36.jsxs("div", {
|
|
3038
|
+
className: "space-y-1",
|
|
3039
|
+
children: [
|
|
3040
|
+
showImageLightbox ? /* @__PURE__ */ jsx_runtime36.jsx("button", {
|
|
3041
|
+
type: "button",
|
|
3042
|
+
onClick: () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx),
|
|
3043
|
+
className: "group relative w-full overflow-hidden rounded-lg border border-border cursor-pointer hover:border-primary/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors",
|
|
3044
|
+
children: /* @__PURE__ */ jsx_runtime36.jsx("img", {
|
|
3045
|
+
src: img.url,
|
|
3046
|
+
alt: img.revised_prompt || "Generated image",
|
|
3047
|
+
className: "w-full rounded-lg"
|
|
3048
|
+
})
|
|
3049
|
+
}) : /* @__PURE__ */ jsx_runtime36.jsx("img", {
|
|
3050
|
+
src: img.url,
|
|
3051
|
+
alt: img.revised_prompt || "Generated image",
|
|
3052
|
+
className: "w-full rounded-lg border border-border"
|
|
3053
|
+
}),
|
|
3054
|
+
img.revised_prompt && /* @__PURE__ */ jsx_runtime36.jsx("p", {
|
|
3055
|
+
className: "text-[11px] text-muted-foreground italic px-0.5",
|
|
3056
|
+
children: img.revised_prompt
|
|
3057
|
+
})
|
|
3058
|
+
]
|
|
3059
|
+
}, idx))
|
|
3060
|
+
})
|
|
3061
|
+
]
|
|
3062
|
+
}),
|
|
3063
|
+
hasVideos && /* @__PURE__ */ jsx_runtime36.jsxs("div", {
|
|
3064
|
+
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3065
|
+
children: [
|
|
3066
|
+
/* @__PURE__ */ jsx_runtime36.jsxs("div", {
|
|
3067
|
+
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3068
|
+
children: [
|
|
3069
|
+
/* @__PURE__ */ jsx_runtime36.jsx(import_lucide_react20.Video, {
|
|
3070
|
+
className: "h-3.5 w-3.5"
|
|
3071
|
+
}),
|
|
3072
|
+
"Videos (",
|
|
3073
|
+
message.videos.length,
|
|
3074
|
+
")"
|
|
3075
|
+
]
|
|
3076
|
+
}),
|
|
3077
|
+
/* @__PURE__ */ jsx_runtime36.jsx("div", {
|
|
3078
|
+
className: "space-y-2",
|
|
3079
|
+
children: message.videos.map((video, idx) => /* @__PURE__ */ jsx_runtime36.jsx("div", {
|
|
3080
|
+
children: video.url ? /* @__PURE__ */ jsx_runtime36.jsx("video", {
|
|
3081
|
+
src: video.url,
|
|
3082
|
+
controls: true,
|
|
3083
|
+
className: "w-full rounded-lg border border-border"
|
|
3084
|
+
}) : /* @__PURE__ */ jsx_runtime36.jsxs("div", {
|
|
3085
|
+
className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
|
|
3086
|
+
children: [
|
|
3087
|
+
"Video ID: ",
|
|
3088
|
+
video.id,
|
|
3089
|
+
" (ETA: ",
|
|
3090
|
+
video.eta,
|
|
3091
|
+
"s)"
|
|
3092
|
+
]
|
|
3093
|
+
})
|
|
3094
|
+
}, idx))
|
|
3095
|
+
})
|
|
3096
|
+
]
|
|
3097
|
+
}),
|
|
3098
|
+
hasAudio && /* @__PURE__ */ jsx_runtime36.jsxs("div", {
|
|
3099
|
+
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3100
|
+
children: [
|
|
3101
|
+
/* @__PURE__ */ jsx_runtime36.jsxs("div", {
|
|
3102
|
+
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3103
|
+
children: [
|
|
3104
|
+
/* @__PURE__ */ jsx_runtime36.jsx(import_lucide_react20.Music, {
|
|
3105
|
+
className: "h-3.5 w-3.5"
|
|
3106
|
+
}),
|
|
3107
|
+
"Audio (",
|
|
3108
|
+
message.audio.length,
|
|
3109
|
+
")"
|
|
3110
|
+
]
|
|
3111
|
+
}),
|
|
3112
|
+
/* @__PURE__ */ jsx_runtime36.jsx("div", {
|
|
3113
|
+
className: "space-y-2",
|
|
3114
|
+
children: message.audio.map((audio, idx) => /* @__PURE__ */ jsx_runtime36.jsx("div", {
|
|
3115
|
+
children: audio.url ? /* @__PURE__ */ jsx_runtime36.jsx("audio", {
|
|
3116
|
+
src: audio.url,
|
|
3117
|
+
controls: true,
|
|
3118
|
+
className: "w-full"
|
|
3119
|
+
}) : audio.base64_audio ? /* @__PURE__ */ jsx_runtime36.jsx("audio", {
|
|
3120
|
+
src: `data:${audio.mime_type || "audio/wav"};base64,${audio.base64_audio}`,
|
|
3121
|
+
controls: true,
|
|
3122
|
+
className: "w-full"
|
|
3123
|
+
}) : /* @__PURE__ */ jsx_runtime36.jsx("div", {
|
|
3124
|
+
className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
|
|
3125
|
+
children: "Audio data unavailable"
|
|
3126
|
+
})
|
|
3127
|
+
}, idx))
|
|
3128
|
+
})
|
|
3129
|
+
]
|
|
3130
|
+
}),
|
|
3131
|
+
hasFiles && /* @__PURE__ */ jsx_runtime36.jsxs("div", {
|
|
3132
|
+
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3133
|
+
children: [
|
|
3134
|
+
/* @__PURE__ */ jsx_runtime36.jsxs("div", {
|
|
3135
|
+
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3136
|
+
children: [
|
|
3137
|
+
/* @__PURE__ */ jsx_runtime36.jsx(import_lucide_react20.Paperclip, {
|
|
3138
|
+
className: "h-3.5 w-3.5"
|
|
3139
|
+
}),
|
|
3140
|
+
"Files (",
|
|
3141
|
+
message.files.length,
|
|
3142
|
+
")"
|
|
3143
|
+
]
|
|
3144
|
+
}),
|
|
3145
|
+
/* @__PURE__ */ jsx_runtime36.jsx("div", {
|
|
3146
|
+
className: "flex flex-wrap gap-2",
|
|
3147
|
+
children: message.files.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx_runtime36.jsx(FilePreviewCard, {
|
|
3148
|
+
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
3149
|
+
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
3150
|
+
}, idx) : /* @__PURE__ */ jsx_runtime36.jsxs("div", {
|
|
3151
|
+
className: "flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-xs bg-muted/30 hover:bg-muted/50 transition-colors",
|
|
3152
|
+
children: [
|
|
3153
|
+
/* @__PURE__ */ jsx_runtime36.jsx(import_lucide_react20.FileIcon, {
|
|
3154
|
+
className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
|
|
3155
|
+
}),
|
|
3156
|
+
/* @__PURE__ */ jsx_runtime36.jsx("span", {
|
|
3157
|
+
className: "truncate max-w-[180px]",
|
|
3158
|
+
children: file.name
|
|
3159
|
+
}),
|
|
3160
|
+
file.size && /* @__PURE__ */ jsx_runtime36.jsxs("span", {
|
|
3161
|
+
className: "text-muted-foreground/70",
|
|
3162
|
+
children: [
|
|
3163
|
+
"(",
|
|
3164
|
+
(file.size / 1024).toFixed(1),
|
|
3165
|
+
"KB)"
|
|
3166
|
+
]
|
|
3167
|
+
}),
|
|
3168
|
+
file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsx_runtime36.jsx("a", {
|
|
3169
|
+
href: file.url,
|
|
3170
|
+
target: "_blank",
|
|
3171
|
+
rel: "noopener noreferrer",
|
|
3172
|
+
className: "text-primary hover:underline font-medium",
|
|
3173
|
+
children: "View"
|
|
3174
|
+
})
|
|
3175
|
+
]
|
|
3176
|
+
}, idx))
|
|
3177
|
+
})
|
|
3178
|
+
]
|
|
3179
|
+
}),
|
|
3180
|
+
hasResponseAudio && message.response_audio && /* @__PURE__ */ jsx_runtime36.jsxs("div", {
|
|
3181
|
+
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3182
|
+
children: [
|
|
3183
|
+
/* @__PURE__ */ jsx_runtime36.jsxs("div", {
|
|
3184
|
+
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3185
|
+
children: [
|
|
3186
|
+
/* @__PURE__ */ jsx_runtime36.jsx(import_lucide_react20.Music, {
|
|
3187
|
+
className: "h-3.5 w-3.5"
|
|
3188
|
+
}),
|
|
3189
|
+
"Response Audio"
|
|
3190
|
+
]
|
|
3191
|
+
}),
|
|
3192
|
+
message.response_audio.transcript && /* @__PURE__ */ jsx_runtime36.jsxs("div", {
|
|
3193
|
+
className: "text-xs italic bg-muted/50 border border-border p-2.5 rounded-lg text-muted-foreground",
|
|
3194
|
+
children: [
|
|
3195
|
+
'"',
|
|
3196
|
+
message.response_audio.transcript,
|
|
3197
|
+
'"'
|
|
3198
|
+
]
|
|
3199
|
+
}),
|
|
3200
|
+
message.response_audio.content && /* @__PURE__ */ jsx_runtime36.jsx("audio", {
|
|
3201
|
+
src: `data:audio/wav;base64,${message.response_audio.content}`,
|
|
3202
|
+
controls: true,
|
|
3203
|
+
className: "w-full"
|
|
3204
|
+
})
|
|
3205
|
+
]
|
|
3206
|
+
})
|
|
3207
|
+
]
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
|
|
3211
|
+
// src/ui/composed/agno-chat/context.ts
|
|
3212
|
+
var import_react15 = require("react");
|
|
3213
|
+
var AgnoChatContext = import_react15.createContext(null);
|
|
3214
|
+
function useAgnoChatContext() {
|
|
3215
|
+
const ctx = import_react15.useContext(AgnoChatContext);
|
|
3216
|
+
if (!ctx) {
|
|
3217
|
+
throw new Error("useAgnoChatContext must be used within an <AgnoChat> provider. " + "Wrap your component tree with <AgnoChat>.");
|
|
3218
|
+
}
|
|
3219
|
+
return ctx;
|
|
3220
|
+
}
|
|
3221
|
+
|
|
3222
|
+
// src/ui/composed/agno-chat/tool-building-blocks.tsx
|
|
3223
|
+
var jsx_runtime37 = require("react/jsx-runtime");
|
|
3224
|
+
var getToolState = (tool) => tool.tool_call_error ? "output-error" : "output-available";
|
|
3225
|
+
function ToolDebugCard({ tool, defaultOpen }) {
|
|
3226
|
+
const output = tool.result ?? tool.content;
|
|
3227
|
+
return /* @__PURE__ */ jsx_runtime37.jsxs(Tool, {
|
|
3228
|
+
defaultOpen,
|
|
3229
|
+
children: [
|
|
3230
|
+
/* @__PURE__ */ jsx_runtime37.jsx(ToolHeader, {
|
|
3231
|
+
title: tool.tool_name,
|
|
3232
|
+
type: "tool-use",
|
|
3233
|
+
state: getToolState(tool)
|
|
3234
|
+
}),
|
|
3235
|
+
/* @__PURE__ */ jsx_runtime37.jsxs(ToolContent, {
|
|
3236
|
+
children: [
|
|
3237
|
+
/* @__PURE__ */ jsx_runtime37.jsx(ToolInput, {
|
|
3238
|
+
input: tool.tool_args
|
|
3239
|
+
}),
|
|
3240
|
+
output ? /* @__PURE__ */ jsx_runtime37.jsx(ToolOutput, {
|
|
3241
|
+
output,
|
|
3242
|
+
errorText: tool.tool_call_error ? "Tool execution failed" : undefined
|
|
3243
|
+
}) : null
|
|
3244
|
+
]
|
|
3245
|
+
})
|
|
3246
|
+
]
|
|
3247
|
+
});
|
|
3248
|
+
}
|
|
3249
|
+
|
|
3250
|
+
// src/ui/composed/agno-message/tools.tsx
|
|
3251
|
+
var jsx_runtime38 = require("react/jsx-runtime");
|
|
3252
|
+
function AgnoMessageTools({ renderTool: renderToolProp } = {}) {
|
|
3253
|
+
const { message, classNames, renderTool: ctxMsgRenderTool } = useAgnoMessageContext();
|
|
3254
|
+
const { renderTool: ctxChatRenderTool, isDebug } = useAgnoChatContext();
|
|
3255
|
+
const renderTool = renderToolProp ?? ctxMsgRenderTool ?? ctxChatRenderTool;
|
|
3256
|
+
if (!message.tool_calls || message.tool_calls.length === 0)
|
|
3257
|
+
return null;
|
|
3258
|
+
return /* @__PURE__ */ jsx_runtime38.jsx("div", {
|
|
3259
|
+
className: cn("space-y-2 pt-1", classNames?.assistant?.toolCalls),
|
|
3260
|
+
children: message.tool_calls.map((tool, idx) => {
|
|
3261
|
+
const defaultRender = () => isDebug ? /* @__PURE__ */ jsx_runtime38.jsx(ToolDebugCard, {
|
|
3262
|
+
tool,
|
|
3263
|
+
defaultOpen: idx === 0
|
|
3264
|
+
}) : null;
|
|
3265
|
+
const node = renderTool ? renderTool(tool, { index: idx, isDebug, defaultRender }) : defaultRender();
|
|
3266
|
+
if (node === null || node === undefined)
|
|
3267
|
+
return null;
|
|
3268
|
+
return /* @__PURE__ */ jsx_runtime38.jsx("div", {
|
|
3269
|
+
children: node
|
|
3270
|
+
}, tool.tool_call_id || idx);
|
|
3271
|
+
})
|
|
3272
|
+
});
|
|
3273
|
+
}
|
|
3274
|
+
|
|
3275
|
+
// src/ui/composed/agno-message/content.tsx
|
|
3276
|
+
var jsx_runtime39 = require("react/jsx-runtime");
|
|
3277
|
+
function AgnoMessageContent() {
|
|
3278
|
+
const { message } = useAgnoMessageContext();
|
|
3279
|
+
if (!message.content)
|
|
3280
|
+
return null;
|
|
3281
|
+
return /* @__PURE__ */ jsx_runtime39.jsx("div", {
|
|
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",
|
|
3283
|
+
children: /* @__PURE__ */ jsx_runtime39.jsx(Response, {
|
|
3284
|
+
children: message.content
|
|
3285
|
+
})
|
|
3286
|
+
});
|
|
3287
|
+
}
|
|
3288
|
+
|
|
3289
|
+
// src/ui/composed/agno-message/references.tsx
|
|
3290
|
+
var import_lucide_react21 = require("lucide-react");
|
|
3291
|
+
var jsx_runtime40 = require("react/jsx-runtime");
|
|
3292
|
+
function AgnoMessageReferences() {
|
|
3293
|
+
const { message, classNames } = useAgnoMessageContext();
|
|
3294
|
+
const references = message.extra_data?.references;
|
|
3295
|
+
if (!references || references.length === 0)
|
|
3296
|
+
return null;
|
|
3297
|
+
return /* @__PURE__ */ jsx_runtime40.jsxs("div", {
|
|
3298
|
+
className: cn("space-y-2 pt-1", classNames?.assistant?.references),
|
|
3299
|
+
children: [
|
|
3300
|
+
/* @__PURE__ */ jsx_runtime40.jsxs("div", {
|
|
3301
|
+
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3302
|
+
children: [
|
|
3303
|
+
/* @__PURE__ */ jsx_runtime40.jsx(import_lucide_react21.FileText, {
|
|
3304
|
+
className: "h-3.5 w-3.5"
|
|
3305
|
+
}),
|
|
3306
|
+
"References (",
|
|
3307
|
+
references.length,
|
|
3308
|
+
")"
|
|
3309
|
+
]
|
|
3310
|
+
}),
|
|
3311
|
+
/* @__PURE__ */ jsx_runtime40.jsx("div", {
|
|
3312
|
+
className: "space-y-2",
|
|
3313
|
+
children: references.map((refData, idx) => /* @__PURE__ */ jsx_runtime40.jsxs("div", {
|
|
3314
|
+
className: "text-xs space-y-1.5",
|
|
3315
|
+
children: [
|
|
3316
|
+
refData.query && /* @__PURE__ */ jsx_runtime40.jsxs("div", {
|
|
3317
|
+
className: "font-medium text-foreground",
|
|
3318
|
+
children: [
|
|
3319
|
+
"Query: ",
|
|
3320
|
+
refData.query
|
|
3321
|
+
]
|
|
3322
|
+
}),
|
|
3323
|
+
refData.references.map((ref, refIdx) => /* @__PURE__ */ jsx_runtime40.jsxs("div", {
|
|
3324
|
+
className: "bg-muted/50 border border-border p-2.5 rounded-lg",
|
|
3325
|
+
children: [
|
|
3326
|
+
/* @__PURE__ */ jsx_runtime40.jsxs("div", {
|
|
3327
|
+
className: "italic text-muted-foreground mb-1",
|
|
3328
|
+
children: [
|
|
3329
|
+
'"',
|
|
3330
|
+
ref.content,
|
|
3331
|
+
'"'
|
|
3332
|
+
]
|
|
3333
|
+
}),
|
|
3334
|
+
/* @__PURE__ */ jsx_runtime40.jsxs("div", {
|
|
3335
|
+
className: "text-muted-foreground/70",
|
|
3336
|
+
children: [
|
|
3337
|
+
"Source: ",
|
|
3338
|
+
ref.name,
|
|
3339
|
+
" (chunk ",
|
|
3340
|
+
ref.meta_data.chunk,
|
|
3341
|
+
"/",
|
|
3342
|
+
ref.meta_data.chunk_size,
|
|
3343
|
+
")"
|
|
3344
|
+
]
|
|
3345
|
+
})
|
|
3346
|
+
]
|
|
3347
|
+
}, refIdx))
|
|
3348
|
+
]
|
|
3349
|
+
}, idx))
|
|
3350
|
+
})
|
|
3351
|
+
]
|
|
3352
|
+
});
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
// src/ui/composed/agno-message/footer.tsx
|
|
3356
|
+
var import_lucide_react22 = require("lucide-react");
|
|
3357
|
+
var jsx_runtime41 = require("react/jsx-runtime");
|
|
3358
|
+
function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
3359
|
+
const { message, classNames, actions, isLastAssistantMessage, formatTimestamp } = useAgnoMessageContext();
|
|
3360
|
+
const hasError = message.streamingError;
|
|
3361
|
+
const isCustomTimestamp = !!formatTimestamp;
|
|
3362
|
+
const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
|
|
3363
|
+
if (!actions?.assistant && !showTimestamp && !hasError)
|
|
3364
|
+
return null;
|
|
3365
|
+
return /* @__PURE__ */ jsx_runtime41.jsxs("div", {
|
|
3366
|
+
className: "flex items-center gap-2 pt-1",
|
|
3367
|
+
children: [
|
|
3368
|
+
actions?.assistant && (() => {
|
|
3369
|
+
const visibility = actions.visibility ?? "visible";
|
|
3370
|
+
if (visibility === "last-assistant" && !isLastAssistantMessage)
|
|
3371
|
+
return null;
|
|
3372
|
+
const useHover = visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage;
|
|
3373
|
+
return /* @__PURE__ */ jsx_runtime41.jsx("div", {
|
|
3374
|
+
className: cn("flex items-center gap-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100", classNames?.assistant?.actions),
|
|
3375
|
+
children: actions.assistant(message)
|
|
3376
|
+
});
|
|
3377
|
+
})(),
|
|
3378
|
+
hasError && /* @__PURE__ */ jsx_runtime41.jsxs("span", {
|
|
3379
|
+
className: "flex items-center gap-1 text-[11px] text-destructive",
|
|
3380
|
+
children: [
|
|
3381
|
+
/* @__PURE__ */ jsx_runtime41.jsx(import_lucide_react22.AlertCircle, {
|
|
3382
|
+
className: "h-3 w-3"
|
|
3383
|
+
}),
|
|
3384
|
+
"Error"
|
|
3385
|
+
]
|
|
3386
|
+
}),
|
|
3387
|
+
showTimestamp && /* @__PURE__ */ jsx_runtime41.jsx(SmartTimestamp, {
|
|
3388
|
+
date: new Date(message.created_at * 1000),
|
|
3389
|
+
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
3390
|
+
className: "text-[11px] text-muted-foreground"
|
|
3391
|
+
})
|
|
3392
|
+
]
|
|
3393
|
+
});
|
|
3394
|
+
}
|
|
3395
|
+
|
|
3396
|
+
// src/ui/composed/agno-message/message.tsx
|
|
3397
|
+
var jsx_runtime42 = require("react/jsx-runtime");
|
|
3398
|
+
function DefaultAssistantComposition({ showTimestamp }) {
|
|
3399
|
+
return /* @__PURE__ */ jsx_runtime42.jsxs(jsx_runtime42.Fragment, {
|
|
3400
|
+
children: [
|
|
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, {
|
|
3407
|
+
showTimestamp
|
|
3408
|
+
})
|
|
3409
|
+
]
|
|
3410
|
+
});
|
|
3411
|
+
}
|
|
3412
|
+
function AgnoMessage({
|
|
2886
3413
|
message,
|
|
2887
3414
|
className,
|
|
2888
3415
|
classNames,
|
|
2889
|
-
renderContent,
|
|
2890
|
-
renderToolCall,
|
|
2891
|
-
renderMedia,
|
|
2892
3416
|
avatars,
|
|
2893
3417
|
actions,
|
|
2894
3418
|
isLastAssistantMessage = false,
|
|
2895
|
-
showReasoning = true,
|
|
2896
|
-
showReferences = true,
|
|
2897
|
-
showTimestamp = true,
|
|
2898
|
-
showGenerativeUI = true,
|
|
2899
|
-
showToolCalls = true,
|
|
2900
3419
|
showFilePreview = true,
|
|
2901
3420
|
showImageLightbox = true,
|
|
3421
|
+
showTimestamp = true,
|
|
2902
3422
|
formatTimestamp,
|
|
2903
|
-
|
|
3423
|
+
renderTool,
|
|
3424
|
+
children
|
|
2904
3425
|
}) {
|
|
2905
3426
|
const isUser = message.role === "user";
|
|
2906
3427
|
const hasError = message.streamingError;
|
|
2907
|
-
const
|
|
2908
|
-
const [preview, setPreview] = import_react14.useState(null);
|
|
3428
|
+
const [preview, setPreview] = import_react16.useState(null);
|
|
2909
3429
|
const isCustomTimestamp = !!formatTimestamp;
|
|
2910
|
-
const resolvedFormatTimestamp = formatTimestamp ??
|
|
2911
|
-
const
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
3430
|
+
const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
|
|
3431
|
+
const ctx = import_react16.useMemo(() => ({
|
|
3432
|
+
message,
|
|
3433
|
+
isLastAssistantMessage,
|
|
3434
|
+
classNames,
|
|
3435
|
+
actions,
|
|
3436
|
+
avatars,
|
|
3437
|
+
formatTimestamp,
|
|
3438
|
+
showFilePreview,
|
|
3439
|
+
showImageLightbox,
|
|
3440
|
+
openImageLightbox: (images, index) => {
|
|
3441
|
+
if (!showImageLightbox)
|
|
3442
|
+
return;
|
|
3443
|
+
setPreview({ type: "image", images, initialIndex: index });
|
|
3444
|
+
},
|
|
3445
|
+
openFilePreview: (file) => {
|
|
3446
|
+
if (!showFilePreview)
|
|
3447
|
+
return;
|
|
3448
|
+
setPreview({ type: "file", file });
|
|
3449
|
+
},
|
|
3450
|
+
renderTool
|
|
3451
|
+
}), [
|
|
3452
|
+
message,
|
|
3453
|
+
isLastAssistantMessage,
|
|
3454
|
+
classNames,
|
|
3455
|
+
actions,
|
|
3456
|
+
avatars,
|
|
3457
|
+
formatTimestamp,
|
|
3458
|
+
showFilePreview,
|
|
3459
|
+
showImageLightbox,
|
|
3460
|
+
renderTool
|
|
3461
|
+
]);
|
|
2921
3462
|
const closePreview = () => setPreview(null);
|
|
2922
|
-
return /* @__PURE__ */
|
|
2923
|
-
|
|
3463
|
+
return /* @__PURE__ */ jsx_runtime42.jsx(AgnoMessageContext.Provider, {
|
|
3464
|
+
value: ctx,
|
|
3465
|
+
children: /* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
3466
|
+
className: cn("py-5 first:pt-2", isUser ? "flex justify-end" : "", classNames?.root, className),
|
|
3467
|
+
children: [
|
|
3468
|
+
isUser ? /* @__PURE__ */ jsx_runtime42.jsx(UserMessageLayout, {
|
|
3469
|
+
message,
|
|
3470
|
+
classNames,
|
|
3471
|
+
avatars,
|
|
3472
|
+
actions,
|
|
3473
|
+
isCustomTimestamp,
|
|
3474
|
+
resolvedFormatTimestamp,
|
|
3475
|
+
showTimestamp,
|
|
3476
|
+
showImageLightbox,
|
|
3477
|
+
showFilePreview,
|
|
3478
|
+
openImageLightbox: ctx.openImageLightbox,
|
|
3479
|
+
openFilePreview: ctx.openFilePreview,
|
|
3480
|
+
hasError
|
|
3481
|
+
}) : /* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
3482
|
+
className: "flex items-start gap-3 group/message",
|
|
3483
|
+
children: [
|
|
3484
|
+
avatars?.assistant,
|
|
3485
|
+
/* @__PURE__ */ jsx_runtime42.jsx("div", {
|
|
3486
|
+
className: cn("flex-1 min-w-0 space-y-3", classNames?.assistant?.container),
|
|
3487
|
+
children: children ?? /* @__PURE__ */ jsx_runtime42.jsx(DefaultAssistantComposition, {
|
|
3488
|
+
showTimestamp
|
|
3489
|
+
})
|
|
3490
|
+
})
|
|
3491
|
+
]
|
|
3492
|
+
}),
|
|
3493
|
+
preview?.type === "image" && /* @__PURE__ */ jsx_runtime42.jsx(ImageLightbox, {
|
|
3494
|
+
open: true,
|
|
3495
|
+
onOpenChange: (open) => {
|
|
3496
|
+
if (!open)
|
|
3497
|
+
closePreview();
|
|
3498
|
+
},
|
|
3499
|
+
images: preview.images,
|
|
3500
|
+
initialIndex: preview.initialIndex
|
|
3501
|
+
}),
|
|
3502
|
+
preview?.type === "file" && /* @__PURE__ */ jsx_runtime42.jsx(FilePreviewModal, {
|
|
3503
|
+
open: true,
|
|
3504
|
+
onOpenChange: (open) => {
|
|
3505
|
+
if (!open)
|
|
3506
|
+
closePreview();
|
|
3507
|
+
},
|
|
3508
|
+
file: preview.file
|
|
3509
|
+
})
|
|
3510
|
+
]
|
|
3511
|
+
})
|
|
3512
|
+
});
|
|
3513
|
+
}
|
|
3514
|
+
AgnoMessage.Reasoning = AgnoMessageReasoning;
|
|
3515
|
+
AgnoMessage.Media = AgnoMessageMedia;
|
|
3516
|
+
AgnoMessage.Tools = AgnoMessageTools;
|
|
3517
|
+
AgnoMessage.Content = AgnoMessageContent;
|
|
3518
|
+
AgnoMessage.References = AgnoMessageReferences;
|
|
3519
|
+
AgnoMessage.Footer = AgnoMessageFooter;
|
|
3520
|
+
function UserMessageLayout({
|
|
3521
|
+
message,
|
|
3522
|
+
classNames,
|
|
3523
|
+
avatars,
|
|
3524
|
+
actions,
|
|
3525
|
+
isCustomTimestamp,
|
|
3526
|
+
resolvedFormatTimestamp,
|
|
3527
|
+
showTimestamp,
|
|
3528
|
+
showImageLightbox,
|
|
3529
|
+
showFilePreview,
|
|
3530
|
+
openImageLightbox,
|
|
3531
|
+
openFilePreview,
|
|
3532
|
+
hasError
|
|
3533
|
+
}) {
|
|
3534
|
+
return /* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
3535
|
+
className: "flex items-start gap-2.5 max-w-[80%] flex-row-reverse",
|
|
2924
3536
|
children: [
|
|
2925
|
-
|
|
2926
|
-
|
|
3537
|
+
avatars?.user,
|
|
3538
|
+
/* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
3539
|
+
className: "space-y-1.5 flex flex-col items-end min-w-0",
|
|
2927
3540
|
children: [
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
className: "space-y-1.5 flex flex-col items-end min-w-0",
|
|
3541
|
+
(message.images && message.images.length > 0 || message.audio && message.audio.length > 0 || message.files && message.files.length > 0) && /* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
3542
|
+
className: "flex flex-wrap gap-2 justify-end",
|
|
2931
3543
|
children: [
|
|
2932
|
-
|
|
2933
|
-
|
|
3544
|
+
message.images?.map((img, idx) => /* @__PURE__ */ jsx_runtime42.jsx(FilePreviewCard, {
|
|
3545
|
+
file: { name: img.revised_prompt || `Image ${idx + 1}`, type: "image/png", url: img.url },
|
|
3546
|
+
onClick: showImageLightbox ? () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx) : undefined
|
|
3547
|
+
}, `img-${idx}`)),
|
|
3548
|
+
message.audio?.map((audio, idx) => /* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
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",
|
|
2934
3550
|
children: [
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
onClick: showImageLightbox ? () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx) : undefined
|
|
2938
|
-
}, `img-${idx}`)),
|
|
2939
|
-
message.audio?.map((audio, idx) => /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
2940
|
-
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",
|
|
2941
|
-
children: [
|
|
2942
|
-
/* @__PURE__ */ jsx_runtime35.jsx(import_lucide_react19.Music, {
|
|
2943
|
-
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
2944
|
-
}),
|
|
2945
|
-
/* @__PURE__ */ jsx_runtime35.jsx("span", {
|
|
2946
|
-
className: "truncate max-w-[150px]",
|
|
2947
|
-
children: audio.id || `Audio ${idx + 1}`
|
|
2948
|
-
})
|
|
2949
|
-
]
|
|
2950
|
-
}, `audio-${idx}`)),
|
|
2951
|
-
message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx_runtime35.jsx(FilePreviewCard, {
|
|
2952
|
-
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
2953
|
-
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
2954
|
-
}, `file-${idx}`) : /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
2955
|
-
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",
|
|
2956
|
-
children: [
|
|
2957
|
-
/* @__PURE__ */ jsx_runtime35.jsx(import_lucide_react19.FileIcon, {
|
|
2958
|
-
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
2959
|
-
}),
|
|
2960
|
-
/* @__PURE__ */ jsx_runtime35.jsx("span", {
|
|
2961
|
-
className: "truncate max-w-[150px]",
|
|
2962
|
-
children: file.name
|
|
2963
|
-
})
|
|
2964
|
-
]
|
|
2965
|
-
}, `file-${idx}`))
|
|
2966
|
-
]
|
|
2967
|
-
}),
|
|
2968
|
-
message.content && /* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
2969
|
-
className: cn("rounded-2xl rounded-br-md px-4 py-2.5", classNames?.user?.bubble ?? "bg-primary text-primary-foreground", hasError && "opacity-70"),
|
|
2970
|
-
children: /* @__PURE__ */ jsx_runtime35.jsx("p", {
|
|
2971
|
-
className: "text-sm whitespace-pre-wrap",
|
|
2972
|
-
children: message.content
|
|
2973
|
-
})
|
|
2974
|
-
}),
|
|
2975
|
-
(showTimestamp || actions?.user) && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
2976
|
-
className: "flex items-center justify-end gap-1.5 px-1",
|
|
2977
|
-
children: [
|
|
2978
|
-
actions?.user && /* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
2979
|
-
className: "flex items-center gap-1",
|
|
2980
|
-
children: actions.user(message)
|
|
2981
|
-
}),
|
|
2982
|
-
/* @__PURE__ */ jsx_runtime35.jsx(SmartTimestamp, {
|
|
2983
|
-
date: new Date(message.created_at * 1000),
|
|
2984
|
-
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
2985
|
-
className: "text-[11px] text-muted-foreground"
|
|
3551
|
+
/* @__PURE__ */ jsx_runtime42.jsx(import_lucide_react23.Music, {
|
|
3552
|
+
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
2986
3553
|
}),
|
|
2987
|
-
|
|
2988
|
-
className: "
|
|
3554
|
+
/* @__PURE__ */ jsx_runtime42.jsx("span", {
|
|
3555
|
+
className: "truncate max-w-[150px]",
|
|
3556
|
+
children: audio.id || `Audio ${idx + 1}`
|
|
2989
3557
|
})
|
|
2990
3558
|
]
|
|
2991
|
-
})
|
|
2992
|
-
|
|
2993
|
-
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
children: [
|
|
2998
|
-
avatars?.assistant,
|
|
2999
|
-
/* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3000
|
-
className: cn("flex-1 min-w-0 space-y-3", classNames?.assistant?.container),
|
|
3001
|
-
children: [
|
|
3002
|
-
renderContent ? renderContent(message) : /* @__PURE__ */ jsx_runtime35.jsxs(jsx_runtime35.Fragment, {
|
|
3559
|
+
}, `audio-${idx}`)),
|
|
3560
|
+
message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx_runtime42.jsx(FilePreviewCard, {
|
|
3561
|
+
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
3562
|
+
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
3563
|
+
}, `file-${idx}`) : /* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
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",
|
|
3003
3565
|
children: [
|
|
3004
|
-
|
|
3005
|
-
className:
|
|
3006
|
-
children: [
|
|
3007
|
-
/* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3008
|
-
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3009
|
-
children: [
|
|
3010
|
-
/* @__PURE__ */ jsx_runtime35.jsx(import_lucide_react19.Lightbulb, {
|
|
3011
|
-
className: "h-3.5 w-3.5"
|
|
3012
|
-
}),
|
|
3013
|
-
"Reasoning (",
|
|
3014
|
-
message.extra_data.reasoning_steps.length,
|
|
3015
|
-
" steps)"
|
|
3016
|
-
]
|
|
3017
|
-
}),
|
|
3018
|
-
/* @__PURE__ */ jsx_runtime35.jsx(Accordion, {
|
|
3019
|
-
type: "multiple",
|
|
3020
|
-
className: "w-full",
|
|
3021
|
-
children: message.extra_data.reasoning_steps.map((step, idx) => /* @__PURE__ */ jsx_runtime35.jsxs(AccordionItem, {
|
|
3022
|
-
value: `reasoning-${idx}`,
|
|
3023
|
-
className: "border-muted",
|
|
3024
|
-
children: [
|
|
3025
|
-
/* @__PURE__ */ jsx_runtime35.jsx(AccordionTrigger, {
|
|
3026
|
-
className: "text-xs py-1.5 hover:no-underline",
|
|
3027
|
-
children: step.title || `Step ${idx + 1}`
|
|
3028
|
-
}),
|
|
3029
|
-
/* @__PURE__ */ jsx_runtime35.jsxs(AccordionContent, {
|
|
3030
|
-
className: "space-y-1.5 text-xs text-muted-foreground",
|
|
3031
|
-
children: [
|
|
3032
|
-
step.action && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3033
|
-
children: [
|
|
3034
|
-
/* @__PURE__ */ jsx_runtime35.jsx("span", {
|
|
3035
|
-
className: "font-medium text-foreground",
|
|
3036
|
-
children: "Action:"
|
|
3037
|
-
}),
|
|
3038
|
-
" ",
|
|
3039
|
-
step.action
|
|
3040
|
-
]
|
|
3041
|
-
}),
|
|
3042
|
-
step.reasoning && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3043
|
-
children: [
|
|
3044
|
-
/* @__PURE__ */ jsx_runtime35.jsx("span", {
|
|
3045
|
-
className: "font-medium text-foreground",
|
|
3046
|
-
children: "Reasoning:"
|
|
3047
|
-
}),
|
|
3048
|
-
" ",
|
|
3049
|
-
step.reasoning
|
|
3050
|
-
]
|
|
3051
|
-
}),
|
|
3052
|
-
step.result && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3053
|
-
children: [
|
|
3054
|
-
/* @__PURE__ */ jsx_runtime35.jsx("span", {
|
|
3055
|
-
className: "font-medium text-foreground",
|
|
3056
|
-
children: "Result:"
|
|
3057
|
-
}),
|
|
3058
|
-
" ",
|
|
3059
|
-
step.result
|
|
3060
|
-
]
|
|
3061
|
-
}),
|
|
3062
|
-
step.confidence !== undefined && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3063
|
-
children: [
|
|
3064
|
-
/* @__PURE__ */ jsx_runtime35.jsx("span", {
|
|
3065
|
-
className: "font-medium text-foreground",
|
|
3066
|
-
children: "Confidence:"
|
|
3067
|
-
}),
|
|
3068
|
-
" ",
|
|
3069
|
-
(step.confidence * 100).toFixed(1),
|
|
3070
|
-
"%"
|
|
3071
|
-
]
|
|
3072
|
-
})
|
|
3073
|
-
]
|
|
3074
|
-
})
|
|
3075
|
-
]
|
|
3076
|
-
}, idx))
|
|
3077
|
-
})
|
|
3078
|
-
]
|
|
3079
|
-
}),
|
|
3080
|
-
message.content && /* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
3081
|
-
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",
|
|
3082
|
-
children: /* @__PURE__ */ jsx_runtime35.jsx(Response, {
|
|
3083
|
-
children: message.content
|
|
3084
|
-
})
|
|
3085
|
-
}),
|
|
3086
|
-
showGenerativeUI && toolsWithUI.length > 0 && /* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
3087
|
-
className: "space-y-3",
|
|
3088
|
-
children: toolsWithUI.map((tool) => {
|
|
3089
|
-
const uiComponent = tool.ui_component;
|
|
3090
|
-
return /* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
3091
|
-
children: uiComponent.layout === "artifact" ? /* @__PURE__ */ jsx_runtime35.jsx(Artifact, {
|
|
3092
|
-
children: /* @__PURE__ */ jsx_runtime35.jsx(import_agno_react.GenerativeUIRenderer, {
|
|
3093
|
-
spec: uiComponent,
|
|
3094
|
-
className: "w-full p-2"
|
|
3095
|
-
})
|
|
3096
|
-
}) : /* @__PURE__ */ jsx_runtime35.jsx(import_agno_react.GenerativeUIRenderer, {
|
|
3097
|
-
spec: uiComponent,
|
|
3098
|
-
className: "w-full"
|
|
3099
|
-
})
|
|
3100
|
-
}, tool.tool_call_id);
|
|
3101
|
-
})
|
|
3566
|
+
/* @__PURE__ */ jsx_runtime42.jsx(import_lucide_react23.FileIcon, {
|
|
3567
|
+
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
3102
3568
|
}),
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
if (!renderer || !content)
|
|
3107
|
-
return null;
|
|
3108
|
-
return /* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
3109
|
-
children: renderer(tool.tool_args, content)
|
|
3110
|
-
}, `result-${tool.tool_call_id}`);
|
|
3111
|
-
}),
|
|
3112
|
-
renderMedia ? renderMedia(message) : (() => {
|
|
3113
|
-
const mediaClassName = classNames?.assistant?.media;
|
|
3114
|
-
return /* @__PURE__ */ jsx_runtime35.jsxs(jsx_runtime35.Fragment, {
|
|
3115
|
-
children: [
|
|
3116
|
-
message.images && message.images.length > 0 && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3117
|
-
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3118
|
-
children: [
|
|
3119
|
-
/* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3120
|
-
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3121
|
-
children: [
|
|
3122
|
-
/* @__PURE__ */ jsx_runtime35.jsx(import_lucide_react19.Image, {
|
|
3123
|
-
className: "h-3.5 w-3.5"
|
|
3124
|
-
}),
|
|
3125
|
-
"Images (",
|
|
3126
|
-
message.images.length,
|
|
3127
|
-
")"
|
|
3128
|
-
]
|
|
3129
|
-
}),
|
|
3130
|
-
/* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
3131
|
-
className: "grid grid-cols-2 gap-2",
|
|
3132
|
-
children: message.images.map((img, idx) => /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3133
|
-
className: "space-y-1",
|
|
3134
|
-
children: [
|
|
3135
|
-
showImageLightbox ? /* @__PURE__ */ jsx_runtime35.jsx("button", {
|
|
3136
|
-
type: "button",
|
|
3137
|
-
onClick: () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx),
|
|
3138
|
-
className: "group relative w-full overflow-hidden rounded-lg border border-border cursor-pointer hover:border-primary/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring transition-colors",
|
|
3139
|
-
children: /* @__PURE__ */ jsx_runtime35.jsx("img", {
|
|
3140
|
-
src: img.url,
|
|
3141
|
-
alt: img.revised_prompt || "Generated image",
|
|
3142
|
-
className: "w-full rounded-lg"
|
|
3143
|
-
})
|
|
3144
|
-
}) : /* @__PURE__ */ jsx_runtime35.jsx("img", {
|
|
3145
|
-
src: img.url,
|
|
3146
|
-
alt: img.revised_prompt || "Generated image",
|
|
3147
|
-
className: "w-full rounded-lg border border-border"
|
|
3148
|
-
}),
|
|
3149
|
-
img.revised_prompt && /* @__PURE__ */ jsx_runtime35.jsx("p", {
|
|
3150
|
-
className: "text-[11px] text-muted-foreground italic px-0.5",
|
|
3151
|
-
children: img.revised_prompt
|
|
3152
|
-
})
|
|
3153
|
-
]
|
|
3154
|
-
}, idx))
|
|
3155
|
-
})
|
|
3156
|
-
]
|
|
3157
|
-
}),
|
|
3158
|
-
message.videos && message.videos.length > 0 && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3159
|
-
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3160
|
-
children: [
|
|
3161
|
-
/* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3162
|
-
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3163
|
-
children: [
|
|
3164
|
-
/* @__PURE__ */ jsx_runtime35.jsx(import_lucide_react19.Video, {
|
|
3165
|
-
className: "h-3.5 w-3.5"
|
|
3166
|
-
}),
|
|
3167
|
-
"Videos (",
|
|
3168
|
-
message.videos.length,
|
|
3169
|
-
")"
|
|
3170
|
-
]
|
|
3171
|
-
}),
|
|
3172
|
-
/* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
3173
|
-
className: "space-y-2",
|
|
3174
|
-
children: message.videos.map((video, idx) => /* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
3175
|
-
children: video.url ? /* @__PURE__ */ jsx_runtime35.jsx("video", {
|
|
3176
|
-
src: video.url,
|
|
3177
|
-
controls: true,
|
|
3178
|
-
className: "w-full rounded-lg border border-border"
|
|
3179
|
-
}) : /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3180
|
-
className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
|
|
3181
|
-
children: [
|
|
3182
|
-
"Video ID: ",
|
|
3183
|
-
video.id,
|
|
3184
|
-
" (ETA: ",
|
|
3185
|
-
video.eta,
|
|
3186
|
-
"s)"
|
|
3187
|
-
]
|
|
3188
|
-
})
|
|
3189
|
-
}, idx))
|
|
3190
|
-
})
|
|
3191
|
-
]
|
|
3192
|
-
}),
|
|
3193
|
-
message.audio && message.audio.length > 0 && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3194
|
-
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3195
|
-
children: [
|
|
3196
|
-
/* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3197
|
-
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3198
|
-
children: [
|
|
3199
|
-
/* @__PURE__ */ jsx_runtime35.jsx(import_lucide_react19.Music, {
|
|
3200
|
-
className: "h-3.5 w-3.5"
|
|
3201
|
-
}),
|
|
3202
|
-
"Audio (",
|
|
3203
|
-
message.audio.length,
|
|
3204
|
-
")"
|
|
3205
|
-
]
|
|
3206
|
-
}),
|
|
3207
|
-
/* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
3208
|
-
className: "space-y-2",
|
|
3209
|
-
children: message.audio.map((audio, idx) => /* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
3210
|
-
children: audio.url ? /* @__PURE__ */ jsx_runtime35.jsx("audio", {
|
|
3211
|
-
src: audio.url,
|
|
3212
|
-
controls: true,
|
|
3213
|
-
className: "w-full"
|
|
3214
|
-
}) : audio.base64_audio ? /* @__PURE__ */ jsx_runtime35.jsx("audio", {
|
|
3215
|
-
src: `data:${audio.mime_type || "audio/wav"};base64,${audio.base64_audio}`,
|
|
3216
|
-
controls: true,
|
|
3217
|
-
className: "w-full"
|
|
3218
|
-
}) : /* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
3219
|
-
className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
|
|
3220
|
-
children: "Audio data unavailable"
|
|
3221
|
-
})
|
|
3222
|
-
}, idx))
|
|
3223
|
-
})
|
|
3224
|
-
]
|
|
3225
|
-
}),
|
|
3226
|
-
message.files && message.files.length > 0 && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3227
|
-
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3228
|
-
children: [
|
|
3229
|
-
/* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3230
|
-
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3231
|
-
children: [
|
|
3232
|
-
/* @__PURE__ */ jsx_runtime35.jsx(import_lucide_react19.Paperclip, {
|
|
3233
|
-
className: "h-3.5 w-3.5"
|
|
3234
|
-
}),
|
|
3235
|
-
"Files (",
|
|
3236
|
-
message.files.length,
|
|
3237
|
-
")"
|
|
3238
|
-
]
|
|
3239
|
-
}),
|
|
3240
|
-
/* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
3241
|
-
className: "flex flex-wrap gap-2",
|
|
3242
|
-
children: message.files.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx_runtime35.jsx(FilePreviewCard, {
|
|
3243
|
-
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
3244
|
-
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
3245
|
-
}, idx) : /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3246
|
-
className: "flex items-center gap-2 rounded-lg border border-border px-3 py-2 text-xs bg-muted/30 hover:bg-muted/50 transition-colors",
|
|
3247
|
-
children: [
|
|
3248
|
-
/* @__PURE__ */ jsx_runtime35.jsx(import_lucide_react19.FileIcon, {
|
|
3249
|
-
className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
|
|
3250
|
-
}),
|
|
3251
|
-
/* @__PURE__ */ jsx_runtime35.jsx("span", {
|
|
3252
|
-
className: "truncate max-w-[180px]",
|
|
3253
|
-
children: file.name
|
|
3254
|
-
}),
|
|
3255
|
-
file.size && /* @__PURE__ */ jsx_runtime35.jsxs("span", {
|
|
3256
|
-
className: "text-muted-foreground/70",
|
|
3257
|
-
children: [
|
|
3258
|
-
"(",
|
|
3259
|
-
(file.size / 1024).toFixed(1),
|
|
3260
|
-
"KB)"
|
|
3261
|
-
]
|
|
3262
|
-
}),
|
|
3263
|
-
file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsx_runtime35.jsx("a", {
|
|
3264
|
-
href: file.url,
|
|
3265
|
-
target: "_blank",
|
|
3266
|
-
rel: "noopener noreferrer",
|
|
3267
|
-
className: "text-primary hover:underline font-medium",
|
|
3268
|
-
children: "View"
|
|
3269
|
-
})
|
|
3270
|
-
]
|
|
3271
|
-
}, idx))
|
|
3272
|
-
})
|
|
3273
|
-
]
|
|
3274
|
-
}),
|
|
3275
|
-
message.response_audio && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3276
|
-
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3277
|
-
children: [
|
|
3278
|
-
/* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3279
|
-
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3280
|
-
children: [
|
|
3281
|
-
/* @__PURE__ */ jsx_runtime35.jsx(import_lucide_react19.Music, {
|
|
3282
|
-
className: "h-3.5 w-3.5"
|
|
3283
|
-
}),
|
|
3284
|
-
"Response Audio"
|
|
3285
|
-
]
|
|
3286
|
-
}),
|
|
3287
|
-
message.response_audio.transcript && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3288
|
-
className: "text-xs italic bg-muted/50 border border-border p-2.5 rounded-lg text-muted-foreground",
|
|
3289
|
-
children: [
|
|
3290
|
-
'"',
|
|
3291
|
-
message.response_audio.transcript,
|
|
3292
|
-
'"'
|
|
3293
|
-
]
|
|
3294
|
-
}),
|
|
3295
|
-
message.response_audio.content && /* @__PURE__ */ jsx_runtime35.jsx("audio", {
|
|
3296
|
-
src: `data:audio/wav;base64,${message.response_audio.content}`,
|
|
3297
|
-
controls: true,
|
|
3298
|
-
className: "w-full"
|
|
3299
|
-
})
|
|
3300
|
-
]
|
|
3301
|
-
})
|
|
3302
|
-
]
|
|
3303
|
-
});
|
|
3304
|
-
})(),
|
|
3305
|
-
showToolCalls && message.tool_calls && message.tool_calls.length > 0 && /* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
3306
|
-
className: cn("space-y-2 pt-1", classNames?.assistant?.toolCalls),
|
|
3307
|
-
children: message.tool_calls.map((tool, idx) => renderToolCall ? renderToolCall(tool, idx) : /* @__PURE__ */ jsx_runtime35.jsxs(Tool, {
|
|
3308
|
-
defaultOpen: idx === 0,
|
|
3309
|
-
children: [
|
|
3310
|
-
/* @__PURE__ */ jsx_runtime35.jsx(ToolHeader, {
|
|
3311
|
-
title: tool.tool_name,
|
|
3312
|
-
type: "tool-use",
|
|
3313
|
-
state: getToolState(tool)
|
|
3314
|
-
}),
|
|
3315
|
-
/* @__PURE__ */ jsx_runtime35.jsxs(ToolContent, {
|
|
3316
|
-
children: [
|
|
3317
|
-
/* @__PURE__ */ jsx_runtime35.jsx(ToolInput, {
|
|
3318
|
-
input: tool.tool_args
|
|
3319
|
-
}),
|
|
3320
|
-
tool.content && /* @__PURE__ */ jsx_runtime35.jsx(ToolOutput, {
|
|
3321
|
-
output: tool.content,
|
|
3322
|
-
errorText: tool.tool_call_error ? "Tool execution failed" : undefined
|
|
3323
|
-
})
|
|
3324
|
-
]
|
|
3325
|
-
})
|
|
3326
|
-
]
|
|
3327
|
-
}, tool.tool_call_id || idx))
|
|
3328
|
-
}),
|
|
3329
|
-
showReferences && message.extra_data?.references && message.extra_data.references.length > 0 && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3330
|
-
className: cn("space-y-2 pt-1", classNames?.assistant?.references),
|
|
3331
|
-
children: [
|
|
3332
|
-
/* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3333
|
-
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3334
|
-
children: [
|
|
3335
|
-
/* @__PURE__ */ jsx_runtime35.jsx(import_lucide_react19.FileText, {
|
|
3336
|
-
className: "h-3.5 w-3.5"
|
|
3337
|
-
}),
|
|
3338
|
-
"References (",
|
|
3339
|
-
message.extra_data.references.length,
|
|
3340
|
-
")"
|
|
3341
|
-
]
|
|
3342
|
-
}),
|
|
3343
|
-
/* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
3344
|
-
className: "space-y-2",
|
|
3345
|
-
children: message.extra_data.references.map((refData, idx) => /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3346
|
-
className: "text-xs space-y-1.5",
|
|
3347
|
-
children: [
|
|
3348
|
-
refData.query && /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3349
|
-
className: "font-medium text-foreground",
|
|
3350
|
-
children: [
|
|
3351
|
-
"Query: ",
|
|
3352
|
-
refData.query
|
|
3353
|
-
]
|
|
3354
|
-
}),
|
|
3355
|
-
refData.references.map((ref, refIdx) => /* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3356
|
-
className: "bg-muted/50 border border-border p-2.5 rounded-lg",
|
|
3357
|
-
children: [
|
|
3358
|
-
/* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3359
|
-
className: "italic text-muted-foreground mb-1",
|
|
3360
|
-
children: [
|
|
3361
|
-
'"',
|
|
3362
|
-
ref.content,
|
|
3363
|
-
'"'
|
|
3364
|
-
]
|
|
3365
|
-
}),
|
|
3366
|
-
/* @__PURE__ */ jsx_runtime35.jsxs("div", {
|
|
3367
|
-
className: "text-muted-foreground/70",
|
|
3368
|
-
children: [
|
|
3369
|
-
"Source: ",
|
|
3370
|
-
ref.name,
|
|
3371
|
-
" (chunk ",
|
|
3372
|
-
ref.meta_data.chunk,
|
|
3373
|
-
"/",
|
|
3374
|
-
ref.meta_data.chunk_size,
|
|
3375
|
-
")"
|
|
3376
|
-
]
|
|
3377
|
-
})
|
|
3378
|
-
]
|
|
3379
|
-
}, refIdx))
|
|
3380
|
-
]
|
|
3381
|
-
}, idx))
|
|
3382
|
-
})
|
|
3383
|
-
]
|
|
3569
|
+
/* @__PURE__ */ jsx_runtime42.jsx("span", {
|
|
3570
|
+
className: "truncate max-w-[150px]",
|
|
3571
|
+
children: file.name
|
|
3384
3572
|
})
|
|
3385
3573
|
]
|
|
3574
|
+
}, `file-${idx}`))
|
|
3575
|
+
]
|
|
3576
|
+
}),
|
|
3577
|
+
message.content && /* @__PURE__ */ jsx_runtime42.jsx("div", {
|
|
3578
|
+
className: cn("rounded-2xl rounded-br-md px-4 py-2.5", classNames?.user?.bubble ?? "bg-primary text-primary-foreground", hasError && "opacity-70"),
|
|
3579
|
+
children: /* @__PURE__ */ jsx_runtime42.jsx("p", {
|
|
3580
|
+
className: "text-sm whitespace-pre-wrap",
|
|
3581
|
+
children: message.content
|
|
3582
|
+
})
|
|
3583
|
+
}),
|
|
3584
|
+
(showTimestamp || actions?.user) && /* @__PURE__ */ jsx_runtime42.jsxs("div", {
|
|
3585
|
+
className: "flex items-center justify-end gap-1.5 px-1",
|
|
3586
|
+
children: [
|
|
3587
|
+
actions?.user && /* @__PURE__ */ jsx_runtime42.jsx("div", {
|
|
3588
|
+
className: "flex items-center gap-1",
|
|
3589
|
+
children: actions.user(message)
|
|
3386
3590
|
}),
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
const useHover = visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage;
|
|
3395
|
-
return /* @__PURE__ */ jsx_runtime35.jsx("div", {
|
|
3396
|
-
className: cn("flex items-center gap-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100", classNames?.assistant?.actions),
|
|
3397
|
-
children: actions.assistant(message)
|
|
3398
|
-
});
|
|
3399
|
-
})(),
|
|
3400
|
-
hasError && /* @__PURE__ */ jsx_runtime35.jsxs("span", {
|
|
3401
|
-
className: "flex items-center gap-1 text-[11px] text-destructive",
|
|
3402
|
-
children: [
|
|
3403
|
-
/* @__PURE__ */ jsx_runtime35.jsx(import_lucide_react19.AlertCircle, {
|
|
3404
|
-
className: "h-3 w-3"
|
|
3405
|
-
}),
|
|
3406
|
-
"Error"
|
|
3407
|
-
]
|
|
3408
|
-
}),
|
|
3409
|
-
showTimestamp && /* @__PURE__ */ jsx_runtime35.jsx(SmartTimestamp, {
|
|
3410
|
-
date: new Date(message.created_at * 1000),
|
|
3411
|
-
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
3412
|
-
className: "text-[11px] text-muted-foreground"
|
|
3413
|
-
})
|
|
3414
|
-
]
|
|
3591
|
+
/* @__PURE__ */ jsx_runtime42.jsx(SmartTimestamp, {
|
|
3592
|
+
date: new Date(message.created_at * 1000),
|
|
3593
|
+
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
3594
|
+
className: "text-[11px] text-muted-foreground"
|
|
3595
|
+
}),
|
|
3596
|
+
hasError && /* @__PURE__ */ jsx_runtime42.jsx(import_lucide_react23.AlertCircle, {
|
|
3597
|
+
className: "h-3 w-3 text-destructive"
|
|
3415
3598
|
})
|
|
3416
3599
|
]
|
|
3417
3600
|
})
|
|
3418
3601
|
]
|
|
3419
|
-
})
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3602
|
+
})
|
|
3603
|
+
]
|
|
3604
|
+
});
|
|
3605
|
+
}
|
|
3606
|
+
|
|
3607
|
+
// src/ui/composed/AgnoMessageItem.tsx
|
|
3608
|
+
var jsx_runtime43 = require("react/jsx-runtime");
|
|
3609
|
+
function AgnoMessageItem({
|
|
3610
|
+
message,
|
|
3611
|
+
className,
|
|
3612
|
+
classNames,
|
|
3613
|
+
avatars,
|
|
3614
|
+
actions,
|
|
3615
|
+
isLastAssistantMessage = false,
|
|
3616
|
+
showReasoning = true,
|
|
3617
|
+
showReferences = true,
|
|
3618
|
+
showTimestamp = true,
|
|
3619
|
+
showFilePreview = true,
|
|
3620
|
+
showImageLightbox = true,
|
|
3621
|
+
formatTimestamp,
|
|
3622
|
+
renderTool
|
|
3623
|
+
}) {
|
|
3624
|
+
return /* @__PURE__ */ jsx_runtime43.jsxs(AgnoMessage, {
|
|
3625
|
+
message,
|
|
3626
|
+
className,
|
|
3627
|
+
classNames,
|
|
3628
|
+
avatars,
|
|
3629
|
+
actions,
|
|
3630
|
+
isLastAssistantMessage,
|
|
3631
|
+
showTimestamp,
|
|
3632
|
+
showFilePreview,
|
|
3633
|
+
showImageLightbox,
|
|
3634
|
+
formatTimestamp,
|
|
3635
|
+
renderTool,
|
|
3636
|
+
children: [
|
|
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, {
|
|
3643
|
+
showTimestamp
|
|
3436
3644
|
})
|
|
3437
3645
|
]
|
|
3438
3646
|
});
|
|
3439
3647
|
}
|
|
3440
3648
|
// src/ui/composed/AgnoChatInput.tsx
|
|
3441
|
-
var
|
|
3442
|
-
var
|
|
3649
|
+
var import_lucide_react24 = require("lucide-react");
|
|
3650
|
+
var jsx_runtime44 = require("react/jsx-runtime");
|
|
3443
3651
|
var DEFAULT_ACCEPTED_FILE_TYPES = "image/*,audio/*,.pdf,.doc,.docx,.txt,.csv,.xlsx,.xls,.ppt,.pptx,.md,.json,.xml";
|
|
3444
3652
|
function normalizeAudio(audio) {
|
|
3445
3653
|
if (audio === true)
|
|
@@ -3459,14 +3667,14 @@ function dataUrlToBlob(dataUrl) {
|
|
|
3459
3667
|
return new Blob([buf], { type: mime });
|
|
3460
3668
|
}
|
|
3461
3669
|
function CancelButton({ onCancel }) {
|
|
3462
|
-
return /* @__PURE__ */
|
|
3670
|
+
return /* @__PURE__ */ jsx_runtime44.jsx(Button, {
|
|
3463
3671
|
type: "button",
|
|
3464
3672
|
variant: "destructive",
|
|
3465
3673
|
size: "icon",
|
|
3466
3674
|
className: "h-8 w-8 rounded-lg",
|
|
3467
3675
|
onClick: onCancel,
|
|
3468
3676
|
"aria-label": "Stop",
|
|
3469
|
-
children: /* @__PURE__ */
|
|
3677
|
+
children: /* @__PURE__ */ jsx_runtime44.jsx(import_lucide_react24.CircleStop, {
|
|
3470
3678
|
className: "size-4"
|
|
3471
3679
|
})
|
|
3472
3680
|
});
|
|
@@ -3474,7 +3682,7 @@ function CancelButton({ onCancel }) {
|
|
|
3474
3682
|
function SubmitButton({ disabled, status }) {
|
|
3475
3683
|
const { textInput } = usePromptInputController();
|
|
3476
3684
|
const hasText = textInput.value.trim().length > 0;
|
|
3477
|
-
return /* @__PURE__ */
|
|
3685
|
+
return /* @__PURE__ */ jsx_runtime44.jsx(PromptInputSubmit, {
|
|
3478
3686
|
disabled: disabled || !hasText,
|
|
3479
3687
|
status
|
|
3480
3688
|
});
|
|
@@ -3483,9 +3691,9 @@ function AttachmentHeader() {
|
|
|
3483
3691
|
const { files } = usePromptInputAttachments();
|
|
3484
3692
|
if (files.length === 0)
|
|
3485
3693
|
return null;
|
|
3486
|
-
return /* @__PURE__ */
|
|
3487
|
-
children: /* @__PURE__ */
|
|
3488
|
-
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, {
|
|
3489
3697
|
data: attachment
|
|
3490
3698
|
})
|
|
3491
3699
|
})
|
|
@@ -3500,7 +3708,7 @@ function TranscribeAudioRecorder({
|
|
|
3500
3708
|
labels
|
|
3501
3709
|
}) {
|
|
3502
3710
|
const { textInput } = usePromptInputController();
|
|
3503
|
-
return /* @__PURE__ */
|
|
3711
|
+
return /* @__PURE__ */ jsx_runtime44.jsx(AudioRecorder, {
|
|
3504
3712
|
mode: "transcribe",
|
|
3505
3713
|
transcriptionEndpoint: endpoint,
|
|
3506
3714
|
transcriptionHeaders: headers,
|
|
@@ -3564,8 +3772,8 @@ function AgnoChatInput({
|
|
|
3564
3772
|
};
|
|
3565
3773
|
const computedStatus = status ?? (disabled ? "submitted" : undefined);
|
|
3566
3774
|
const showCancelButton = allowCancelRun && isStreaming && onCancel;
|
|
3567
|
-
return /* @__PURE__ */
|
|
3568
|
-
children: /* @__PURE__ */
|
|
3775
|
+
return /* @__PURE__ */ jsx_runtime44.jsx(PromptInputProvider, {
|
|
3776
|
+
children: /* @__PURE__ */ jsx_runtime44.jsxs(PromptInput, {
|
|
3569
3777
|
onSubmit: handleSubmit,
|
|
3570
3778
|
accept: fileUpload?.accept ?? DEFAULT_ACCEPTED_FILE_TYPES,
|
|
3571
3779
|
multiple: fileUpload?.multiple ?? true,
|
|
@@ -3575,35 +3783,35 @@ function AgnoChatInput({
|
|
|
3575
3783
|
dragListenerTarget: dropZoneContainerRef,
|
|
3576
3784
|
className: cn("w-full", className),
|
|
3577
3785
|
children: [
|
|
3578
|
-
/* @__PURE__ */
|
|
3579
|
-
/* @__PURE__ */
|
|
3580
|
-
children: /* @__PURE__ */
|
|
3786
|
+
/* @__PURE__ */ jsx_runtime44.jsx(AttachmentHeader, {}),
|
|
3787
|
+
/* @__PURE__ */ jsx_runtime44.jsx(PromptInputBody, {
|
|
3788
|
+
children: /* @__PURE__ */ jsx_runtime44.jsx(PromptInputTextarea, {
|
|
3581
3789
|
placeholder: placeholder || "Type your message... (Enter to send, Shift+Enter for new line)",
|
|
3582
3790
|
disabled
|
|
3583
3791
|
})
|
|
3584
3792
|
}),
|
|
3585
|
-
/* @__PURE__ */
|
|
3793
|
+
/* @__PURE__ */ jsx_runtime44.jsxs(PromptInputFooter, {
|
|
3586
3794
|
children: [
|
|
3587
|
-
/* @__PURE__ */
|
|
3795
|
+
/* @__PURE__ */ jsx_runtime44.jsxs(PromptInputTools, {
|
|
3588
3796
|
children: [
|
|
3589
|
-
showAttachments && /* @__PURE__ */
|
|
3797
|
+
showAttachments && /* @__PURE__ */ jsx_runtime44.jsxs(PromptInputActionMenu, {
|
|
3590
3798
|
children: [
|
|
3591
|
-
/* @__PURE__ */
|
|
3592
|
-
/* @__PURE__ */
|
|
3593
|
-
children: /* @__PURE__ */
|
|
3799
|
+
/* @__PURE__ */ jsx_runtime44.jsx(PromptInputActionMenuTrigger, {}),
|
|
3800
|
+
/* @__PURE__ */ jsx_runtime44.jsx(PromptInputActionMenuContent, {
|
|
3801
|
+
children: /* @__PURE__ */ jsx_runtime44.jsx(PromptInputActionAddAttachments, {
|
|
3594
3802
|
label: "Add files"
|
|
3595
3803
|
})
|
|
3596
3804
|
})
|
|
3597
3805
|
]
|
|
3598
3806
|
}),
|
|
3599
|
-
audioEnabled && (audioMode === "transcribe" && resolvedAudio?.endpoint ? /* @__PURE__ */
|
|
3807
|
+
audioEnabled && (audioMode === "transcribe" && resolvedAudio?.endpoint ? /* @__PURE__ */ jsx_runtime44.jsx(TranscribeAudioRecorder, {
|
|
3600
3808
|
endpoint: resolvedAudio.endpoint,
|
|
3601
3809
|
headers: resolvedAudio.headers,
|
|
3602
3810
|
disabled,
|
|
3603
3811
|
parseResponse: resolvedAudio.parseResponse,
|
|
3604
3812
|
onRequestPermission: resolvedAudio.requestPermission,
|
|
3605
3813
|
labels: resolvedAudio.labels
|
|
3606
|
-
}) : /* @__PURE__ */
|
|
3814
|
+
}) : /* @__PURE__ */ jsx_runtime44.jsx(AudioRecorder, {
|
|
3607
3815
|
onRecordingComplete: handleAudioRecording,
|
|
3608
3816
|
disabled,
|
|
3609
3817
|
onRequestPermission: resolvedAudio?.requestPermission,
|
|
@@ -3612,15 +3820,15 @@ function AgnoChatInput({
|
|
|
3612
3820
|
extraTools
|
|
3613
3821
|
]
|
|
3614
3822
|
}),
|
|
3615
|
-
showCancelButton ? /* @__PURE__ */
|
|
3823
|
+
showCancelButton ? /* @__PURE__ */ jsx_runtime44.jsx(CancelButton, {
|
|
3616
3824
|
onCancel
|
|
3617
|
-
}) : /* @__PURE__ */
|
|
3825
|
+
}) : /* @__PURE__ */ jsx_runtime44.jsx(SubmitButton, {
|
|
3618
3826
|
disabled,
|
|
3619
3827
|
status: computedStatus
|
|
3620
3828
|
})
|
|
3621
3829
|
]
|
|
3622
3830
|
}),
|
|
3623
|
-
showAttachments && /* @__PURE__ */
|
|
3831
|
+
showAttachments && /* @__PURE__ */ jsx_runtime44.jsx(PromptInputDropZone, {
|
|
3624
3832
|
...dropZoneProps,
|
|
3625
3833
|
container: dropZoneContainerRef
|
|
3626
3834
|
})
|
|
@@ -3628,39 +3836,505 @@ function AgnoChatInput({
|
|
|
3628
3836
|
})
|
|
3629
3837
|
});
|
|
3630
3838
|
}
|
|
3631
|
-
// src/ui/composed/agno-chat/
|
|
3632
|
-
|
|
3633
|
-
|
|
3839
|
+
// src/ui/composed/agno-chat/render-tool.ts
|
|
3840
|
+
function byToolName(map, fallback) {
|
|
3841
|
+
return (tool, args) => {
|
|
3842
|
+
if (!Object.prototype.hasOwnProperty.call(map, tool.tool_name)) {
|
|
3843
|
+
return fallback ? fallback(tool, args) : args.defaultRender();
|
|
3844
|
+
}
|
|
3845
|
+
const entry = map[tool.tool_name];
|
|
3846
|
+
if (entry === false)
|
|
3847
|
+
return null;
|
|
3848
|
+
return entry(tool, args);
|
|
3849
|
+
};
|
|
3850
|
+
}
|
|
3851
|
+
// src/ui/composed/generative-components/charts.tsx
|
|
3852
|
+
var import_recharts = require("recharts");
|
|
3634
3853
|
|
|
3635
|
-
// src/ui/
|
|
3636
|
-
var
|
|
3637
|
-
var
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
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 />");
|
|
3642
3864
|
}
|
|
3643
|
-
return
|
|
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];
|
|
3644
4056
|
}
|
|
3645
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
|
+
}
|
|
3646
4310
|
// src/ui/composed/agno-chat/agno-chat.tsx
|
|
3647
|
-
var
|
|
4311
|
+
var import_react17 = require("react");
|
|
4312
|
+
var import_agno_react = require("@rodrigocoliveira/agno-react");
|
|
4313
|
+
var jsx_runtime48 = require("react/jsx-runtime");
|
|
4314
|
+
function resolveDebug(debug) {
|
|
4315
|
+
if (typeof debug === "boolean")
|
|
4316
|
+
return debug;
|
|
4317
|
+
return typeof process !== "undefined" && process.env?.NODE_ENV === "development";
|
|
4318
|
+
}
|
|
3648
4319
|
function AgnoChatRoot({
|
|
3649
4320
|
children,
|
|
3650
4321
|
toolHandlers = {},
|
|
3651
4322
|
autoExecuteTools = true,
|
|
3652
|
-
|
|
4323
|
+
renderTool,
|
|
4324
|
+
debug,
|
|
4325
|
+
skipToolsOnSessionLoad,
|
|
3653
4326
|
className,
|
|
3654
4327
|
...divProps
|
|
3655
4328
|
}) {
|
|
3656
|
-
const chat =
|
|
3657
|
-
const toolExec =
|
|
3658
|
-
|
|
4329
|
+
const chat = import_agno_react.useAgnoChat();
|
|
4330
|
+
const toolExec = import_agno_react.useAgnoToolExecution(toolHandlers, autoExecuteTools, {
|
|
4331
|
+
skipToolsOnSessionLoad
|
|
3659
4332
|
});
|
|
3660
|
-
const containerRef =
|
|
3661
|
-
const
|
|
4333
|
+
const containerRef = import_react17.useRef(null);
|
|
4334
|
+
const isDebug = resolveDebug(debug);
|
|
4335
|
+
const sendRef = import_react17.useRef(chat.sendMessage);
|
|
3662
4336
|
sendRef.current = chat.sendMessage;
|
|
3663
|
-
const handleSend =
|
|
4337
|
+
const handleSend = import_react17.useCallback(async (message) => {
|
|
3664
4338
|
try {
|
|
3665
4339
|
await sendRef.current(message);
|
|
3666
4340
|
} catch {}
|
|
@@ -3686,7 +4360,7 @@ function AgnoChatRoot({
|
|
|
3686
4360
|
continueWithResults,
|
|
3687
4361
|
executionError
|
|
3688
4362
|
} = toolExec;
|
|
3689
|
-
const contextValue =
|
|
4363
|
+
const contextValue = import_react17.useMemo(() => ({
|
|
3690
4364
|
messages,
|
|
3691
4365
|
sendMessage,
|
|
3692
4366
|
clearMessages,
|
|
@@ -3707,7 +4381,8 @@ function AgnoChatRoot({
|
|
|
3707
4381
|
handleSend,
|
|
3708
4382
|
inputDisabled: isStreaming || isPaused,
|
|
3709
4383
|
dropZoneContainerRef: containerRef,
|
|
3710
|
-
|
|
4384
|
+
renderTool,
|
|
4385
|
+
isDebug
|
|
3711
4386
|
}), [
|
|
3712
4387
|
messages,
|
|
3713
4388
|
sendMessage,
|
|
@@ -3727,11 +4402,12 @@ function AgnoChatRoot({
|
|
|
3727
4402
|
continueWithResults,
|
|
3728
4403
|
executionError,
|
|
3729
4404
|
handleSend,
|
|
3730
|
-
|
|
4405
|
+
renderTool,
|
|
4406
|
+
isDebug
|
|
3731
4407
|
]);
|
|
3732
|
-
return /* @__PURE__ */
|
|
4408
|
+
return /* @__PURE__ */ jsx_runtime48.jsx(AgnoChatContext.Provider, {
|
|
3733
4409
|
value: contextValue,
|
|
3734
|
-
children: /* @__PURE__ */
|
|
4410
|
+
children: /* @__PURE__ */ jsx_runtime48.jsx("div", {
|
|
3735
4411
|
ref: containerRef,
|
|
3736
4412
|
className: cn("relative h-full flex flex-col", className),
|
|
3737
4413
|
...divProps,
|
|
@@ -3741,25 +4417,25 @@ function AgnoChatRoot({
|
|
|
3741
4417
|
}
|
|
3742
4418
|
|
|
3743
4419
|
// src/ui/composed/agno-chat/messages.tsx
|
|
3744
|
-
var
|
|
4420
|
+
var import_react18 = require("react");
|
|
3745
4421
|
|
|
3746
4422
|
// src/ui/composed/agno-chat/suggested-prompts.tsx
|
|
3747
|
-
var
|
|
4423
|
+
var jsx_runtime49 = require("react/jsx-runtime");
|
|
3748
4424
|
function AgnoChatSuggestedPrompts({ className, prompts }) {
|
|
3749
4425
|
const { handleSend } = useAgnoChatContext();
|
|
3750
4426
|
if (prompts.length === 0)
|
|
3751
4427
|
return null;
|
|
3752
|
-
return /* @__PURE__ */
|
|
4428
|
+
return /* @__PURE__ */ jsx_runtime49.jsx("div", {
|
|
3753
4429
|
className: cn("grid grid-cols-2 gap-2 w-full max-w-md", className),
|
|
3754
|
-
children: prompts.map((prompt, idx) => /* @__PURE__ */
|
|
4430
|
+
children: prompts.map((prompt, idx) => /* @__PURE__ */ jsx_runtime49.jsxs("button", {
|
|
3755
4431
|
onClick: () => handleSend(prompt.text),
|
|
3756
4432
|
className: "flex items-center gap-2 px-3 py-2.5 rounded-xl border border-border bg-card hover:bg-accent/50 hover:border-primary/20 transition-all duration-200 text-left text-sm group",
|
|
3757
4433
|
children: [
|
|
3758
|
-
prompt.icon && /* @__PURE__ */
|
|
4434
|
+
prompt.icon && /* @__PURE__ */ jsx_runtime49.jsx("span", {
|
|
3759
4435
|
className: "text-muted-foreground group-hover:text-primary transition-colors",
|
|
3760
4436
|
children: prompt.icon
|
|
3761
4437
|
}),
|
|
3762
|
-
/* @__PURE__ */
|
|
4438
|
+
/* @__PURE__ */ jsx_runtime49.jsx("span", {
|
|
3763
4439
|
className: "text-muted-foreground group-hover:text-foreground transition-colors text-xs leading-snug",
|
|
3764
4440
|
children: prompt.text
|
|
3765
4441
|
})
|
|
@@ -3769,12 +4445,12 @@ function AgnoChatSuggestedPrompts({ className, prompts }) {
|
|
|
3769
4445
|
}
|
|
3770
4446
|
|
|
3771
4447
|
// src/ui/composed/agno-chat/messages.tsx
|
|
3772
|
-
var
|
|
3773
|
-
var
|
|
4448
|
+
var import_lucide_react25 = require("lucide-react");
|
|
4449
|
+
var jsx_runtime50 = require("react/jsx-runtime");
|
|
3774
4450
|
function ScrollOnNewUserMessage({ messageCount }) {
|
|
3775
4451
|
const { scrollToBottom } = import_use_stick_to_bottom2.useStickToBottomContext();
|
|
3776
|
-
const prevCount =
|
|
3777
|
-
|
|
4452
|
+
const prevCount = import_react18.useRef(messageCount);
|
|
4453
|
+
import_react18.useEffect(() => {
|
|
3778
4454
|
if (messageCount > prevCount.current) {
|
|
3779
4455
|
scrollToBottom("smooth");
|
|
3780
4456
|
}
|
|
@@ -3794,13 +4470,8 @@ function AgnoChatMessages({
|
|
|
3794
4470
|
showReasoning,
|
|
3795
4471
|
showReferences,
|
|
3796
4472
|
showTimestamp,
|
|
3797
|
-
showGenerativeUI,
|
|
3798
|
-
showToolCalls,
|
|
3799
4473
|
showFilePreview,
|
|
3800
4474
|
showImageLightbox,
|
|
3801
|
-
renderToolCall,
|
|
3802
|
-
renderContent,
|
|
3803
|
-
renderMedia,
|
|
3804
4475
|
formatTimestamp,
|
|
3805
4476
|
messageClassNames,
|
|
3806
4477
|
emptyState,
|
|
@@ -3808,24 +4479,23 @@ function AgnoChatMessages({
|
|
|
3808
4479
|
children,
|
|
3809
4480
|
showThinkingIndicator = true,
|
|
3810
4481
|
renderThinkingIndicator,
|
|
3811
|
-
|
|
4482
|
+
renderTool: propRenderTool,
|
|
3812
4483
|
scrollBehavior,
|
|
3813
4484
|
scrollToBottomButton
|
|
3814
4485
|
}) {
|
|
3815
|
-
const { messages, isStreaming
|
|
3816
|
-
const toolResultRenderers = propToolResultRenderers ?? contextToolResultRenderers;
|
|
4486
|
+
const { messages, isStreaming } = useAgnoChatContext();
|
|
3817
4487
|
const lastMessage = messages[messages.length - 1];
|
|
3818
4488
|
const isThinking = showThinkingIndicator && isStreaming && (!lastMessage || lastMessage.role !== "user") && !lastMessage?.content;
|
|
3819
4489
|
const resolvedScrollButton = (() => {
|
|
3820
4490
|
if (scrollToBottomButton === false)
|
|
3821
4491
|
return null;
|
|
3822
4492
|
if (scrollToBottomButton === undefined || scrollToBottomButton === true) {
|
|
3823
|
-
return /* @__PURE__ */
|
|
4493
|
+
return /* @__PURE__ */ jsx_runtime50.jsx(ConversationScrollButton, {});
|
|
3824
4494
|
}
|
|
3825
|
-
if (
|
|
4495
|
+
if (import_react18.isValidElement(scrollToBottomButton))
|
|
3826
4496
|
return scrollToBottomButton;
|
|
3827
4497
|
if (typeof scrollToBottomButton === "object" && scrollToBottomButton !== null && "className" in scrollToBottomButton) {
|
|
3828
|
-
return /* @__PURE__ */
|
|
4498
|
+
return /* @__PURE__ */ jsx_runtime50.jsx(ConversationScrollButton, {
|
|
3829
4499
|
className: scrollToBottomButton.className
|
|
3830
4500
|
});
|
|
3831
4501
|
}
|
|
@@ -3842,71 +4512,66 @@ function AgnoChatMessages({
|
|
|
3842
4512
|
...showReasoning !== undefined && { showReasoning },
|
|
3843
4513
|
...showReferences !== undefined && { showReferences },
|
|
3844
4514
|
...showTimestamp !== undefined && { showTimestamp },
|
|
3845
|
-
...showGenerativeUI !== undefined && { showGenerativeUI },
|
|
3846
|
-
...showToolCalls !== undefined && { showToolCalls },
|
|
3847
4515
|
...showFilePreview !== undefined && { showFilePreview },
|
|
3848
4516
|
...showImageLightbox !== undefined && { showImageLightbox },
|
|
3849
|
-
...renderToolCall !== undefined && { renderToolCall },
|
|
3850
|
-
...renderContent !== undefined && { renderContent },
|
|
3851
|
-
...renderMedia !== undefined && { renderMedia },
|
|
3852
4517
|
...formatTimestamp !== undefined && { formatTimestamp },
|
|
3853
4518
|
...messageClassNames !== undefined && { classNames: messageClassNames },
|
|
3854
|
-
...
|
|
4519
|
+
...propRenderTool !== undefined && { renderTool: propRenderTool }
|
|
3855
4520
|
};
|
|
3856
|
-
const resolvedEmptyState = children ?? emptyState ?? /* @__PURE__ */
|
|
4521
|
+
const resolvedEmptyState = children ?? emptyState ?? /* @__PURE__ */ jsx_runtime50.jsxs("div", {
|
|
3857
4522
|
className: "flex flex-col items-center gap-6",
|
|
3858
4523
|
children: [
|
|
3859
|
-
/* @__PURE__ */
|
|
4524
|
+
/* @__PURE__ */ jsx_runtime50.jsxs("div", {
|
|
3860
4525
|
className: "relative",
|
|
3861
4526
|
children: [
|
|
3862
|
-
/* @__PURE__ */
|
|
4527
|
+
/* @__PURE__ */ jsx_runtime50.jsx("div", {
|
|
3863
4528
|
className: "h-16 w-16 rounded-2xl bg-primary/10 flex items-center justify-center",
|
|
3864
|
-
children: /* @__PURE__ */
|
|
4529
|
+
children: /* @__PURE__ */ jsx_runtime50.jsx(import_lucide_react25.Bot, {
|
|
3865
4530
|
className: "h-8 w-8 text-primary"
|
|
3866
4531
|
})
|
|
3867
4532
|
}),
|
|
3868
|
-
/* @__PURE__ */
|
|
4533
|
+
/* @__PURE__ */ jsx_runtime50.jsx("div", {
|
|
3869
4534
|
className: "absolute -bottom-1 -right-1 h-5 w-5 rounded-full bg-green-500 border-2 border-background flex items-center justify-center",
|
|
3870
|
-
children: /* @__PURE__ */
|
|
4535
|
+
children: /* @__PURE__ */ jsx_runtime50.jsx("span", {
|
|
3871
4536
|
className: "h-2 w-2 rounded-full bg-white animate-pulse"
|
|
3872
4537
|
})
|
|
3873
4538
|
})
|
|
3874
4539
|
]
|
|
3875
4540
|
}),
|
|
3876
|
-
/* @__PURE__ */
|
|
4541
|
+
/* @__PURE__ */ jsx_runtime50.jsxs("div", {
|
|
3877
4542
|
className: "space-y-2 text-center",
|
|
3878
4543
|
children: [
|
|
3879
|
-
/* @__PURE__ */
|
|
4544
|
+
/* @__PURE__ */ jsx_runtime50.jsx("h3", {
|
|
3880
4545
|
className: "text-xl font-semibold tracking-tight",
|
|
3881
4546
|
children: "Welcome to Agno Chat"
|
|
3882
4547
|
}),
|
|
3883
|
-
/* @__PURE__ */
|
|
4548
|
+
/* @__PURE__ */ jsx_runtime50.jsx("p", {
|
|
3884
4549
|
className: "text-muted-foreground text-sm max-w-sm",
|
|
3885
4550
|
children: "Start a conversation with your AI agent. Ask questions, explore ideas, or run tools."
|
|
3886
4551
|
})
|
|
3887
4552
|
]
|
|
3888
4553
|
}),
|
|
3889
|
-
suggestedPrompts.length > 0 && /* @__PURE__ */
|
|
4554
|
+
suggestedPrompts.length > 0 && /* @__PURE__ */ jsx_runtime50.jsx(AgnoChatSuggestedPrompts, {
|
|
3890
4555
|
prompts: suggestedPrompts
|
|
3891
4556
|
})
|
|
3892
4557
|
]
|
|
3893
4558
|
});
|
|
3894
|
-
return /* @__PURE__ */
|
|
4559
|
+
return /* @__PURE__ */ jsx_runtime50.jsxs(Conversation, {
|
|
3895
4560
|
className: cn("relative flex-1 w-full", className),
|
|
3896
4561
|
scrollBehavior,
|
|
3897
4562
|
children: [
|
|
3898
|
-
/* @__PURE__ */
|
|
4563
|
+
/* @__PURE__ */ jsx_runtime50.jsx(ScrollOnNewUserMessage, {
|
|
3899
4564
|
messageCount: messages.length
|
|
3900
4565
|
}),
|
|
3901
|
-
/* @__PURE__ */
|
|
4566
|
+
/* @__PURE__ */ jsx_runtime50.jsxs(ConversationContent, {
|
|
3902
4567
|
className: "max-w-3xl mx-auto",
|
|
3903
4568
|
children: [
|
|
3904
|
-
messages.length === 0 ? /* @__PURE__ */
|
|
4569
|
+
messages.length === 0 ? /* @__PURE__ */ jsx_runtime50.jsx(ConversationEmptyState, {
|
|
3905
4570
|
children: resolvedEmptyState
|
|
3906
4571
|
}) : messages.map((message, index) => {
|
|
3907
4572
|
if (isThinking && index === messages.length - 1 && message === lastMessage)
|
|
3908
4573
|
return null;
|
|
3909
|
-
return renderMessage ? renderMessage(message, index) : /* @__PURE__ */
|
|
4574
|
+
return renderMessage ? renderMessage(message, index) : /* @__PURE__ */ jsx_runtime50.jsx(AgnoMessageItem, {
|
|
3910
4575
|
message,
|
|
3911
4576
|
avatars,
|
|
3912
4577
|
actions,
|
|
@@ -3914,9 +4579,9 @@ function AgnoChatMessages({
|
|
|
3914
4579
|
...messageItemProps
|
|
3915
4580
|
}, `msg-${index}-${message.created_at}`);
|
|
3916
4581
|
}),
|
|
3917
|
-
isThinking && /* @__PURE__ */
|
|
4582
|
+
isThinking && /* @__PURE__ */ jsx_runtime50.jsx("div", {
|
|
3918
4583
|
className: "py-2",
|
|
3919
|
-
children: renderThinkingIndicator ?? /* @__PURE__ */
|
|
4584
|
+
children: renderThinkingIndicator ?? /* @__PURE__ */ jsx_runtime50.jsx(StreamingIndicator, {
|
|
3920
4585
|
avatar: avatars?.assistant
|
|
3921
4586
|
})
|
|
3922
4587
|
})
|
|
@@ -3928,9 +4593,9 @@ function AgnoChatMessages({
|
|
|
3928
4593
|
}
|
|
3929
4594
|
|
|
3930
4595
|
// src/ui/composed/agno-chat/empty-state.tsx
|
|
3931
|
-
var
|
|
4596
|
+
var jsx_runtime51 = require("react/jsx-runtime");
|
|
3932
4597
|
function AgnoChatEmptyState({ children, className, ...props }) {
|
|
3933
|
-
return /* @__PURE__ */
|
|
4598
|
+
return /* @__PURE__ */ jsx_runtime51.jsx("div", {
|
|
3934
4599
|
className: cn("flex flex-col items-center gap-6", className),
|
|
3935
4600
|
...props,
|
|
3936
4601
|
children
|
|
@@ -3938,8 +4603,8 @@ function AgnoChatEmptyState({ children, className, ...props }) {
|
|
|
3938
4603
|
}
|
|
3939
4604
|
|
|
3940
4605
|
// src/ui/composed/agno-chat/error-bar.tsx
|
|
3941
|
-
var
|
|
3942
|
-
var
|
|
4606
|
+
var import_react19 = require("react");
|
|
4607
|
+
var jsx_runtime52 = require("react/jsx-runtime");
|
|
3943
4608
|
function AgnoChatErrorBar({
|
|
3944
4609
|
className,
|
|
3945
4610
|
text,
|
|
@@ -3949,10 +4614,10 @@ function AgnoChatErrorBar({
|
|
|
3949
4614
|
children
|
|
3950
4615
|
}) {
|
|
3951
4616
|
const { error, executionError } = useAgnoChatContext();
|
|
3952
|
-
const [hidden, setHidden] =
|
|
3953
|
-
const timerRef =
|
|
4617
|
+
const [hidden, setHidden] = import_react19.useState(false);
|
|
4618
|
+
const timerRef = import_react19.useRef(null);
|
|
3954
4619
|
const rawMessage = error || executionError;
|
|
3955
|
-
|
|
4620
|
+
import_react19.useEffect(() => {
|
|
3956
4621
|
if (!rawMessage)
|
|
3957
4622
|
return;
|
|
3958
4623
|
setHidden(false);
|
|
@@ -3979,23 +4644,23 @@ function AgnoChatErrorBar({
|
|
|
3979
4644
|
if (children) {
|
|
3980
4645
|
return typeof children === "function" ? children(rawMessage) : children;
|
|
3981
4646
|
}
|
|
3982
|
-
return /* @__PURE__ */
|
|
4647
|
+
return /* @__PURE__ */ jsx_runtime52.jsxs("div", {
|
|
3983
4648
|
className: "flex items-center gap-2 max-w-3xl mx-auto",
|
|
3984
4649
|
children: [
|
|
3985
|
-
icon && /* @__PURE__ */
|
|
4650
|
+
icon && /* @__PURE__ */ jsx_runtime52.jsx("span", {
|
|
3986
4651
|
className: "shrink-0",
|
|
3987
4652
|
children: icon
|
|
3988
4653
|
}),
|
|
3989
|
-
/* @__PURE__ */
|
|
4654
|
+
/* @__PURE__ */ jsx_runtime52.jsx("p", {
|
|
3990
4655
|
className: "text-sm text-destructive flex-1",
|
|
3991
4656
|
children: displayMessage
|
|
3992
4657
|
}),
|
|
3993
|
-
dismissible && /* @__PURE__ */
|
|
4658
|
+
dismissible && /* @__PURE__ */ jsx_runtime52.jsx("button", {
|
|
3994
4659
|
type: "button",
|
|
3995
4660
|
onClick: () => setHidden(true),
|
|
3996
4661
|
className: "shrink-0 text-destructive/60 hover:text-destructive transition-colors",
|
|
3997
4662
|
"aria-label": "Dismiss error",
|
|
3998
|
-
children: /* @__PURE__ */
|
|
4663
|
+
children: /* @__PURE__ */ jsx_runtime52.jsxs("svg", {
|
|
3999
4664
|
xmlns: "http://www.w3.org/2000/svg",
|
|
4000
4665
|
width: "16",
|
|
4001
4666
|
height: "16",
|
|
@@ -4006,10 +4671,10 @@ function AgnoChatErrorBar({
|
|
|
4006
4671
|
strokeLinecap: "round",
|
|
4007
4672
|
strokeLinejoin: "round",
|
|
4008
4673
|
children: [
|
|
4009
|
-
/* @__PURE__ */
|
|
4674
|
+
/* @__PURE__ */ jsx_runtime52.jsx("path", {
|
|
4010
4675
|
d: "M18 6 6 18"
|
|
4011
4676
|
}),
|
|
4012
|
-
/* @__PURE__ */
|
|
4677
|
+
/* @__PURE__ */ jsx_runtime52.jsx("path", {
|
|
4013
4678
|
d: "m6 6 12 12"
|
|
4014
4679
|
})
|
|
4015
4680
|
]
|
|
@@ -4018,14 +4683,14 @@ function AgnoChatErrorBar({
|
|
|
4018
4683
|
]
|
|
4019
4684
|
});
|
|
4020
4685
|
};
|
|
4021
|
-
return /* @__PURE__ */
|
|
4686
|
+
return /* @__PURE__ */ jsx_runtime52.jsx("div", {
|
|
4022
4687
|
className: cn("px-4 py-2.5 bg-destructive/5 border-t border-destructive/20", className),
|
|
4023
4688
|
children: renderContent()
|
|
4024
4689
|
});
|
|
4025
4690
|
}
|
|
4026
4691
|
|
|
4027
4692
|
// src/ui/composed/agno-chat/input.tsx
|
|
4028
|
-
var
|
|
4693
|
+
var jsx_runtime53 = require("react/jsx-runtime");
|
|
4029
4694
|
function AgnoChatInputArea({
|
|
4030
4695
|
className,
|
|
4031
4696
|
children,
|
|
@@ -4038,11 +4703,11 @@ function AgnoChatInputArea({
|
|
|
4038
4703
|
dropZoneProps
|
|
4039
4704
|
}) {
|
|
4040
4705
|
const { handleSend, inputDisabled, isStreaming, isPaused, cancelRun, dropZoneContainerRef } = useAgnoChatContext();
|
|
4041
|
-
return /* @__PURE__ */
|
|
4706
|
+
return /* @__PURE__ */ jsx_runtime53.jsx("div", {
|
|
4042
4707
|
className: cn("border-t border-border bg-background/80 backdrop-blur-sm", className),
|
|
4043
|
-
children: /* @__PURE__ */
|
|
4708
|
+
children: /* @__PURE__ */ jsx_runtime53.jsx("div", {
|
|
4044
4709
|
className: "mx-auto px-4 py-2",
|
|
4045
|
-
children: children ? children({ onSend: handleSend, disabled: inputDisabled, isStreaming, isPaused }) : /* @__PURE__ */
|
|
4710
|
+
children: children ? children({ onSend: handleSend, disabled: inputDisabled, isStreaming, isPaused }) : /* @__PURE__ */ jsx_runtime53.jsx(AgnoChatInput, {
|
|
4046
4711
|
onSend: handleSend,
|
|
4047
4712
|
disabled: inputDisabled,
|
|
4048
4713
|
isStreaming,
|
|
@@ -4069,4 +4734,4 @@ var AgnoChat = Object.assign(AgnoChatRoot, {
|
|
|
4069
4734
|
Input: AgnoChatInputArea
|
|
4070
4735
|
});
|
|
4071
4736
|
|
|
4072
|
-
//# debugId=
|
|
4737
|
+
//# debugId=DF0422349E1C62CD64756E2164756E21
|