@rodrigocoliveira/agno-react 1.0.3 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/hooks/useAgnoChat.d.ts.map +1 -1
- package/dist/index.js +3 -19
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +3 -19
- package/dist/index.mjs.map +3 -3
- package/dist/ui/composed/AgnoChatInput.d.ts +11 -17
- package/dist/ui/composed/AgnoChatInput.d.ts.map +1 -1
- package/dist/ui/composed/AgnoMessageItem.d.ts +9 -9
- package/dist/ui/composed/AgnoMessageItem.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/error-bar.d.ts +12 -1
- package/dist/ui/composed/agno-chat/error-bar.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/input.d.ts +13 -18
- package/dist/ui/composed/agno-chat/input.d.ts.map +1 -1
- package/dist/ui/composed/agno-chat/messages.d.ts +31 -7
- package/dist/ui/composed/agno-chat/messages.d.ts.map +1 -1
- package/dist/ui/composed/index.d.ts +0 -2
- package/dist/ui/composed/index.d.ts.map +1 -1
- package/dist/ui/index.d.ts +1 -3
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/types.d.ts +51 -16
- package/dist/ui/types.d.ts.map +1 -1
- package/dist/ui.js +639 -606
- package/dist/ui.js.map +9 -10
- package/dist/ui.mjs +636 -603
- package/dist/ui.mjs.map +9 -10
- package/package.json +1 -1
- package/dist/ui/composed/AgnoChatInterface.d.ts +0 -49
- package/dist/ui/composed/AgnoChatInterface.d.ts.map +0 -1
package/dist/ui.js
CHANGED
|
@@ -190,7 +190,6 @@ __export(exports_ui, {
|
|
|
190
190
|
AgnoChatSuggestedPrompts: () => AgnoChatSuggestedPrompts,
|
|
191
191
|
AgnoChatRoot: () => AgnoChatRoot,
|
|
192
192
|
AgnoChatMessages: () => AgnoChatMessages,
|
|
193
|
-
AgnoChatInterface: () => AgnoChatInterface,
|
|
194
193
|
AgnoChatInputArea: () => AgnoChatInputArea,
|
|
195
194
|
AgnoChatInput: () => AgnoChatInput,
|
|
196
195
|
AgnoChatErrorBar: () => AgnoChatErrorBar,
|
|
@@ -2867,121 +2866,11 @@ var PromptInputCommandSeparator = ({ className, ...props }) => /* @__PURE__ */ j
|
|
|
2867
2866
|
className: cn(className),
|
|
2868
2867
|
...props
|
|
2869
2868
|
}, undefined, false, undefined, this);
|
|
2870
|
-
// src/ui/composed/agno-chat/agno-chat.tsx
|
|
2871
|
-
var import_react15 = require("react");
|
|
2872
|
-
var import_agno_react = require("@rodrigocoliveira/agno-react");
|
|
2873
|
-
|
|
2874
|
-
// src/ui/composed/agno-chat/context.ts
|
|
2875
|
-
var import_react14 = require("react");
|
|
2876
|
-
var AgnoChatContext = import_react14.createContext(null);
|
|
2877
|
-
function useAgnoChatContext() {
|
|
2878
|
-
const ctx = import_react14.useContext(AgnoChatContext);
|
|
2879
|
-
if (!ctx) {
|
|
2880
|
-
throw new Error("useAgnoChatContext must be used within an <AgnoChat> provider. " + "Wrap your component tree with <AgnoChat>.");
|
|
2881
|
-
}
|
|
2882
|
-
return ctx;
|
|
2883
|
-
}
|
|
2884
|
-
|
|
2885
|
-
// src/ui/composed/agno-chat/agno-chat.tsx
|
|
2886
|
-
var jsx_dev_runtime35 = require("react/jsx-dev-runtime");
|
|
2887
|
-
function AgnoChatRoot({
|
|
2888
|
-
children,
|
|
2889
|
-
toolHandlers = {},
|
|
2890
|
-
autoExecuteTools = true,
|
|
2891
|
-
className,
|
|
2892
|
-
...divProps
|
|
2893
|
-
}) {
|
|
2894
|
-
const chat = import_agno_react.useAgnoChat();
|
|
2895
|
-
const toolExec = import_agno_react.useAgnoToolExecution(toolHandlers, autoExecuteTools);
|
|
2896
|
-
const containerRef = import_react15.useRef(null);
|
|
2897
|
-
const sendRef = import_react15.useRef(chat.sendMessage);
|
|
2898
|
-
sendRef.current = chat.sendMessage;
|
|
2899
|
-
const handleSend = import_react15.useCallback(async (message) => {
|
|
2900
|
-
try {
|
|
2901
|
-
await sendRef.current(message);
|
|
2902
|
-
} catch {}
|
|
2903
|
-
}, []);
|
|
2904
|
-
const {
|
|
2905
|
-
messages,
|
|
2906
|
-
sendMessage,
|
|
2907
|
-
clearMessages,
|
|
2908
|
-
cancelRun,
|
|
2909
|
-
isStreaming,
|
|
2910
|
-
isRefreshing,
|
|
2911
|
-
isCancelling,
|
|
2912
|
-
currentRunId,
|
|
2913
|
-
error,
|
|
2914
|
-
state
|
|
2915
|
-
} = chat;
|
|
2916
|
-
const {
|
|
2917
|
-
isPaused,
|
|
2918
|
-
isExecuting,
|
|
2919
|
-
pendingTools,
|
|
2920
|
-
executeAndContinue,
|
|
2921
|
-
executeTools,
|
|
2922
|
-
continueWithResults,
|
|
2923
|
-
executionError
|
|
2924
|
-
} = toolExec;
|
|
2925
|
-
const contextValue = import_react15.useMemo(() => ({
|
|
2926
|
-
messages,
|
|
2927
|
-
sendMessage,
|
|
2928
|
-
clearMessages,
|
|
2929
|
-
cancelRun,
|
|
2930
|
-
isStreaming,
|
|
2931
|
-
isRefreshing,
|
|
2932
|
-
isCancelling: isCancelling ?? false,
|
|
2933
|
-
currentRunId,
|
|
2934
|
-
error,
|
|
2935
|
-
state,
|
|
2936
|
-
isPaused,
|
|
2937
|
-
isExecuting,
|
|
2938
|
-
pendingTools,
|
|
2939
|
-
executeAndContinue,
|
|
2940
|
-
executeTools,
|
|
2941
|
-
continueWithResults,
|
|
2942
|
-
executionError,
|
|
2943
|
-
handleSend,
|
|
2944
|
-
inputDisabled: isStreaming || isPaused,
|
|
2945
|
-
dropZoneContainerRef: containerRef
|
|
2946
|
-
}), [
|
|
2947
|
-
messages,
|
|
2948
|
-
sendMessage,
|
|
2949
|
-
clearMessages,
|
|
2950
|
-
cancelRun,
|
|
2951
|
-
isStreaming,
|
|
2952
|
-
isRefreshing,
|
|
2953
|
-
isCancelling,
|
|
2954
|
-
currentRunId,
|
|
2955
|
-
error,
|
|
2956
|
-
state,
|
|
2957
|
-
isPaused,
|
|
2958
|
-
isExecuting,
|
|
2959
|
-
pendingTools,
|
|
2960
|
-
executeAndContinue,
|
|
2961
|
-
executeTools,
|
|
2962
|
-
continueWithResults,
|
|
2963
|
-
executionError,
|
|
2964
|
-
handleSend
|
|
2965
|
-
]);
|
|
2966
|
-
return /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(AgnoChatContext.Provider, {
|
|
2967
|
-
value: contextValue,
|
|
2968
|
-
children: /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
2969
|
-
ref: containerRef,
|
|
2970
|
-
className: cn("relative h-full flex flex-col", className),
|
|
2971
|
-
...divProps,
|
|
2972
|
-
children
|
|
2973
|
-
}, undefined, false, undefined, this)
|
|
2974
|
-
}, undefined, false, undefined, this);
|
|
2975
|
-
}
|
|
2976
|
-
|
|
2977
|
-
// src/ui/composed/agno-chat/messages.tsx
|
|
2978
|
-
var import_react17 = require("react");
|
|
2979
|
-
|
|
2980
2869
|
// src/ui/composed/AgnoMessageItem.tsx
|
|
2981
|
-
var
|
|
2982
|
-
var
|
|
2870
|
+
var import_react14 = require("react");
|
|
2871
|
+
var import_agno_react = require("@rodrigocoliveira/agno-react");
|
|
2983
2872
|
var import_lucide_react19 = require("lucide-react");
|
|
2984
|
-
var
|
|
2873
|
+
var jsx_dev_runtime35 = require("react/jsx-dev-runtime");
|
|
2985
2874
|
var defaultFormatTimestamp = formatSmartTimestamp;
|
|
2986
2875
|
var getToolState = (tool) => {
|
|
2987
2876
|
return tool.tool_call_error ? "output-error" : "output-available";
|
|
@@ -2993,9 +2882,9 @@ function AgnoMessageItem({
|
|
|
2993
2882
|
renderContent,
|
|
2994
2883
|
renderToolCall,
|
|
2995
2884
|
renderMedia,
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2885
|
+
avatars,
|
|
2886
|
+
actions,
|
|
2887
|
+
isLastAssistantMessage = false,
|
|
2999
2888
|
showReasoning = true,
|
|
3000
2889
|
showReferences = true,
|
|
3001
2890
|
showTimestamp = true,
|
|
@@ -3008,7 +2897,7 @@ function AgnoMessageItem({
|
|
|
3008
2897
|
const isUser = message.role === "user";
|
|
3009
2898
|
const hasError = message.streamingError;
|
|
3010
2899
|
const toolsWithUI = message.tool_calls?.filter((tool) => tool.ui_component) || [];
|
|
3011
|
-
const [preview, setPreview] =
|
|
2900
|
+
const [preview, setPreview] = import_react14.useState(null);
|
|
3012
2901
|
const isCustomTimestamp = !!formatTimestamp;
|
|
3013
2902
|
const resolvedFormatTimestamp = formatTimestamp ?? defaultFormatTimestamp;
|
|
3014
2903
|
const openImageLightbox = (images, index) => {
|
|
@@ -3022,45 +2911,45 @@ function AgnoMessageItem({
|
|
|
3022
2911
|
setPreview({ type: "file", file });
|
|
3023
2912
|
};
|
|
3024
2913
|
const closePreview = () => setPreview(null);
|
|
3025
|
-
return /* @__PURE__ */
|
|
2914
|
+
return /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3026
2915
|
className: cn("py-5 first:pt-2", isUser ? "flex justify-end" : "", classNames?.root, className),
|
|
3027
2916
|
children: [
|
|
3028
|
-
isUser ? /* @__PURE__ */
|
|
2917
|
+
isUser ? /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3029
2918
|
className: "flex items-start gap-2.5 max-w-[80%] flex-row-reverse",
|
|
3030
2919
|
children: [
|
|
3031
|
-
|
|
3032
|
-
/* @__PURE__ */
|
|
2920
|
+
avatars?.user,
|
|
2921
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3033
2922
|
className: "space-y-1.5 flex flex-col items-end min-w-0",
|
|
3034
2923
|
children: [
|
|
3035
|
-
(message.images && message.images.length > 0 || message.audio && message.audio.length > 0 || message.files && message.files.length > 0) && /* @__PURE__ */
|
|
2924
|
+
(message.images && message.images.length > 0 || message.audio && message.audio.length > 0 || message.files && message.files.length > 0) && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3036
2925
|
className: "flex flex-wrap gap-2 justify-end",
|
|
3037
2926
|
children: [
|
|
3038
|
-
message.images?.map((img, idx) => /* @__PURE__ */
|
|
2927
|
+
message.images?.map((img, idx) => /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(FilePreviewCard, {
|
|
3039
2928
|
file: { name: img.revised_prompt || `Image ${idx + 1}`, type: "image/png", url: img.url },
|
|
3040
2929
|
onClick: showImageLightbox ? () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx) : undefined
|
|
3041
2930
|
}, `img-${idx}`, false, undefined, this)),
|
|
3042
|
-
message.audio?.map((audio, idx) => /* @__PURE__ */
|
|
2931
|
+
message.audio?.map((audio, idx) => /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3043
2932
|
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",
|
|
3044
2933
|
children: [
|
|
3045
|
-
/* @__PURE__ */
|
|
2934
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(import_lucide_react19.Music, {
|
|
3046
2935
|
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
3047
2936
|
}, undefined, false, undefined, this),
|
|
3048
|
-
/* @__PURE__ */
|
|
2937
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("span", {
|
|
3049
2938
|
className: "truncate max-w-[150px]",
|
|
3050
2939
|
children: audio.id || `Audio ${idx + 1}`
|
|
3051
2940
|
}, undefined, false, undefined, this)
|
|
3052
2941
|
]
|
|
3053
2942
|
}, `audio-${idx}`, true, undefined, this)),
|
|
3054
|
-
message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */
|
|
2943
|
+
message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(FilePreviewCard, {
|
|
3055
2944
|
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
3056
2945
|
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
3057
|
-
}, `file-${idx}`, false, undefined, this) : /* @__PURE__ */
|
|
2946
|
+
}, `file-${idx}`, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3058
2947
|
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",
|
|
3059
2948
|
children: [
|
|
3060
|
-
/* @__PURE__ */
|
|
2949
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(import_lucide_react19.FileIcon, {
|
|
3061
2950
|
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
3062
2951
|
}, undefined, false, undefined, this),
|
|
3063
|
-
/* @__PURE__ */
|
|
2952
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("span", {
|
|
3064
2953
|
className: "truncate max-w-[150px]",
|
|
3065
2954
|
children: file.name
|
|
3066
2955
|
}, undefined, false, undefined, this)
|
|
@@ -3068,22 +2957,26 @@ function AgnoMessageItem({
|
|
|
3068
2957
|
}, `file-${idx}`, true, undefined, this))
|
|
3069
2958
|
]
|
|
3070
2959
|
}, undefined, true, undefined, this),
|
|
3071
|
-
message.content && /* @__PURE__ */
|
|
3072
|
-
className: cn("rounded-2xl rounded-br-md px-4 py-2.5", classNames?.
|
|
3073
|
-
children: /* @__PURE__ */
|
|
2960
|
+
message.content && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
2961
|
+
className: cn("rounded-2xl rounded-br-md px-4 py-2.5", classNames?.user?.bubble ?? "bg-primary text-primary-foreground", hasError && "opacity-70"),
|
|
2962
|
+
children: /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("p", {
|
|
3074
2963
|
className: "text-sm whitespace-pre-wrap",
|
|
3075
2964
|
children: message.content
|
|
3076
2965
|
}, undefined, false, undefined, this)
|
|
3077
2966
|
}, undefined, false, undefined, this),
|
|
3078
|
-
showTimestamp && /* @__PURE__ */
|
|
2967
|
+
(showTimestamp || actions?.user) && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3079
2968
|
className: "flex items-center justify-end gap-1.5 px-1",
|
|
3080
2969
|
children: [
|
|
3081
|
-
/* @__PURE__ */
|
|
2970
|
+
actions?.user && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
2971
|
+
className: "flex items-center gap-1",
|
|
2972
|
+
children: actions.user(message)
|
|
2973
|
+
}, undefined, false, undefined, this),
|
|
2974
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(SmartTimestamp, {
|
|
3082
2975
|
date: new Date(message.created_at * 1000),
|
|
3083
2976
|
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
3084
2977
|
className: "text-[11px] text-muted-foreground"
|
|
3085
2978
|
}, undefined, false, undefined, this),
|
|
3086
|
-
hasError && /* @__PURE__ */
|
|
2979
|
+
hasError && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(import_lucide_react19.AlertCircle, {
|
|
3087
2980
|
className: "h-3 w-3 text-destructive"
|
|
3088
2981
|
}, undefined, false, undefined, this)
|
|
3089
2982
|
]
|
|
@@ -3091,22 +2984,22 @@ function AgnoMessageItem({
|
|
|
3091
2984
|
]
|
|
3092
2985
|
}, undefined, true, undefined, this)
|
|
3093
2986
|
]
|
|
3094
|
-
}, undefined, true, undefined, this) : /* @__PURE__ */
|
|
3095
|
-
className: "flex items-start gap-3",
|
|
2987
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
2988
|
+
className: "flex items-start gap-3 group/message",
|
|
3096
2989
|
children: [
|
|
3097
|
-
|
|
3098
|
-
/* @__PURE__ */
|
|
3099
|
-
className: cn("flex-1 min-w-0 space-y-3", classNames?.
|
|
2990
|
+
avatars?.assistant,
|
|
2991
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
2992
|
+
className: cn("flex-1 min-w-0 space-y-3", classNames?.assistant?.container),
|
|
3100
2993
|
children: [
|
|
3101
|
-
renderContent ? renderContent(message) : /* @__PURE__ */
|
|
2994
|
+
renderContent ? renderContent(message) : /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(jsx_dev_runtime35.Fragment, {
|
|
3102
2995
|
children: [
|
|
3103
|
-
showReasoning && message.extra_data?.reasoning_steps && message.extra_data.reasoning_steps.length > 0 && /* @__PURE__ */
|
|
3104
|
-
className: cn("space-y-2 pt-1", classNames?.reasoning),
|
|
2996
|
+
showReasoning && message.extra_data?.reasoning_steps && message.extra_data.reasoning_steps.length > 0 && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
2997
|
+
className: cn("space-y-2 pt-1", classNames?.assistant?.reasoning),
|
|
3105
2998
|
children: [
|
|
3106
|
-
/* @__PURE__ */
|
|
2999
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3107
3000
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3108
3001
|
children: [
|
|
3109
|
-
/* @__PURE__ */
|
|
3002
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(import_lucide_react19.Lightbulb, {
|
|
3110
3003
|
className: "h-3.5 w-3.5"
|
|
3111
3004
|
}, undefined, false, undefined, this),
|
|
3112
3005
|
"Reasoning (",
|
|
@@ -3114,23 +3007,23 @@ function AgnoMessageItem({
|
|
|
3114
3007
|
" steps)"
|
|
3115
3008
|
]
|
|
3116
3009
|
}, undefined, true, undefined, this),
|
|
3117
|
-
/* @__PURE__ */
|
|
3010
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(Accordion, {
|
|
3118
3011
|
type: "multiple",
|
|
3119
3012
|
className: "w-full",
|
|
3120
|
-
children: message.extra_data.reasoning_steps.map((step, idx) => /* @__PURE__ */
|
|
3013
|
+
children: message.extra_data.reasoning_steps.map((step, idx) => /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(AccordionItem, {
|
|
3121
3014
|
value: `reasoning-${idx}`,
|
|
3122
3015
|
className: "border-muted",
|
|
3123
3016
|
children: [
|
|
3124
|
-
/* @__PURE__ */
|
|
3017
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(AccordionTrigger, {
|
|
3125
3018
|
className: "text-xs py-1.5 hover:no-underline",
|
|
3126
3019
|
children: step.title || `Step ${idx + 1}`
|
|
3127
3020
|
}, undefined, false, undefined, this),
|
|
3128
|
-
/* @__PURE__ */
|
|
3021
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(AccordionContent, {
|
|
3129
3022
|
className: "space-y-1.5 text-xs text-muted-foreground",
|
|
3130
3023
|
children: [
|
|
3131
|
-
step.action && /* @__PURE__ */
|
|
3024
|
+
step.action && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3132
3025
|
children: [
|
|
3133
|
-
/* @__PURE__ */
|
|
3026
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("span", {
|
|
3134
3027
|
className: "font-medium text-foreground",
|
|
3135
3028
|
children: "Action:"
|
|
3136
3029
|
}, undefined, false, undefined, this),
|
|
@@ -3138,9 +3031,9 @@ function AgnoMessageItem({
|
|
|
3138
3031
|
step.action
|
|
3139
3032
|
]
|
|
3140
3033
|
}, undefined, true, undefined, this),
|
|
3141
|
-
step.reasoning && /* @__PURE__ */
|
|
3034
|
+
step.reasoning && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3142
3035
|
children: [
|
|
3143
|
-
/* @__PURE__ */
|
|
3036
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("span", {
|
|
3144
3037
|
className: "font-medium text-foreground",
|
|
3145
3038
|
children: "Reasoning:"
|
|
3146
3039
|
}, undefined, false, undefined, this),
|
|
@@ -3148,9 +3041,9 @@ function AgnoMessageItem({
|
|
|
3148
3041
|
step.reasoning
|
|
3149
3042
|
]
|
|
3150
3043
|
}, undefined, true, undefined, this),
|
|
3151
|
-
step.result && /* @__PURE__ */
|
|
3044
|
+
step.result && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3152
3045
|
children: [
|
|
3153
|
-
/* @__PURE__ */
|
|
3046
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("span", {
|
|
3154
3047
|
className: "font-medium text-foreground",
|
|
3155
3048
|
children: "Result:"
|
|
3156
3049
|
}, undefined, false, undefined, this),
|
|
@@ -3158,9 +3051,9 @@ function AgnoMessageItem({
|
|
|
3158
3051
|
step.result
|
|
3159
3052
|
]
|
|
3160
3053
|
}, undefined, true, undefined, this),
|
|
3161
|
-
step.confidence !== undefined && /* @__PURE__ */
|
|
3054
|
+
step.confidence !== undefined && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3162
3055
|
children: [
|
|
3163
|
-
/* @__PURE__ */
|
|
3056
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("span", {
|
|
3164
3057
|
className: "font-medium text-foreground",
|
|
3165
3058
|
children: "Confidence:"
|
|
3166
3059
|
}, undefined, false, undefined, this),
|
|
@@ -3176,23 +3069,23 @@ function AgnoMessageItem({
|
|
|
3176
3069
|
}, undefined, false, undefined, this)
|
|
3177
3070
|
]
|
|
3178
3071
|
}, undefined, true, undefined, this),
|
|
3179
|
-
message.content && /* @__PURE__ */
|
|
3072
|
+
message.content && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3180
3073
|
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",
|
|
3181
|
-
children: /* @__PURE__ */
|
|
3074
|
+
children: /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(Response, {
|
|
3182
3075
|
children: message.content
|
|
3183
3076
|
}, undefined, false, undefined, this)
|
|
3184
3077
|
}, undefined, false, undefined, this),
|
|
3185
|
-
showGenerativeUI && toolsWithUI.length > 0 && /* @__PURE__ */
|
|
3078
|
+
showGenerativeUI && toolsWithUI.length > 0 && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3186
3079
|
className: "space-y-3",
|
|
3187
3080
|
children: toolsWithUI.map((tool) => {
|
|
3188
3081
|
const uiComponent = tool.ui_component;
|
|
3189
|
-
return /* @__PURE__ */
|
|
3190
|
-
children: uiComponent.layout === "artifact" ? /* @__PURE__ */
|
|
3191
|
-
children: /* @__PURE__ */
|
|
3082
|
+
return /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3083
|
+
children: uiComponent.layout === "artifact" ? /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(Artifact, {
|
|
3084
|
+
children: /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(import_agno_react.GenerativeUIRenderer, {
|
|
3192
3085
|
spec: uiComponent,
|
|
3193
3086
|
className: "w-full p-2"
|
|
3194
3087
|
}, undefined, false, undefined, this)
|
|
3195
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
3088
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(import_agno_react.GenerativeUIRenderer, {
|
|
3196
3089
|
spec: uiComponent,
|
|
3197
3090
|
className: "w-full"
|
|
3198
3091
|
}, undefined, false, undefined, this)
|
|
@@ -3200,16 +3093,16 @@ function AgnoMessageItem({
|
|
|
3200
3093
|
})
|
|
3201
3094
|
}, undefined, false, undefined, this),
|
|
3202
3095
|
renderMedia ? renderMedia(message) : (() => {
|
|
3203
|
-
const mediaClassName = classNames?.media;
|
|
3204
|
-
return /* @__PURE__ */
|
|
3096
|
+
const mediaClassName = classNames?.assistant?.media;
|
|
3097
|
+
return /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(jsx_dev_runtime35.Fragment, {
|
|
3205
3098
|
children: [
|
|
3206
|
-
message.images && message.images.length > 0 && /* @__PURE__ */
|
|
3099
|
+
message.images && message.images.length > 0 && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3207
3100
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3208
3101
|
children: [
|
|
3209
|
-
/* @__PURE__ */
|
|
3102
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3210
3103
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3211
3104
|
children: [
|
|
3212
|
-
/* @__PURE__ */
|
|
3105
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(import_lucide_react19.Image, {
|
|
3213
3106
|
className: "h-3.5 w-3.5"
|
|
3214
3107
|
}, undefined, false, undefined, this),
|
|
3215
3108
|
"Images (",
|
|
@@ -3217,26 +3110,26 @@ function AgnoMessageItem({
|
|
|
3217
3110
|
")"
|
|
3218
3111
|
]
|
|
3219
3112
|
}, undefined, true, undefined, this),
|
|
3220
|
-
/* @__PURE__ */
|
|
3113
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3221
3114
|
className: "grid grid-cols-2 gap-2",
|
|
3222
|
-
children: message.images.map((img, idx) => /* @__PURE__ */
|
|
3115
|
+
children: message.images.map((img, idx) => /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3223
3116
|
className: "space-y-1",
|
|
3224
3117
|
children: [
|
|
3225
|
-
showImageLightbox ? /* @__PURE__ */
|
|
3118
|
+
showImageLightbox ? /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("button", {
|
|
3226
3119
|
type: "button",
|
|
3227
3120
|
onClick: () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx),
|
|
3228
3121
|
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",
|
|
3229
|
-
children: /* @__PURE__ */
|
|
3122
|
+
children: /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("img", {
|
|
3230
3123
|
src: img.url,
|
|
3231
3124
|
alt: img.revised_prompt || "Generated image",
|
|
3232
3125
|
className: "w-full rounded-lg"
|
|
3233
3126
|
}, undefined, false, undefined, this)
|
|
3234
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
3127
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("img", {
|
|
3235
3128
|
src: img.url,
|
|
3236
3129
|
alt: img.revised_prompt || "Generated image",
|
|
3237
3130
|
className: "w-full rounded-lg border border-border"
|
|
3238
3131
|
}, undefined, false, undefined, this),
|
|
3239
|
-
img.revised_prompt && /* @__PURE__ */
|
|
3132
|
+
img.revised_prompt && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("p", {
|
|
3240
3133
|
className: "text-[11px] text-muted-foreground italic px-0.5",
|
|
3241
3134
|
children: img.revised_prompt
|
|
3242
3135
|
}, undefined, false, undefined, this)
|
|
@@ -3245,13 +3138,13 @@ function AgnoMessageItem({
|
|
|
3245
3138
|
}, undefined, false, undefined, this)
|
|
3246
3139
|
]
|
|
3247
3140
|
}, undefined, true, undefined, this),
|
|
3248
|
-
message.videos && message.videos.length > 0 && /* @__PURE__ */
|
|
3141
|
+
message.videos && message.videos.length > 0 && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3249
3142
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3250
3143
|
children: [
|
|
3251
|
-
/* @__PURE__ */
|
|
3144
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3252
3145
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3253
3146
|
children: [
|
|
3254
|
-
/* @__PURE__ */
|
|
3147
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(import_lucide_react19.Video, {
|
|
3255
3148
|
className: "h-3.5 w-3.5"
|
|
3256
3149
|
}, undefined, false, undefined, this),
|
|
3257
3150
|
"Videos (",
|
|
@@ -3259,14 +3152,14 @@ function AgnoMessageItem({
|
|
|
3259
3152
|
")"
|
|
3260
3153
|
]
|
|
3261
3154
|
}, undefined, true, undefined, this),
|
|
3262
|
-
/* @__PURE__ */
|
|
3155
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3263
3156
|
className: "space-y-2",
|
|
3264
|
-
children: message.videos.map((video, idx) => /* @__PURE__ */
|
|
3265
|
-
children: video.url ? /* @__PURE__ */
|
|
3157
|
+
children: message.videos.map((video, idx) => /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3158
|
+
children: video.url ? /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("video", {
|
|
3266
3159
|
src: video.url,
|
|
3267
3160
|
controls: true,
|
|
3268
3161
|
className: "w-full rounded-lg border border-border"
|
|
3269
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
3162
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3270
3163
|
className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
|
|
3271
3164
|
children: [
|
|
3272
3165
|
"Video ID: ",
|
|
@@ -3280,13 +3173,13 @@ function AgnoMessageItem({
|
|
|
3280
3173
|
}, undefined, false, undefined, this)
|
|
3281
3174
|
]
|
|
3282
3175
|
}, undefined, true, undefined, this),
|
|
3283
|
-
message.audio && message.audio.length > 0 && /* @__PURE__ */
|
|
3176
|
+
message.audio && message.audio.length > 0 && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3284
3177
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3285
3178
|
children: [
|
|
3286
|
-
/* @__PURE__ */
|
|
3179
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3287
3180
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3288
3181
|
children: [
|
|
3289
|
-
/* @__PURE__ */
|
|
3182
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(import_lucide_react19.Music, {
|
|
3290
3183
|
className: "h-3.5 w-3.5"
|
|
3291
3184
|
}, undefined, false, undefined, this),
|
|
3292
3185
|
"Audio (",
|
|
@@ -3294,18 +3187,18 @@ function AgnoMessageItem({
|
|
|
3294
3187
|
")"
|
|
3295
3188
|
]
|
|
3296
3189
|
}, undefined, true, undefined, this),
|
|
3297
|
-
/* @__PURE__ */
|
|
3190
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3298
3191
|
className: "space-y-2",
|
|
3299
|
-
children: message.audio.map((audio, idx) => /* @__PURE__ */
|
|
3300
|
-
children: audio.url ? /* @__PURE__ */
|
|
3192
|
+
children: message.audio.map((audio, idx) => /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3193
|
+
children: audio.url ? /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("audio", {
|
|
3301
3194
|
src: audio.url,
|
|
3302
3195
|
controls: true,
|
|
3303
3196
|
className: "w-full"
|
|
3304
|
-
}, undefined, false, undefined, this) : audio.base64_audio ? /* @__PURE__ */
|
|
3197
|
+
}, undefined, false, undefined, this) : audio.base64_audio ? /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("audio", {
|
|
3305
3198
|
src: `data:${audio.mime_type || "audio/wav"};base64,${audio.base64_audio}`,
|
|
3306
3199
|
controls: true,
|
|
3307
3200
|
className: "w-full"
|
|
3308
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
3201
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3309
3202
|
className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
|
|
3310
3203
|
children: "Audio data unavailable"
|
|
3311
3204
|
}, undefined, false, undefined, this)
|
|
@@ -3313,13 +3206,13 @@ function AgnoMessageItem({
|
|
|
3313
3206
|
}, undefined, false, undefined, this)
|
|
3314
3207
|
]
|
|
3315
3208
|
}, undefined, true, undefined, this),
|
|
3316
|
-
message.files && message.files.length > 0 && /* @__PURE__ */
|
|
3209
|
+
message.files && message.files.length > 0 && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3317
3210
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3318
3211
|
children: [
|
|
3319
|
-
/* @__PURE__ */
|
|
3212
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3320
3213
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3321
3214
|
children: [
|
|
3322
|
-
/* @__PURE__ */
|
|
3215
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(import_lucide_react19.Paperclip, {
|
|
3323
3216
|
className: "h-3.5 w-3.5"
|
|
3324
3217
|
}, undefined, false, undefined, this),
|
|
3325
3218
|
"Files (",
|
|
@@ -3327,22 +3220,22 @@ function AgnoMessageItem({
|
|
|
3327
3220
|
")"
|
|
3328
3221
|
]
|
|
3329
3222
|
}, undefined, true, undefined, this),
|
|
3330
|
-
/* @__PURE__ */
|
|
3223
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3331
3224
|
className: "flex flex-wrap gap-2",
|
|
3332
|
-
children: message.files.map((file, idx) => showFilePreview ? /* @__PURE__ */
|
|
3225
|
+
children: message.files.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(FilePreviewCard, {
|
|
3333
3226
|
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
3334
3227
|
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
3335
|
-
}, idx, false, undefined, this) : /* @__PURE__ */
|
|
3228
|
+
}, idx, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3336
3229
|
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",
|
|
3337
3230
|
children: [
|
|
3338
|
-
/* @__PURE__ */
|
|
3231
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(import_lucide_react19.FileIcon, {
|
|
3339
3232
|
className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
|
|
3340
3233
|
}, undefined, false, undefined, this),
|
|
3341
|
-
/* @__PURE__ */
|
|
3234
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("span", {
|
|
3342
3235
|
className: "truncate max-w-[180px]",
|
|
3343
3236
|
children: file.name
|
|
3344
3237
|
}, undefined, false, undefined, this),
|
|
3345
|
-
file.size && /* @__PURE__ */
|
|
3238
|
+
file.size && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("span", {
|
|
3346
3239
|
className: "text-muted-foreground/70",
|
|
3347
3240
|
children: [
|
|
3348
3241
|
"(",
|
|
@@ -3350,7 +3243,7 @@ function AgnoMessageItem({
|
|
|
3350
3243
|
"KB)"
|
|
3351
3244
|
]
|
|
3352
3245
|
}, undefined, true, undefined, this),
|
|
3353
|
-
file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */
|
|
3246
|
+
file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("a", {
|
|
3354
3247
|
href: file.url,
|
|
3355
3248
|
target: "_blank",
|
|
3356
3249
|
rel: "noopener noreferrer",
|
|
@@ -3362,19 +3255,19 @@ function AgnoMessageItem({
|
|
|
3362
3255
|
}, undefined, false, undefined, this)
|
|
3363
3256
|
]
|
|
3364
3257
|
}, undefined, true, undefined, this),
|
|
3365
|
-
message.response_audio && /* @__PURE__ */
|
|
3258
|
+
message.response_audio && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3366
3259
|
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3367
3260
|
children: [
|
|
3368
|
-
/* @__PURE__ */
|
|
3261
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3369
3262
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3370
3263
|
children: [
|
|
3371
|
-
/* @__PURE__ */
|
|
3264
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(import_lucide_react19.Music, {
|
|
3372
3265
|
className: "h-3.5 w-3.5"
|
|
3373
3266
|
}, undefined, false, undefined, this),
|
|
3374
3267
|
"Response Audio"
|
|
3375
3268
|
]
|
|
3376
3269
|
}, undefined, true, undefined, this),
|
|
3377
|
-
message.response_audio.transcript && /* @__PURE__ */
|
|
3270
|
+
message.response_audio.transcript && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3378
3271
|
className: "text-xs italic bg-muted/50 border border-border p-2.5 rounded-lg text-muted-foreground",
|
|
3379
3272
|
children: [
|
|
3380
3273
|
'"',
|
|
@@ -3382,7 +3275,7 @@ function AgnoMessageItem({
|
|
|
3382
3275
|
'"'
|
|
3383
3276
|
]
|
|
3384
3277
|
}, undefined, true, undefined, this),
|
|
3385
|
-
message.response_audio.content && /* @__PURE__ */
|
|
3278
|
+
message.response_audio.content && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("audio", {
|
|
3386
3279
|
src: `data:audio/wav;base64,${message.response_audio.content}`,
|
|
3387
3280
|
controls: true,
|
|
3388
3281
|
className: "w-full"
|
|
@@ -3392,22 +3285,22 @@ function AgnoMessageItem({
|
|
|
3392
3285
|
]
|
|
3393
3286
|
}, undefined, true, undefined, this);
|
|
3394
3287
|
})(),
|
|
3395
|
-
showToolCalls && message.tool_calls && message.tool_calls.length > 0 && /* @__PURE__ */
|
|
3396
|
-
className: cn("space-y-2 pt-1", classNames?.toolCalls),
|
|
3397
|
-
children: message.tool_calls.map((tool, idx) => renderToolCall ? renderToolCall(tool, idx) : /* @__PURE__ */
|
|
3288
|
+
showToolCalls && message.tool_calls && message.tool_calls.length > 0 && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3289
|
+
className: cn("space-y-2 pt-1", classNames?.assistant?.toolCalls),
|
|
3290
|
+
children: message.tool_calls.map((tool, idx) => renderToolCall ? renderToolCall(tool, idx) : /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(Tool, {
|
|
3398
3291
|
defaultOpen: idx === 0,
|
|
3399
3292
|
children: [
|
|
3400
|
-
/* @__PURE__ */
|
|
3293
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(ToolHeader, {
|
|
3401
3294
|
title: tool.tool_name,
|
|
3402
3295
|
type: "tool-use",
|
|
3403
3296
|
state: getToolState(tool)
|
|
3404
3297
|
}, undefined, false, undefined, this),
|
|
3405
|
-
/* @__PURE__ */
|
|
3298
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(ToolContent, {
|
|
3406
3299
|
children: [
|
|
3407
|
-
/* @__PURE__ */
|
|
3300
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(ToolInput, {
|
|
3408
3301
|
input: tool.tool_args
|
|
3409
3302
|
}, undefined, false, undefined, this),
|
|
3410
|
-
tool.content && /* @__PURE__ */
|
|
3303
|
+
tool.content && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(ToolOutput, {
|
|
3411
3304
|
output: tool.content,
|
|
3412
3305
|
errorText: tool.tool_call_error ? "Tool execution failed" : undefined
|
|
3413
3306
|
}, undefined, false, undefined, this)
|
|
@@ -3416,13 +3309,13 @@ function AgnoMessageItem({
|
|
|
3416
3309
|
]
|
|
3417
3310
|
}, tool.tool_call_id || idx, true, undefined, this))
|
|
3418
3311
|
}, undefined, false, undefined, this),
|
|
3419
|
-
showReferences && message.extra_data?.references && message.extra_data.references.length > 0 && /* @__PURE__ */
|
|
3420
|
-
className: cn("space-y-2 pt-1", classNames?.references),
|
|
3312
|
+
showReferences && message.extra_data?.references && message.extra_data.references.length > 0 && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3313
|
+
className: cn("space-y-2 pt-1", classNames?.assistant?.references),
|
|
3421
3314
|
children: [
|
|
3422
|
-
/* @__PURE__ */
|
|
3315
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3423
3316
|
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3424
3317
|
children: [
|
|
3425
|
-
/* @__PURE__ */
|
|
3318
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(import_lucide_react19.FileText, {
|
|
3426
3319
|
className: "h-3.5 w-3.5"
|
|
3427
3320
|
}, undefined, false, undefined, this),
|
|
3428
3321
|
"References (",
|
|
@@ -3430,22 +3323,22 @@ function AgnoMessageItem({
|
|
|
3430
3323
|
")"
|
|
3431
3324
|
]
|
|
3432
3325
|
}, undefined, true, undefined, this),
|
|
3433
|
-
/* @__PURE__ */
|
|
3326
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3434
3327
|
className: "space-y-2",
|
|
3435
|
-
children: message.extra_data.references.map((refData, idx) => /* @__PURE__ */
|
|
3328
|
+
children: message.extra_data.references.map((refData, idx) => /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3436
3329
|
className: "text-xs space-y-1.5",
|
|
3437
3330
|
children: [
|
|
3438
|
-
refData.query && /* @__PURE__ */
|
|
3331
|
+
refData.query && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3439
3332
|
className: "font-medium text-foreground",
|
|
3440
3333
|
children: [
|
|
3441
3334
|
"Query: ",
|
|
3442
3335
|
refData.query
|
|
3443
3336
|
]
|
|
3444
3337
|
}, undefined, true, undefined, this),
|
|
3445
|
-
refData.references.map((ref, refIdx) => /* @__PURE__ */
|
|
3338
|
+
refData.references.map((ref, refIdx) => /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3446
3339
|
className: "bg-muted/50 border border-border p-2.5 rounded-lg",
|
|
3447
3340
|
children: [
|
|
3448
|
-
/* @__PURE__ */
|
|
3341
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3449
3342
|
className: "italic text-muted-foreground mb-1",
|
|
3450
3343
|
children: [
|
|
3451
3344
|
'"',
|
|
@@ -3453,7 +3346,7 @@ function AgnoMessageItem({
|
|
|
3453
3346
|
'"'
|
|
3454
3347
|
]
|
|
3455
3348
|
}, undefined, true, undefined, this),
|
|
3456
|
-
/* @__PURE__ */
|
|
3349
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3457
3350
|
className: "text-muted-foreground/70",
|
|
3458
3351
|
children: [
|
|
3459
3352
|
"Source: ",
|
|
@@ -3474,23 +3367,29 @@ function AgnoMessageItem({
|
|
|
3474
3367
|
}, undefined, true, undefined, this)
|
|
3475
3368
|
]
|
|
3476
3369
|
}, undefined, true, undefined, this),
|
|
3477
|
-
(
|
|
3370
|
+
(actions?.assistant || showTimestamp || hasError) && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3478
3371
|
className: "flex items-center gap-2 pt-1",
|
|
3479
3372
|
children: [
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3373
|
+
actions?.assistant && (() => {
|
|
3374
|
+
const visibility = actions.visibility ?? "visible";
|
|
3375
|
+
if (visibility === "last-assistant" && !isLastAssistantMessage)
|
|
3376
|
+
return null;
|
|
3377
|
+
const useHover = visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage;
|
|
3378
|
+
return /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("div", {
|
|
3379
|
+
className: cn("flex items-center gap-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100", classNames?.assistant?.actions),
|
|
3380
|
+
children: actions.assistant(message)
|
|
3381
|
+
}, undefined, false, undefined, this);
|
|
3382
|
+
})(),
|
|
3383
|
+
hasError && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV("span", {
|
|
3485
3384
|
className: "flex items-center gap-1 text-[11px] text-destructive",
|
|
3486
3385
|
children: [
|
|
3487
|
-
/* @__PURE__ */
|
|
3386
|
+
/* @__PURE__ */ jsx_dev_runtime35.jsxDEV(import_lucide_react19.AlertCircle, {
|
|
3488
3387
|
className: "h-3 w-3"
|
|
3489
3388
|
}, undefined, false, undefined, this),
|
|
3490
3389
|
"Error"
|
|
3491
3390
|
]
|
|
3492
3391
|
}, undefined, true, undefined, this),
|
|
3493
|
-
showTimestamp && /* @__PURE__ */
|
|
3392
|
+
showTimestamp && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(SmartTimestamp, {
|
|
3494
3393
|
date: new Date(message.created_at * 1000),
|
|
3495
3394
|
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
3496
3395
|
className: "text-[11px] text-muted-foreground"
|
|
@@ -3501,7 +3400,7 @@ function AgnoMessageItem({
|
|
|
3501
3400
|
}, undefined, true, undefined, this)
|
|
3502
3401
|
]
|
|
3503
3402
|
}, undefined, true, undefined, this),
|
|
3504
|
-
preview?.type === "image" && /* @__PURE__ */
|
|
3403
|
+
preview?.type === "image" && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(ImageLightbox, {
|
|
3505
3404
|
open: true,
|
|
3506
3405
|
onOpenChange: (open) => {
|
|
3507
3406
|
if (!open)
|
|
@@ -3510,7 +3409,7 @@ function AgnoMessageItem({
|
|
|
3510
3409
|
images: preview.images,
|
|
3511
3410
|
initialIndex: preview.initialIndex
|
|
3512
3411
|
}, undefined, false, undefined, this),
|
|
3513
|
-
preview?.type === "file" && /* @__PURE__ */
|
|
3412
|
+
preview?.type === "file" && /* @__PURE__ */ jsx_dev_runtime35.jsxDEV(FilePreviewModal, {
|
|
3514
3413
|
open: true,
|
|
3515
3414
|
onOpenChange: (open) => {
|
|
3516
3415
|
if (!open)
|
|
@@ -3521,267 +3420,55 @@ function AgnoMessageItem({
|
|
|
3521
3420
|
]
|
|
3522
3421
|
}, undefined, true, undefined, this);
|
|
3523
3422
|
}
|
|
3524
|
-
|
|
3525
|
-
// src/ui/composed/agno-chat/suggested-prompts.tsx
|
|
3526
|
-
var jsx_dev_runtime37 = require("react/jsx-dev-runtime");
|
|
3527
|
-
function AgnoChatSuggestedPrompts({ className, prompts }) {
|
|
3528
|
-
const { handleSend } = useAgnoChatContext();
|
|
3529
|
-
if (prompts.length === 0)
|
|
3530
|
-
return null;
|
|
3531
|
-
return /* @__PURE__ */ jsx_dev_runtime37.jsxDEV("div", {
|
|
3532
|
-
className: cn("grid grid-cols-2 gap-2 w-full max-w-md", className),
|
|
3533
|
-
children: prompts.map((prompt, idx) => /* @__PURE__ */ jsx_dev_runtime37.jsxDEV("button", {
|
|
3534
|
-
onClick: () => handleSend(prompt.text),
|
|
3535
|
-
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",
|
|
3536
|
-
children: [
|
|
3537
|
-
prompt.icon && /* @__PURE__ */ jsx_dev_runtime37.jsxDEV("span", {
|
|
3538
|
-
className: "text-muted-foreground group-hover:text-primary transition-colors",
|
|
3539
|
-
children: prompt.icon
|
|
3540
|
-
}, undefined, false, undefined, this),
|
|
3541
|
-
/* @__PURE__ */ jsx_dev_runtime37.jsxDEV("span", {
|
|
3542
|
-
className: "text-muted-foreground group-hover:text-foreground transition-colors text-xs leading-snug",
|
|
3543
|
-
children: prompt.text
|
|
3544
|
-
}, undefined, false, undefined, this)
|
|
3545
|
-
]
|
|
3546
|
-
}, idx, true, undefined, this))
|
|
3547
|
-
}, undefined, false, undefined, this);
|
|
3548
|
-
}
|
|
3549
|
-
|
|
3550
|
-
// src/ui/composed/agno-chat/messages.tsx
|
|
3423
|
+
// src/ui/composed/AgnoChatInput.tsx
|
|
3551
3424
|
var import_lucide_react20 = require("lucide-react");
|
|
3552
|
-
var
|
|
3553
|
-
|
|
3554
|
-
|
|
3555
|
-
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
prevCount.current = messageCount;
|
|
3561
|
-
}, [messageCount, scrollToBottom]);
|
|
3562
|
-
return null;
|
|
3425
|
+
var jsx_dev_runtime36 = require("react/jsx-dev-runtime");
|
|
3426
|
+
var DEFAULT_ACCEPTED_FILE_TYPES = "image/*,audio/*,.pdf,.doc,.docx,.txt,.csv,.xlsx,.xls,.ppt,.pptx,.md,.json,.xml";
|
|
3427
|
+
function normalizeAudio(audio) {
|
|
3428
|
+
if (audio === true)
|
|
3429
|
+
return { enabled: true };
|
|
3430
|
+
if (!audio)
|
|
3431
|
+
return;
|
|
3432
|
+
return audio;
|
|
3563
3433
|
}
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
messageItemProps,
|
|
3574
|
-
emptyState,
|
|
3575
|
-
suggestedPrompts = DEFAULT_PROMPTS,
|
|
3576
|
-
children,
|
|
3577
|
-
showThinkingIndicator = true,
|
|
3578
|
-
renderThinkingIndicator
|
|
3579
|
-
}) {
|
|
3580
|
-
const { messages, isStreaming } = useAgnoChatContext();
|
|
3581
|
-
const lastMessage = messages[messages.length - 1];
|
|
3582
|
-
const isThinking = showThinkingIndicator && isStreaming && (!lastMessage || lastMessage.role !== "user") && !lastMessage?.content;
|
|
3583
|
-
const resolvedEmptyState = children ?? emptyState ?? /* @__PURE__ */ jsx_dev_runtime38.jsxDEV("div", {
|
|
3584
|
-
className: "flex flex-col items-center gap-6",
|
|
3585
|
-
children: [
|
|
3586
|
-
/* @__PURE__ */ jsx_dev_runtime38.jsxDEV("div", {
|
|
3587
|
-
className: "relative",
|
|
3588
|
-
children: [
|
|
3589
|
-
/* @__PURE__ */ jsx_dev_runtime38.jsxDEV("div", {
|
|
3590
|
-
className: "h-16 w-16 rounded-2xl bg-primary/10 flex items-center justify-center",
|
|
3591
|
-
children: /* @__PURE__ */ jsx_dev_runtime38.jsxDEV(import_lucide_react20.Bot, {
|
|
3592
|
-
className: "h-8 w-8 text-primary"
|
|
3593
|
-
}, undefined, false, undefined, this)
|
|
3594
|
-
}, undefined, false, undefined, this),
|
|
3595
|
-
/* @__PURE__ */ jsx_dev_runtime38.jsxDEV("div", {
|
|
3596
|
-
className: "absolute -bottom-1 -right-1 h-5 w-5 rounded-full bg-green-500 border-2 border-background flex items-center justify-center",
|
|
3597
|
-
children: /* @__PURE__ */ jsx_dev_runtime38.jsxDEV("span", {
|
|
3598
|
-
className: "h-2 w-2 rounded-full bg-white animate-pulse"
|
|
3599
|
-
}, undefined, false, undefined, this)
|
|
3600
|
-
}, undefined, false, undefined, this)
|
|
3601
|
-
]
|
|
3602
|
-
}, undefined, true, undefined, this),
|
|
3603
|
-
/* @__PURE__ */ jsx_dev_runtime38.jsxDEV("div", {
|
|
3604
|
-
className: "space-y-2 text-center",
|
|
3605
|
-
children: [
|
|
3606
|
-
/* @__PURE__ */ jsx_dev_runtime38.jsxDEV("h3", {
|
|
3607
|
-
className: "text-xl font-semibold tracking-tight",
|
|
3608
|
-
children: "Welcome to Agno Chat"
|
|
3609
|
-
}, undefined, false, undefined, this),
|
|
3610
|
-
/* @__PURE__ */ jsx_dev_runtime38.jsxDEV("p", {
|
|
3611
|
-
className: "text-muted-foreground text-sm max-w-sm",
|
|
3612
|
-
children: "Start a conversation with your AI agent. Ask questions, explore ideas, or run tools."
|
|
3613
|
-
}, undefined, false, undefined, this)
|
|
3614
|
-
]
|
|
3615
|
-
}, undefined, true, undefined, this),
|
|
3616
|
-
suggestedPrompts.length > 0 && /* @__PURE__ */ jsx_dev_runtime38.jsxDEV(AgnoChatSuggestedPrompts, {
|
|
3617
|
-
prompts: suggestedPrompts
|
|
3618
|
-
}, undefined, false, undefined, this)
|
|
3619
|
-
]
|
|
3620
|
-
}, undefined, true, undefined, this);
|
|
3621
|
-
return /* @__PURE__ */ jsx_dev_runtime38.jsxDEV(Conversation, {
|
|
3622
|
-
className: cn("relative flex-1 w-full", className),
|
|
3623
|
-
children: [
|
|
3624
|
-
/* @__PURE__ */ jsx_dev_runtime38.jsxDEV(ScrollOnNewUserMessage, {
|
|
3625
|
-
messageCount: messages.length
|
|
3626
|
-
}, undefined, false, undefined, this),
|
|
3627
|
-
/* @__PURE__ */ jsx_dev_runtime38.jsxDEV(ConversationContent, {
|
|
3628
|
-
className: "max-w-3xl mx-auto",
|
|
3629
|
-
children: [
|
|
3630
|
-
messages.length === 0 ? /* @__PURE__ */ jsx_dev_runtime38.jsxDEV(ConversationEmptyState, {
|
|
3631
|
-
children: resolvedEmptyState
|
|
3632
|
-
}, undefined, false, undefined, this) : messages.map((message, index) => {
|
|
3633
|
-
if (isThinking && index === messages.length - 1 && message === lastMessage)
|
|
3634
|
-
return null;
|
|
3635
|
-
return renderMessage ? renderMessage(message, index) : /* @__PURE__ */ jsx_dev_runtime38.jsxDEV(AgnoMessageItem, {
|
|
3636
|
-
message,
|
|
3637
|
-
userAvatar,
|
|
3638
|
-
assistantAvatar,
|
|
3639
|
-
...messageItemProps
|
|
3640
|
-
}, `msg-${index}-${message.created_at}`, false, undefined, this);
|
|
3641
|
-
}),
|
|
3642
|
-
isThinking && /* @__PURE__ */ jsx_dev_runtime38.jsxDEV("div", {
|
|
3643
|
-
className: "py-2",
|
|
3644
|
-
children: renderThinkingIndicator ?? /* @__PURE__ */ jsx_dev_runtime38.jsxDEV(StreamingIndicator, {
|
|
3645
|
-
avatar: assistantAvatar
|
|
3646
|
-
}, undefined, false, undefined, this)
|
|
3647
|
-
}, undefined, false, undefined, this)
|
|
3648
|
-
]
|
|
3649
|
-
}, undefined, true, undefined, this),
|
|
3650
|
-
/* @__PURE__ */ jsx_dev_runtime38.jsxDEV(ConversationScrollButton, {}, undefined, false, undefined, this)
|
|
3651
|
-
]
|
|
3652
|
-
}, undefined, true, undefined, this);
|
|
3434
|
+
function dataUrlToBlob(dataUrl) {
|
|
3435
|
+
const [header, base64] = dataUrl.split(",");
|
|
3436
|
+
const mime = header.match(/:(.*?);/)?.[1] || "application/octet-stream";
|
|
3437
|
+
const bytes = atob(base64);
|
|
3438
|
+
const buf = new Uint8Array(bytes.length);
|
|
3439
|
+
for (let i = 0;i < bytes.length; i++) {
|
|
3440
|
+
buf[i] = bytes.charCodeAt(i);
|
|
3441
|
+
}
|
|
3442
|
+
return new Blob([buf], { type: mime });
|
|
3653
3443
|
}
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
className:
|
|
3660
|
-
|
|
3661
|
-
|
|
3444
|
+
function CancelButton({ onCancel }) {
|
|
3445
|
+
return /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(Button, {
|
|
3446
|
+
type: "button",
|
|
3447
|
+
variant: "destructive",
|
|
3448
|
+
size: "icon",
|
|
3449
|
+
className: "h-8 w-8 rounded-lg",
|
|
3450
|
+
onClick: onCancel,
|
|
3451
|
+
"aria-label": "Stop",
|
|
3452
|
+
children: /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(import_lucide_react20.CircleStop, {
|
|
3453
|
+
className: "size-4"
|
|
3454
|
+
}, undefined, false, undefined, this)
|
|
3662
3455
|
}, undefined, false, undefined, this);
|
|
3663
3456
|
}
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3667
|
-
|
|
3668
|
-
|
|
3669
|
-
|
|
3670
|
-
|
|
3457
|
+
function SubmitButton({ disabled, status }) {
|
|
3458
|
+
const { textInput } = usePromptInputController();
|
|
3459
|
+
const hasText = textInput.value.trim().length > 0;
|
|
3460
|
+
return /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInputSubmit, {
|
|
3461
|
+
disabled: disabled || !hasText,
|
|
3462
|
+
status
|
|
3463
|
+
}, undefined, false, undefined, this);
|
|
3464
|
+
}
|
|
3465
|
+
function AttachmentHeader() {
|
|
3466
|
+
const { files } = usePromptInputAttachments();
|
|
3467
|
+
if (files.length === 0)
|
|
3671
3468
|
return null;
|
|
3672
|
-
return /* @__PURE__ */
|
|
3673
|
-
|
|
3674
|
-
|
|
3675
|
-
className: "flex items-center gap-2.5 text-sm max-w-3xl mx-auto",
|
|
3676
|
-
children: isExecuting ? /* @__PURE__ */ jsx_dev_runtime40.jsxDEV(jsx_dev_runtime40.Fragment, {
|
|
3677
|
-
children: [
|
|
3678
|
-
/* @__PURE__ */ jsx_dev_runtime40.jsxDEV("div", {
|
|
3679
|
-
className: "h-5 w-5 rounded-full bg-primary/10 flex items-center justify-center",
|
|
3680
|
-
children: /* @__PURE__ */ jsx_dev_runtime40.jsxDEV(import_lucide_react21.Loader2, {
|
|
3681
|
-
className: "h-3 w-3 animate-spin text-primary"
|
|
3682
|
-
}, undefined, false, undefined, this)
|
|
3683
|
-
}, undefined, false, undefined, this),
|
|
3684
|
-
/* @__PURE__ */ jsx_dev_runtime40.jsxDEV("span", {
|
|
3685
|
-
className: "text-muted-foreground",
|
|
3686
|
-
children: [
|
|
3687
|
-
"Executing",
|
|
3688
|
-
" ",
|
|
3689
|
-
/* @__PURE__ */ jsx_dev_runtime40.jsxDEV("span", {
|
|
3690
|
-
className: "font-medium text-foreground",
|
|
3691
|
-
children: pendingTools.length
|
|
3692
|
-
}, undefined, false, undefined, this),
|
|
3693
|
-
" tool",
|
|
3694
|
-
pendingTools.length !== 1 ? "s" : "",
|
|
3695
|
-
"..."
|
|
3696
|
-
]
|
|
3697
|
-
}, undefined, true, undefined, this)
|
|
3698
|
-
]
|
|
3699
|
-
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime40.jsxDEV(jsx_dev_runtime40.Fragment, {
|
|
3700
|
-
children: [
|
|
3701
|
-
/* @__PURE__ */ jsx_dev_runtime40.jsxDEV("div", {
|
|
3702
|
-
className: "h-5 w-5 rounded-full bg-amber-500/10 flex items-center justify-center",
|
|
3703
|
-
children: /* @__PURE__ */ jsx_dev_runtime40.jsxDEV(import_lucide_react21.Wrench, {
|
|
3704
|
-
className: "h-3 w-3 text-amber-600 dark:text-amber-400"
|
|
3705
|
-
}, undefined, false, undefined, this)
|
|
3706
|
-
}, undefined, false, undefined, this),
|
|
3707
|
-
/* @__PURE__ */ jsx_dev_runtime40.jsxDEV("span", {
|
|
3708
|
-
className: "text-muted-foreground",
|
|
3709
|
-
children: [
|
|
3710
|
-
"Preparing",
|
|
3711
|
-
" ",
|
|
3712
|
-
/* @__PURE__ */ jsx_dev_runtime40.jsxDEV("span", {
|
|
3713
|
-
className: "font-medium text-foreground",
|
|
3714
|
-
children: pendingTools.length
|
|
3715
|
-
}, undefined, false, undefined, this),
|
|
3716
|
-
" tool",
|
|
3717
|
-
pendingTools.length !== 1 ? "s" : "",
|
|
3718
|
-
"..."
|
|
3719
|
-
]
|
|
3720
|
-
}, undefined, true, undefined, this)
|
|
3721
|
-
]
|
|
3722
|
-
}, undefined, true, undefined, this)
|
|
3723
|
-
}, undefined, false, undefined, this)
|
|
3724
|
-
}, undefined, false, undefined, this);
|
|
3725
|
-
}
|
|
3726
|
-
|
|
3727
|
-
// src/ui/composed/agno-chat/error-bar.tsx
|
|
3728
|
-
var jsx_dev_runtime41 = require("react/jsx-dev-runtime");
|
|
3729
|
-
function AgnoChatErrorBar({ className }) {
|
|
3730
|
-
const { error, executionError } = useAgnoChatContext();
|
|
3731
|
-
const message = error || executionError;
|
|
3732
|
-
if (!message)
|
|
3733
|
-
return null;
|
|
3734
|
-
return /* @__PURE__ */ jsx_dev_runtime41.jsxDEV("div", {
|
|
3735
|
-
className: cn("px-4 py-2.5 bg-destructive/5 border-t border-destructive/20", className),
|
|
3736
|
-
children: /* @__PURE__ */ jsx_dev_runtime41.jsxDEV("p", {
|
|
3737
|
-
className: "text-sm text-destructive max-w-3xl mx-auto",
|
|
3738
|
-
children: message
|
|
3739
|
-
}, undefined, false, undefined, this)
|
|
3740
|
-
}, undefined, false, undefined, this);
|
|
3741
|
-
}
|
|
3742
|
-
|
|
3743
|
-
// src/ui/composed/AgnoChatInput.tsx
|
|
3744
|
-
var import_lucide_react22 = require("lucide-react");
|
|
3745
|
-
var jsx_dev_runtime42 = require("react/jsx-dev-runtime");
|
|
3746
|
-
var DEFAULT_ACCEPTED_FILE_TYPES = "image/*,audio/*,.pdf,.doc,.docx,.txt,.csv,.xlsx,.xls,.ppt,.pptx,.md,.json,.xml";
|
|
3747
|
-
function dataUrlToBlob(dataUrl) {
|
|
3748
|
-
const [header, base64] = dataUrl.split(",");
|
|
3749
|
-
const mime = header.match(/:(.*?);/)?.[1] || "application/octet-stream";
|
|
3750
|
-
const bytes = atob(base64);
|
|
3751
|
-
const buf = new Uint8Array(bytes.length);
|
|
3752
|
-
for (let i = 0;i < bytes.length; i++) {
|
|
3753
|
-
buf[i] = bytes.charCodeAt(i);
|
|
3754
|
-
}
|
|
3755
|
-
return new Blob([buf], { type: mime });
|
|
3756
|
-
}
|
|
3757
|
-
function CancelButton({ onCancel }) {
|
|
3758
|
-
return /* @__PURE__ */ jsx_dev_runtime42.jsxDEV(Button, {
|
|
3759
|
-
type: "button",
|
|
3760
|
-
variant: "destructive",
|
|
3761
|
-
size: "icon",
|
|
3762
|
-
className: "h-8 w-8 rounded-lg",
|
|
3763
|
-
onClick: onCancel,
|
|
3764
|
-
"aria-label": "Stop",
|
|
3765
|
-
children: /* @__PURE__ */ jsx_dev_runtime42.jsxDEV(import_lucide_react22.CircleStop, {
|
|
3766
|
-
className: "size-4"
|
|
3767
|
-
}, undefined, false, undefined, this)
|
|
3768
|
-
}, undefined, false, undefined, this);
|
|
3769
|
-
}
|
|
3770
|
-
function SubmitButton({ disabled, status }) {
|
|
3771
|
-
const { textInput } = usePromptInputController();
|
|
3772
|
-
const hasText = textInput.value.trim().length > 0;
|
|
3773
|
-
return /* @__PURE__ */ jsx_dev_runtime42.jsxDEV(PromptInputSubmit, {
|
|
3774
|
-
disabled: disabled || !hasText,
|
|
3775
|
-
status
|
|
3776
|
-
}, undefined, false, undefined, this);
|
|
3777
|
-
}
|
|
3778
|
-
function AttachmentHeader() {
|
|
3779
|
-
const { files } = usePromptInputAttachments();
|
|
3780
|
-
if (files.length === 0)
|
|
3781
|
-
return null;
|
|
3782
|
-
return /* @__PURE__ */ jsx_dev_runtime42.jsxDEV(PromptInputHeader, {
|
|
3783
|
-
children: /* @__PURE__ */ jsx_dev_runtime42.jsxDEV(PromptInputAttachments, {
|
|
3784
|
-
children: (attachment) => /* @__PURE__ */ jsx_dev_runtime42.jsxDEV(PromptInputAttachment, {
|
|
3469
|
+
return /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInputHeader, {
|
|
3470
|
+
children: /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInputAttachments, {
|
|
3471
|
+
children: (attachment) => /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInputAttachment, {
|
|
3785
3472
|
data: attachment
|
|
3786
3473
|
}, undefined, false, undefined, this)
|
|
3787
3474
|
}, undefined, false, undefined, this)
|
|
@@ -3796,7 +3483,7 @@ function TranscribeAudioRecorder({
|
|
|
3796
3483
|
labels
|
|
3797
3484
|
}) {
|
|
3798
3485
|
const { textInput } = usePromptInputController();
|
|
3799
|
-
return /* @__PURE__ */
|
|
3486
|
+
return /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(AudioRecorder, {
|
|
3800
3487
|
mode: "transcribe",
|
|
3801
3488
|
transcriptionEndpoint: endpoint,
|
|
3802
3489
|
transcriptionHeaders: headers,
|
|
@@ -3817,22 +3504,19 @@ function AgnoChatInput({
|
|
|
3817
3504
|
placeholder,
|
|
3818
3505
|
className,
|
|
3819
3506
|
fileUpload,
|
|
3820
|
-
|
|
3507
|
+
audio,
|
|
3821
3508
|
showAttachments = true,
|
|
3822
3509
|
status,
|
|
3823
3510
|
isStreaming,
|
|
3824
3511
|
onCancel,
|
|
3825
3512
|
allowCancelRun = false,
|
|
3826
3513
|
extraTools,
|
|
3827
|
-
audioMode = "send",
|
|
3828
|
-
transcriptionEndpoint,
|
|
3829
|
-
transcriptionHeaders,
|
|
3830
|
-
parseTranscriptionResponse,
|
|
3831
|
-
onRequestPermission,
|
|
3832
|
-
audioRecorderLabels,
|
|
3833
3514
|
dropZoneContainerRef,
|
|
3834
3515
|
dropZoneProps
|
|
3835
3516
|
}) {
|
|
3517
|
+
const resolvedAudio = normalizeAudio(audio);
|
|
3518
|
+
const audioEnabled = resolvedAudio?.enabled ?? false;
|
|
3519
|
+
const audioMode = resolvedAudio?.mode ?? "send";
|
|
3836
3520
|
const handleSubmit = (message) => {
|
|
3837
3521
|
const text = message.text?.trim() || "";
|
|
3838
3522
|
const files = message.files || [];
|
|
@@ -3863,8 +3547,8 @@ function AgnoChatInput({
|
|
|
3863
3547
|
};
|
|
3864
3548
|
const computedStatus = status ?? (disabled ? "submitted" : undefined);
|
|
3865
3549
|
const showCancelButton = allowCancelRun && isStreaming && onCancel;
|
|
3866
|
-
return /* @__PURE__ */
|
|
3867
|
-
children: /* @__PURE__ */
|
|
3550
|
+
return /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInputProvider, {
|
|
3551
|
+
children: /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInput, {
|
|
3868
3552
|
onSubmit: handleSubmit,
|
|
3869
3553
|
accept: fileUpload?.accept ?? DEFAULT_ACCEPTED_FILE_TYPES,
|
|
3870
3554
|
multiple: fileUpload?.multiple ?? true,
|
|
@@ -3874,52 +3558,52 @@ function AgnoChatInput({
|
|
|
3874
3558
|
dragListenerTarget: dropZoneContainerRef,
|
|
3875
3559
|
className: cn("w-full", className),
|
|
3876
3560
|
children: [
|
|
3877
|
-
/* @__PURE__ */
|
|
3878
|
-
/* @__PURE__ */
|
|
3879
|
-
children: /* @__PURE__ */
|
|
3561
|
+
/* @__PURE__ */ jsx_dev_runtime36.jsxDEV(AttachmentHeader, {}, undefined, false, undefined, this),
|
|
3562
|
+
/* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInputBody, {
|
|
3563
|
+
children: /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInputTextarea, {
|
|
3880
3564
|
placeholder: placeholder || "Type your message... (Enter to send, Shift+Enter for new line)",
|
|
3881
3565
|
disabled
|
|
3882
3566
|
}, undefined, false, undefined, this)
|
|
3883
3567
|
}, undefined, false, undefined, this),
|
|
3884
|
-
/* @__PURE__ */
|
|
3568
|
+
/* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInputFooter, {
|
|
3885
3569
|
children: [
|
|
3886
|
-
/* @__PURE__ */
|
|
3570
|
+
/* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInputTools, {
|
|
3887
3571
|
children: [
|
|
3888
|
-
showAttachments && /* @__PURE__ */
|
|
3572
|
+
showAttachments && /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInputActionMenu, {
|
|
3889
3573
|
children: [
|
|
3890
|
-
/* @__PURE__ */
|
|
3891
|
-
/* @__PURE__ */
|
|
3892
|
-
children: /* @__PURE__ */
|
|
3574
|
+
/* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInputActionMenuTrigger, {}, undefined, false, undefined, this),
|
|
3575
|
+
/* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInputActionMenuContent, {
|
|
3576
|
+
children: /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInputActionAddAttachments, {
|
|
3893
3577
|
label: "Add files"
|
|
3894
3578
|
}, undefined, false, undefined, this)
|
|
3895
3579
|
}, undefined, false, undefined, this)
|
|
3896
3580
|
]
|
|
3897
3581
|
}, undefined, true, undefined, this),
|
|
3898
|
-
|
|
3899
|
-
endpoint:
|
|
3900
|
-
headers:
|
|
3582
|
+
audioEnabled && (audioMode === "transcribe" && resolvedAudio?.endpoint ? /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(TranscribeAudioRecorder, {
|
|
3583
|
+
endpoint: resolvedAudio.endpoint,
|
|
3584
|
+
headers: resolvedAudio.headers,
|
|
3901
3585
|
disabled,
|
|
3902
|
-
parseResponse:
|
|
3903
|
-
onRequestPermission,
|
|
3904
|
-
labels:
|
|
3905
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
3586
|
+
parseResponse: resolvedAudio.parseResponse,
|
|
3587
|
+
onRequestPermission: resolvedAudio.requestPermission,
|
|
3588
|
+
labels: resolvedAudio.labels
|
|
3589
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(AudioRecorder, {
|
|
3906
3590
|
onRecordingComplete: handleAudioRecording,
|
|
3907
3591
|
disabled,
|
|
3908
|
-
onRequestPermission,
|
|
3909
|
-
labels:
|
|
3592
|
+
onRequestPermission: resolvedAudio?.requestPermission,
|
|
3593
|
+
labels: resolvedAudio?.labels
|
|
3910
3594
|
}, undefined, false, undefined, this)),
|
|
3911
3595
|
extraTools
|
|
3912
3596
|
]
|
|
3913
3597
|
}, undefined, true, undefined, this),
|
|
3914
|
-
showCancelButton ? /* @__PURE__ */
|
|
3598
|
+
showCancelButton ? /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(CancelButton, {
|
|
3915
3599
|
onCancel
|
|
3916
|
-
}, undefined, false, undefined, this) : /* @__PURE__ */
|
|
3600
|
+
}, undefined, false, undefined, this) : /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(SubmitButton, {
|
|
3917
3601
|
disabled,
|
|
3918
3602
|
status: computedStatus
|
|
3919
3603
|
}, undefined, false, undefined, this)
|
|
3920
3604
|
]
|
|
3921
3605
|
}, undefined, true, undefined, this),
|
|
3922
|
-
showAttachments && /* @__PURE__ */
|
|
3606
|
+
showAttachments && /* @__PURE__ */ jsx_dev_runtime36.jsxDEV(PromptInputDropZone, {
|
|
3923
3607
|
...dropZoneProps,
|
|
3924
3608
|
container: dropZoneContainerRef
|
|
3925
3609
|
}, undefined, false, undefined, this)
|
|
@@ -3927,6 +3611,437 @@ function AgnoChatInput({
|
|
|
3927
3611
|
}, undefined, true, undefined, this)
|
|
3928
3612
|
}, undefined, false, undefined, this);
|
|
3929
3613
|
}
|
|
3614
|
+
// src/ui/composed/agno-chat/agno-chat.tsx
|
|
3615
|
+
var import_react16 = require("react");
|
|
3616
|
+
var import_agno_react2 = require("@rodrigocoliveira/agno-react");
|
|
3617
|
+
|
|
3618
|
+
// src/ui/composed/agno-chat/context.ts
|
|
3619
|
+
var import_react15 = require("react");
|
|
3620
|
+
var AgnoChatContext = import_react15.createContext(null);
|
|
3621
|
+
function useAgnoChatContext() {
|
|
3622
|
+
const ctx = import_react15.useContext(AgnoChatContext);
|
|
3623
|
+
if (!ctx) {
|
|
3624
|
+
throw new Error("useAgnoChatContext must be used within an <AgnoChat> provider. " + "Wrap your component tree with <AgnoChat>.");
|
|
3625
|
+
}
|
|
3626
|
+
return ctx;
|
|
3627
|
+
}
|
|
3628
|
+
|
|
3629
|
+
// src/ui/composed/agno-chat/agno-chat.tsx
|
|
3630
|
+
var jsx_dev_runtime37 = require("react/jsx-dev-runtime");
|
|
3631
|
+
function AgnoChatRoot({
|
|
3632
|
+
children,
|
|
3633
|
+
toolHandlers = {},
|
|
3634
|
+
autoExecuteTools = true,
|
|
3635
|
+
className,
|
|
3636
|
+
...divProps
|
|
3637
|
+
}) {
|
|
3638
|
+
const chat = import_agno_react2.useAgnoChat();
|
|
3639
|
+
const toolExec = import_agno_react2.useAgnoToolExecution(toolHandlers, autoExecuteTools);
|
|
3640
|
+
const containerRef = import_react16.useRef(null);
|
|
3641
|
+
const sendRef = import_react16.useRef(chat.sendMessage);
|
|
3642
|
+
sendRef.current = chat.sendMessage;
|
|
3643
|
+
const handleSend = import_react16.useCallback(async (message) => {
|
|
3644
|
+
try {
|
|
3645
|
+
await sendRef.current(message);
|
|
3646
|
+
} catch {}
|
|
3647
|
+
}, []);
|
|
3648
|
+
const {
|
|
3649
|
+
messages,
|
|
3650
|
+
sendMessage,
|
|
3651
|
+
clearMessages,
|
|
3652
|
+
cancelRun,
|
|
3653
|
+
isStreaming,
|
|
3654
|
+
isRefreshing,
|
|
3655
|
+
isCancelling,
|
|
3656
|
+
currentRunId,
|
|
3657
|
+
error,
|
|
3658
|
+
state
|
|
3659
|
+
} = chat;
|
|
3660
|
+
const {
|
|
3661
|
+
isPaused,
|
|
3662
|
+
isExecuting,
|
|
3663
|
+
pendingTools,
|
|
3664
|
+
executeAndContinue,
|
|
3665
|
+
executeTools,
|
|
3666
|
+
continueWithResults,
|
|
3667
|
+
executionError
|
|
3668
|
+
} = toolExec;
|
|
3669
|
+
const contextValue = import_react16.useMemo(() => ({
|
|
3670
|
+
messages,
|
|
3671
|
+
sendMessage,
|
|
3672
|
+
clearMessages,
|
|
3673
|
+
cancelRun,
|
|
3674
|
+
isStreaming,
|
|
3675
|
+
isRefreshing,
|
|
3676
|
+
isCancelling: isCancelling ?? false,
|
|
3677
|
+
currentRunId,
|
|
3678
|
+
error,
|
|
3679
|
+
state,
|
|
3680
|
+
isPaused,
|
|
3681
|
+
isExecuting,
|
|
3682
|
+
pendingTools,
|
|
3683
|
+
executeAndContinue,
|
|
3684
|
+
executeTools,
|
|
3685
|
+
continueWithResults,
|
|
3686
|
+
executionError,
|
|
3687
|
+
handleSend,
|
|
3688
|
+
inputDisabled: isStreaming || isPaused,
|
|
3689
|
+
dropZoneContainerRef: containerRef
|
|
3690
|
+
}), [
|
|
3691
|
+
messages,
|
|
3692
|
+
sendMessage,
|
|
3693
|
+
clearMessages,
|
|
3694
|
+
cancelRun,
|
|
3695
|
+
isStreaming,
|
|
3696
|
+
isRefreshing,
|
|
3697
|
+
isCancelling,
|
|
3698
|
+
currentRunId,
|
|
3699
|
+
error,
|
|
3700
|
+
state,
|
|
3701
|
+
isPaused,
|
|
3702
|
+
isExecuting,
|
|
3703
|
+
pendingTools,
|
|
3704
|
+
executeAndContinue,
|
|
3705
|
+
executeTools,
|
|
3706
|
+
continueWithResults,
|
|
3707
|
+
executionError,
|
|
3708
|
+
handleSend
|
|
3709
|
+
]);
|
|
3710
|
+
return /* @__PURE__ */ jsx_dev_runtime37.jsxDEV(AgnoChatContext.Provider, {
|
|
3711
|
+
value: contextValue,
|
|
3712
|
+
children: /* @__PURE__ */ jsx_dev_runtime37.jsxDEV("div", {
|
|
3713
|
+
ref: containerRef,
|
|
3714
|
+
className: cn("relative h-full flex flex-col", className),
|
|
3715
|
+
...divProps,
|
|
3716
|
+
children
|
|
3717
|
+
}, undefined, false, undefined, this)
|
|
3718
|
+
}, undefined, false, undefined, this);
|
|
3719
|
+
}
|
|
3720
|
+
|
|
3721
|
+
// src/ui/composed/agno-chat/messages.tsx
|
|
3722
|
+
var import_react17 = require("react");
|
|
3723
|
+
|
|
3724
|
+
// src/ui/composed/agno-chat/suggested-prompts.tsx
|
|
3725
|
+
var jsx_dev_runtime38 = require("react/jsx-dev-runtime");
|
|
3726
|
+
function AgnoChatSuggestedPrompts({ className, prompts }) {
|
|
3727
|
+
const { handleSend } = useAgnoChatContext();
|
|
3728
|
+
if (prompts.length === 0)
|
|
3729
|
+
return null;
|
|
3730
|
+
return /* @__PURE__ */ jsx_dev_runtime38.jsxDEV("div", {
|
|
3731
|
+
className: cn("grid grid-cols-2 gap-2 w-full max-w-md", className),
|
|
3732
|
+
children: prompts.map((prompt, idx) => /* @__PURE__ */ jsx_dev_runtime38.jsxDEV("button", {
|
|
3733
|
+
onClick: () => handleSend(prompt.text),
|
|
3734
|
+
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",
|
|
3735
|
+
children: [
|
|
3736
|
+
prompt.icon && /* @__PURE__ */ jsx_dev_runtime38.jsxDEV("span", {
|
|
3737
|
+
className: "text-muted-foreground group-hover:text-primary transition-colors",
|
|
3738
|
+
children: prompt.icon
|
|
3739
|
+
}, undefined, false, undefined, this),
|
|
3740
|
+
/* @__PURE__ */ jsx_dev_runtime38.jsxDEV("span", {
|
|
3741
|
+
className: "text-muted-foreground group-hover:text-foreground transition-colors text-xs leading-snug",
|
|
3742
|
+
children: prompt.text
|
|
3743
|
+
}, undefined, false, undefined, this)
|
|
3744
|
+
]
|
|
3745
|
+
}, idx, true, undefined, this))
|
|
3746
|
+
}, undefined, false, undefined, this);
|
|
3747
|
+
}
|
|
3748
|
+
|
|
3749
|
+
// src/ui/composed/agno-chat/messages.tsx
|
|
3750
|
+
var import_lucide_react21 = require("lucide-react");
|
|
3751
|
+
var jsx_dev_runtime39 = require("react/jsx-dev-runtime");
|
|
3752
|
+
function ScrollOnNewUserMessage({ messageCount }) {
|
|
3753
|
+
const { scrollToBottom } = import_use_stick_to_bottom2.useStickToBottomContext();
|
|
3754
|
+
const prevCount = import_react17.useRef(messageCount);
|
|
3755
|
+
import_react17.useEffect(() => {
|
|
3756
|
+
if (messageCount > prevCount.current) {
|
|
3757
|
+
scrollToBottom("smooth");
|
|
3758
|
+
}
|
|
3759
|
+
prevCount.current = messageCount;
|
|
3760
|
+
}, [messageCount, scrollToBottom]);
|
|
3761
|
+
return null;
|
|
3762
|
+
}
|
|
3763
|
+
var DEFAULT_PROMPTS = [
|
|
3764
|
+
{ text: "What can you help me with?" },
|
|
3765
|
+
{ text: "Explain how you work" }
|
|
3766
|
+
];
|
|
3767
|
+
function AgnoChatMessages({
|
|
3768
|
+
className,
|
|
3769
|
+
renderMessage,
|
|
3770
|
+
avatars,
|
|
3771
|
+
actions,
|
|
3772
|
+
showReasoning,
|
|
3773
|
+
showReferences,
|
|
3774
|
+
showTimestamp,
|
|
3775
|
+
showGenerativeUI,
|
|
3776
|
+
showToolCalls,
|
|
3777
|
+
showFilePreview,
|
|
3778
|
+
showImageLightbox,
|
|
3779
|
+
renderToolCall,
|
|
3780
|
+
renderContent,
|
|
3781
|
+
renderMedia,
|
|
3782
|
+
formatTimestamp,
|
|
3783
|
+
messageClassNames,
|
|
3784
|
+
emptyState,
|
|
3785
|
+
suggestedPrompts = DEFAULT_PROMPTS,
|
|
3786
|
+
children,
|
|
3787
|
+
showThinkingIndicator = true,
|
|
3788
|
+
renderThinkingIndicator
|
|
3789
|
+
}) {
|
|
3790
|
+
const { messages, isStreaming } = useAgnoChatContext();
|
|
3791
|
+
const lastMessage = messages[messages.length - 1];
|
|
3792
|
+
const isThinking = showThinkingIndicator && isStreaming && (!lastMessage || lastMessage.role !== "user") && !lastMessage?.content;
|
|
3793
|
+
let lastAssistantIndex = -1;
|
|
3794
|
+
for (let i = messages.length - 1;i >= 0; i--) {
|
|
3795
|
+
if (messages[i].role !== "user") {
|
|
3796
|
+
lastAssistantIndex = i;
|
|
3797
|
+
break;
|
|
3798
|
+
}
|
|
3799
|
+
}
|
|
3800
|
+
const messageItemProps = {
|
|
3801
|
+
...showReasoning !== undefined && { showReasoning },
|
|
3802
|
+
...showReferences !== undefined && { showReferences },
|
|
3803
|
+
...showTimestamp !== undefined && { showTimestamp },
|
|
3804
|
+
...showGenerativeUI !== undefined && { showGenerativeUI },
|
|
3805
|
+
...showToolCalls !== undefined && { showToolCalls },
|
|
3806
|
+
...showFilePreview !== undefined && { showFilePreview },
|
|
3807
|
+
...showImageLightbox !== undefined && { showImageLightbox },
|
|
3808
|
+
...renderToolCall !== undefined && { renderToolCall },
|
|
3809
|
+
...renderContent !== undefined && { renderContent },
|
|
3810
|
+
...renderMedia !== undefined && { renderMedia },
|
|
3811
|
+
...formatTimestamp !== undefined && { formatTimestamp },
|
|
3812
|
+
...messageClassNames !== undefined && { classNames: messageClassNames }
|
|
3813
|
+
};
|
|
3814
|
+
const resolvedEmptyState = children ?? emptyState ?? /* @__PURE__ */ jsx_dev_runtime39.jsxDEV("div", {
|
|
3815
|
+
className: "flex flex-col items-center gap-6",
|
|
3816
|
+
children: [
|
|
3817
|
+
/* @__PURE__ */ jsx_dev_runtime39.jsxDEV("div", {
|
|
3818
|
+
className: "relative",
|
|
3819
|
+
children: [
|
|
3820
|
+
/* @__PURE__ */ jsx_dev_runtime39.jsxDEV("div", {
|
|
3821
|
+
className: "h-16 w-16 rounded-2xl bg-primary/10 flex items-center justify-center",
|
|
3822
|
+
children: /* @__PURE__ */ jsx_dev_runtime39.jsxDEV(import_lucide_react21.Bot, {
|
|
3823
|
+
className: "h-8 w-8 text-primary"
|
|
3824
|
+
}, undefined, false, undefined, this)
|
|
3825
|
+
}, undefined, false, undefined, this),
|
|
3826
|
+
/* @__PURE__ */ jsx_dev_runtime39.jsxDEV("div", {
|
|
3827
|
+
className: "absolute -bottom-1 -right-1 h-5 w-5 rounded-full bg-green-500 border-2 border-background flex items-center justify-center",
|
|
3828
|
+
children: /* @__PURE__ */ jsx_dev_runtime39.jsxDEV("span", {
|
|
3829
|
+
className: "h-2 w-2 rounded-full bg-white animate-pulse"
|
|
3830
|
+
}, undefined, false, undefined, this)
|
|
3831
|
+
}, undefined, false, undefined, this)
|
|
3832
|
+
]
|
|
3833
|
+
}, undefined, true, undefined, this),
|
|
3834
|
+
/* @__PURE__ */ jsx_dev_runtime39.jsxDEV("div", {
|
|
3835
|
+
className: "space-y-2 text-center",
|
|
3836
|
+
children: [
|
|
3837
|
+
/* @__PURE__ */ jsx_dev_runtime39.jsxDEV("h3", {
|
|
3838
|
+
className: "text-xl font-semibold tracking-tight",
|
|
3839
|
+
children: "Welcome to Agno Chat"
|
|
3840
|
+
}, undefined, false, undefined, this),
|
|
3841
|
+
/* @__PURE__ */ jsx_dev_runtime39.jsxDEV("p", {
|
|
3842
|
+
className: "text-muted-foreground text-sm max-w-sm",
|
|
3843
|
+
children: "Start a conversation with your AI agent. Ask questions, explore ideas, or run tools."
|
|
3844
|
+
}, undefined, false, undefined, this)
|
|
3845
|
+
]
|
|
3846
|
+
}, undefined, true, undefined, this),
|
|
3847
|
+
suggestedPrompts.length > 0 && /* @__PURE__ */ jsx_dev_runtime39.jsxDEV(AgnoChatSuggestedPrompts, {
|
|
3848
|
+
prompts: suggestedPrompts
|
|
3849
|
+
}, undefined, false, undefined, this)
|
|
3850
|
+
]
|
|
3851
|
+
}, undefined, true, undefined, this);
|
|
3852
|
+
return /* @__PURE__ */ jsx_dev_runtime39.jsxDEV(Conversation, {
|
|
3853
|
+
className: cn("relative flex-1 w-full", className),
|
|
3854
|
+
children: [
|
|
3855
|
+
/* @__PURE__ */ jsx_dev_runtime39.jsxDEV(ScrollOnNewUserMessage, {
|
|
3856
|
+
messageCount: messages.length
|
|
3857
|
+
}, undefined, false, undefined, this),
|
|
3858
|
+
/* @__PURE__ */ jsx_dev_runtime39.jsxDEV(ConversationContent, {
|
|
3859
|
+
className: "max-w-3xl mx-auto",
|
|
3860
|
+
children: [
|
|
3861
|
+
messages.length === 0 ? /* @__PURE__ */ jsx_dev_runtime39.jsxDEV(ConversationEmptyState, {
|
|
3862
|
+
children: resolvedEmptyState
|
|
3863
|
+
}, undefined, false, undefined, this) : messages.map((message, index) => {
|
|
3864
|
+
if (isThinking && index === messages.length - 1 && message === lastMessage)
|
|
3865
|
+
return null;
|
|
3866
|
+
return renderMessage ? renderMessage(message, index) : /* @__PURE__ */ jsx_dev_runtime39.jsxDEV(AgnoMessageItem, {
|
|
3867
|
+
message,
|
|
3868
|
+
avatars,
|
|
3869
|
+
actions,
|
|
3870
|
+
isLastAssistantMessage: index === lastAssistantIndex,
|
|
3871
|
+
...messageItemProps
|
|
3872
|
+
}, `msg-${index}-${message.created_at}`, false, undefined, this);
|
|
3873
|
+
}),
|
|
3874
|
+
isThinking && /* @__PURE__ */ jsx_dev_runtime39.jsxDEV("div", {
|
|
3875
|
+
className: "py-2",
|
|
3876
|
+
children: renderThinkingIndicator ?? /* @__PURE__ */ jsx_dev_runtime39.jsxDEV(StreamingIndicator, {
|
|
3877
|
+
avatar: avatars?.assistant
|
|
3878
|
+
}, undefined, false, undefined, this)
|
|
3879
|
+
}, undefined, false, undefined, this)
|
|
3880
|
+
]
|
|
3881
|
+
}, undefined, true, undefined, this),
|
|
3882
|
+
/* @__PURE__ */ jsx_dev_runtime39.jsxDEV(ConversationScrollButton, {}, undefined, false, undefined, this)
|
|
3883
|
+
]
|
|
3884
|
+
}, undefined, true, undefined, this);
|
|
3885
|
+
}
|
|
3886
|
+
|
|
3887
|
+
// src/ui/composed/agno-chat/empty-state.tsx
|
|
3888
|
+
var jsx_dev_runtime40 = require("react/jsx-dev-runtime");
|
|
3889
|
+
function AgnoChatEmptyState({ children, className, ...props }) {
|
|
3890
|
+
return /* @__PURE__ */ jsx_dev_runtime40.jsxDEV("div", {
|
|
3891
|
+
className: cn("flex flex-col items-center gap-6", className),
|
|
3892
|
+
...props,
|
|
3893
|
+
children
|
|
3894
|
+
}, undefined, false, undefined, this);
|
|
3895
|
+
}
|
|
3896
|
+
|
|
3897
|
+
// src/ui/composed/agno-chat/tool-status.tsx
|
|
3898
|
+
var import_lucide_react22 = require("lucide-react");
|
|
3899
|
+
var jsx_dev_runtime41 = require("react/jsx-dev-runtime");
|
|
3900
|
+
function AgnoChatToolStatus({ className }) {
|
|
3901
|
+
const { isPaused, isExecuting, pendingTools } = useAgnoChatContext();
|
|
3902
|
+
if (!isPaused && !isExecuting)
|
|
3903
|
+
return null;
|
|
3904
|
+
return /* @__PURE__ */ jsx_dev_runtime41.jsxDEV("div", {
|
|
3905
|
+
className: cn("px-4 py-2.5 border-t border-border bg-primary/5", className),
|
|
3906
|
+
children: /* @__PURE__ */ jsx_dev_runtime41.jsxDEV("div", {
|
|
3907
|
+
className: "flex items-center gap-2.5 text-sm max-w-3xl mx-auto",
|
|
3908
|
+
children: isExecuting ? /* @__PURE__ */ jsx_dev_runtime41.jsxDEV(jsx_dev_runtime41.Fragment, {
|
|
3909
|
+
children: [
|
|
3910
|
+
/* @__PURE__ */ jsx_dev_runtime41.jsxDEV("div", {
|
|
3911
|
+
className: "h-5 w-5 rounded-full bg-primary/10 flex items-center justify-center",
|
|
3912
|
+
children: /* @__PURE__ */ jsx_dev_runtime41.jsxDEV(import_lucide_react22.Loader2, {
|
|
3913
|
+
className: "h-3 w-3 animate-spin text-primary"
|
|
3914
|
+
}, undefined, false, undefined, this)
|
|
3915
|
+
}, undefined, false, undefined, this),
|
|
3916
|
+
/* @__PURE__ */ jsx_dev_runtime41.jsxDEV("span", {
|
|
3917
|
+
className: "text-muted-foreground",
|
|
3918
|
+
children: [
|
|
3919
|
+
"Executing",
|
|
3920
|
+
" ",
|
|
3921
|
+
/* @__PURE__ */ jsx_dev_runtime41.jsxDEV("span", {
|
|
3922
|
+
className: "font-medium text-foreground",
|
|
3923
|
+
children: pendingTools.length
|
|
3924
|
+
}, undefined, false, undefined, this),
|
|
3925
|
+
" tool",
|
|
3926
|
+
pendingTools.length !== 1 ? "s" : "",
|
|
3927
|
+
"..."
|
|
3928
|
+
]
|
|
3929
|
+
}, undefined, true, undefined, this)
|
|
3930
|
+
]
|
|
3931
|
+
}, undefined, true, undefined, this) : /* @__PURE__ */ jsx_dev_runtime41.jsxDEV(jsx_dev_runtime41.Fragment, {
|
|
3932
|
+
children: [
|
|
3933
|
+
/* @__PURE__ */ jsx_dev_runtime41.jsxDEV("div", {
|
|
3934
|
+
className: "h-5 w-5 rounded-full bg-amber-500/10 flex items-center justify-center",
|
|
3935
|
+
children: /* @__PURE__ */ jsx_dev_runtime41.jsxDEV(import_lucide_react22.Wrench, {
|
|
3936
|
+
className: "h-3 w-3 text-amber-600 dark:text-amber-400"
|
|
3937
|
+
}, undefined, false, undefined, this)
|
|
3938
|
+
}, undefined, false, undefined, this),
|
|
3939
|
+
/* @__PURE__ */ jsx_dev_runtime41.jsxDEV("span", {
|
|
3940
|
+
className: "text-muted-foreground",
|
|
3941
|
+
children: [
|
|
3942
|
+
"Preparing",
|
|
3943
|
+
" ",
|
|
3944
|
+
/* @__PURE__ */ jsx_dev_runtime41.jsxDEV("span", {
|
|
3945
|
+
className: "font-medium text-foreground",
|
|
3946
|
+
children: pendingTools.length
|
|
3947
|
+
}, undefined, false, undefined, this),
|
|
3948
|
+
" tool",
|
|
3949
|
+
pendingTools.length !== 1 ? "s" : "",
|
|
3950
|
+
"..."
|
|
3951
|
+
]
|
|
3952
|
+
}, undefined, true, undefined, this)
|
|
3953
|
+
]
|
|
3954
|
+
}, undefined, true, undefined, this)
|
|
3955
|
+
}, undefined, false, undefined, this)
|
|
3956
|
+
}, undefined, false, undefined, this);
|
|
3957
|
+
}
|
|
3958
|
+
|
|
3959
|
+
// src/ui/composed/agno-chat/error-bar.tsx
|
|
3960
|
+
var import_react18 = require("react");
|
|
3961
|
+
var jsx_dev_runtime42 = require("react/jsx-dev-runtime");
|
|
3962
|
+
function AgnoChatErrorBar({
|
|
3963
|
+
className,
|
|
3964
|
+
text,
|
|
3965
|
+
icon,
|
|
3966
|
+
dismissible = false,
|
|
3967
|
+
timeout = 1e4,
|
|
3968
|
+
children
|
|
3969
|
+
}) {
|
|
3970
|
+
const { error, executionError } = useAgnoChatContext();
|
|
3971
|
+
const [hidden, setHidden] = import_react18.useState(false);
|
|
3972
|
+
const timerRef = import_react18.useRef(null);
|
|
3973
|
+
const rawMessage = error || executionError;
|
|
3974
|
+
import_react18.useEffect(() => {
|
|
3975
|
+
if (!rawMessage)
|
|
3976
|
+
return;
|
|
3977
|
+
setHidden(false);
|
|
3978
|
+
if (timerRef.current) {
|
|
3979
|
+
clearTimeout(timerRef.current);
|
|
3980
|
+
timerRef.current = null;
|
|
3981
|
+
}
|
|
3982
|
+
if (timeout > 0) {
|
|
3983
|
+
timerRef.current = setTimeout(() => {
|
|
3984
|
+
setHidden(true);
|
|
3985
|
+
}, timeout);
|
|
3986
|
+
}
|
|
3987
|
+
return () => {
|
|
3988
|
+
if (timerRef.current) {
|
|
3989
|
+
clearTimeout(timerRef.current);
|
|
3990
|
+
timerRef.current = null;
|
|
3991
|
+
}
|
|
3992
|
+
};
|
|
3993
|
+
}, [rawMessage, timeout]);
|
|
3994
|
+
if (!rawMessage || hidden)
|
|
3995
|
+
return null;
|
|
3996
|
+
const displayMessage = text ?? rawMessage;
|
|
3997
|
+
const renderContent = () => {
|
|
3998
|
+
if (children) {
|
|
3999
|
+
return typeof children === "function" ? children(rawMessage) : children;
|
|
4000
|
+
}
|
|
4001
|
+
return /* @__PURE__ */ jsx_dev_runtime42.jsxDEV("div", {
|
|
4002
|
+
className: "flex items-center gap-2 max-w-3xl mx-auto",
|
|
4003
|
+
children: [
|
|
4004
|
+
icon && /* @__PURE__ */ jsx_dev_runtime42.jsxDEV("span", {
|
|
4005
|
+
className: "shrink-0",
|
|
4006
|
+
children: icon
|
|
4007
|
+
}, undefined, false, undefined, this),
|
|
4008
|
+
/* @__PURE__ */ jsx_dev_runtime42.jsxDEV("p", {
|
|
4009
|
+
className: "text-sm text-destructive flex-1",
|
|
4010
|
+
children: displayMessage
|
|
4011
|
+
}, undefined, false, undefined, this),
|
|
4012
|
+
dismissible && /* @__PURE__ */ jsx_dev_runtime42.jsxDEV("button", {
|
|
4013
|
+
type: "button",
|
|
4014
|
+
onClick: () => setHidden(true),
|
|
4015
|
+
className: "shrink-0 text-destructive/60 hover:text-destructive transition-colors",
|
|
4016
|
+
"aria-label": "Dismiss error",
|
|
4017
|
+
children: /* @__PURE__ */ jsx_dev_runtime42.jsxDEV("svg", {
|
|
4018
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4019
|
+
width: "16",
|
|
4020
|
+
height: "16",
|
|
4021
|
+
viewBox: "0 0 24 24",
|
|
4022
|
+
fill: "none",
|
|
4023
|
+
stroke: "currentColor",
|
|
4024
|
+
strokeWidth: "2",
|
|
4025
|
+
strokeLinecap: "round",
|
|
4026
|
+
strokeLinejoin: "round",
|
|
4027
|
+
children: [
|
|
4028
|
+
/* @__PURE__ */ jsx_dev_runtime42.jsxDEV("path", {
|
|
4029
|
+
d: "M18 6 6 18"
|
|
4030
|
+
}, undefined, false, undefined, this),
|
|
4031
|
+
/* @__PURE__ */ jsx_dev_runtime42.jsxDEV("path", {
|
|
4032
|
+
d: "m6 6 12 12"
|
|
4033
|
+
}, undefined, false, undefined, this)
|
|
4034
|
+
]
|
|
4035
|
+
}, undefined, true, undefined, this)
|
|
4036
|
+
}, undefined, false, undefined, this)
|
|
4037
|
+
]
|
|
4038
|
+
}, undefined, true, undefined, this);
|
|
4039
|
+
};
|
|
4040
|
+
return /* @__PURE__ */ jsx_dev_runtime42.jsxDEV("div", {
|
|
4041
|
+
className: cn("px-4 py-2.5 bg-destructive/5 border-t border-destructive/20", className),
|
|
4042
|
+
children: renderContent()
|
|
4043
|
+
}, undefined, false, undefined, this);
|
|
4044
|
+
}
|
|
3930
4045
|
|
|
3931
4046
|
// src/ui/composed/agno-chat/input.tsx
|
|
3932
4047
|
var jsx_dev_runtime43 = require("react/jsx-dev-runtime");
|
|
@@ -3935,16 +4050,9 @@ function AgnoChatInputArea({
|
|
|
3935
4050
|
children,
|
|
3936
4051
|
placeholder,
|
|
3937
4052
|
fileUpload,
|
|
3938
|
-
|
|
4053
|
+
audio,
|
|
3939
4054
|
showAttachments,
|
|
3940
4055
|
extraTools,
|
|
3941
|
-
chatInputProps,
|
|
3942
|
-
audioMode,
|
|
3943
|
-
transcriptionEndpoint,
|
|
3944
|
-
transcriptionHeaders,
|
|
3945
|
-
parseTranscriptionResponse,
|
|
3946
|
-
onRequestPermission,
|
|
3947
|
-
audioRecorderLabels,
|
|
3948
4056
|
allowCancelRun = false,
|
|
3949
4057
|
dropZoneProps
|
|
3950
4058
|
}) {
|
|
@@ -3954,23 +4062,16 @@ function AgnoChatInputArea({
|
|
|
3954
4062
|
children: /* @__PURE__ */ jsx_dev_runtime43.jsxDEV("div", {
|
|
3955
4063
|
className: "mx-auto px-4 py-2",
|
|
3956
4064
|
children: children ? children({ onSend: handleSend, disabled: inputDisabled, isStreaming, isPaused }) : /* @__PURE__ */ jsx_dev_runtime43.jsxDEV(AgnoChatInput, {
|
|
3957
|
-
...chatInputProps,
|
|
3958
4065
|
onSend: handleSend,
|
|
3959
4066
|
disabled: inputDisabled,
|
|
3960
4067
|
isStreaming,
|
|
3961
4068
|
onCancel: cancelRun,
|
|
3962
4069
|
allowCancelRun,
|
|
3963
|
-
placeholder: placeholder ??
|
|
4070
|
+
placeholder: placeholder ?? "Message your agent...",
|
|
3964
4071
|
fileUpload,
|
|
3965
|
-
|
|
4072
|
+
audio,
|
|
3966
4073
|
showAttachments,
|
|
3967
4074
|
extraTools,
|
|
3968
|
-
audioMode,
|
|
3969
|
-
transcriptionEndpoint,
|
|
3970
|
-
transcriptionHeaders,
|
|
3971
|
-
parseTranscriptionResponse,
|
|
3972
|
-
onRequestPermission,
|
|
3973
|
-
audioRecorderLabels,
|
|
3974
4075
|
dropZoneContainerRef,
|
|
3975
4076
|
dropZoneProps
|
|
3976
4077
|
}, undefined, false, undefined, this)
|
|
@@ -3988,72 +4089,4 @@ var AgnoChat = Object.assign(AgnoChatRoot, {
|
|
|
3988
4089
|
Input: AgnoChatInputArea
|
|
3989
4090
|
});
|
|
3990
4091
|
|
|
3991
|
-
|
|
3992
|
-
var import_lucide_react23 = require("lucide-react");
|
|
3993
|
-
var jsx_dev_runtime44 = require("react/jsx-dev-runtime");
|
|
3994
|
-
var DEFAULT_PROMPTS2 = [
|
|
3995
|
-
{ icon: /* @__PURE__ */ jsx_dev_runtime44.jsxDEV(import_lucide_react23.Sparkles, {
|
|
3996
|
-
className: "h-3.5 w-3.5"
|
|
3997
|
-
}, undefined, false, undefined, this), text: "What can you help me with?" },
|
|
3998
|
-
{ icon: /* @__PURE__ */ jsx_dev_runtime44.jsxDEV(import_lucide_react23.Bot, {
|
|
3999
|
-
className: "h-3.5 w-3.5"
|
|
4000
|
-
}, undefined, false, undefined, this), text: "Explain how you work" }
|
|
4001
|
-
];
|
|
4002
|
-
function AgnoChatInterface({
|
|
4003
|
-
className,
|
|
4004
|
-
classNames,
|
|
4005
|
-
renderMessage,
|
|
4006
|
-
renderInput,
|
|
4007
|
-
emptyState,
|
|
4008
|
-
headerSlot,
|
|
4009
|
-
inputToolbarSlot,
|
|
4010
|
-
suggestedPrompts = DEFAULT_PROMPTS2,
|
|
4011
|
-
toolHandlers = {},
|
|
4012
|
-
autoExecuteTools = true,
|
|
4013
|
-
placeholder,
|
|
4014
|
-
userAvatar,
|
|
4015
|
-
assistantAvatar,
|
|
4016
|
-
fileUpload,
|
|
4017
|
-
showAudioRecorder = true,
|
|
4018
|
-
showAttachments = true,
|
|
4019
|
-
messageItemProps,
|
|
4020
|
-
chatInputProps,
|
|
4021
|
-
dropZoneLabel
|
|
4022
|
-
}) {
|
|
4023
|
-
return /* @__PURE__ */ jsx_dev_runtime44.jsxDEV(AgnoChat, {
|
|
4024
|
-
toolHandlers,
|
|
4025
|
-
autoExecuteTools,
|
|
4026
|
-
className: cn(classNames?.root, className),
|
|
4027
|
-
children: [
|
|
4028
|
-
headerSlot,
|
|
4029
|
-
/* @__PURE__ */ jsx_dev_runtime44.jsxDEV(AgnoChat.Messages, {
|
|
4030
|
-
className: classNames?.messagesArea,
|
|
4031
|
-
renderMessage,
|
|
4032
|
-
userAvatar,
|
|
4033
|
-
assistantAvatar,
|
|
4034
|
-
messageItemProps,
|
|
4035
|
-
emptyState,
|
|
4036
|
-
suggestedPrompts
|
|
4037
|
-
}, undefined, false, undefined, this),
|
|
4038
|
-
/* @__PURE__ */ jsx_dev_runtime44.jsxDEV(AgnoChat.ToolStatus, {
|
|
4039
|
-
className: classNames?.toolStatusBar
|
|
4040
|
-
}, undefined, false, undefined, this),
|
|
4041
|
-
/* @__PURE__ */ jsx_dev_runtime44.jsxDEV(AgnoChat.ErrorBar, {
|
|
4042
|
-
className: classNames?.errorBar
|
|
4043
|
-
}, undefined, false, undefined, this),
|
|
4044
|
-
/* @__PURE__ */ jsx_dev_runtime44.jsxDEV(AgnoChat.Input, {
|
|
4045
|
-
className: classNames?.inputArea,
|
|
4046
|
-
placeholder,
|
|
4047
|
-
fileUpload,
|
|
4048
|
-
showAudioRecorder,
|
|
4049
|
-
showAttachments,
|
|
4050
|
-
extraTools: inputToolbarSlot,
|
|
4051
|
-
chatInputProps,
|
|
4052
|
-
dropZoneProps: { className: classNames?.dropZone, label: dropZoneLabel },
|
|
4053
|
-
children: renderInput ? ({ onSend, disabled }) => renderInput({ onSend, disabled }) : undefined
|
|
4054
|
-
}, undefined, false, undefined, this)
|
|
4055
|
-
]
|
|
4056
|
-
}, undefined, true, undefined, this);
|
|
4057
|
-
}
|
|
4058
|
-
|
|
4059
|
-
//# debugId=128E98AEB83ACE9C64756E2164756E21
|
|
4092
|
+
//# debugId=B0CD76478162837064756E2164756E21
|