@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.mjs
CHANGED
|
@@ -2692,582 +2692,759 @@ var PromptInputCommandSeparator = ({ className, ...props }) => /* @__PURE__ */ j
|
|
|
2692
2692
|
className: cn(className),
|
|
2693
2693
|
...props
|
|
2694
2694
|
});
|
|
2695
|
-
// src/ui/composed/
|
|
2696
|
-
import { useState as useState8 } from "react";
|
|
2697
|
-
import {
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
};
|
|
2713
|
-
function
|
|
2695
|
+
// src/ui/composed/agno-message/message.tsx
|
|
2696
|
+
import { useMemo as useMemo3, useState as useState8 } from "react";
|
|
2697
|
+
import { AlertCircle as AlertCircle2, FileIcon as FileIcon4, Music as Music2 } from "lucide-react";
|
|
2698
|
+
|
|
2699
|
+
// src/ui/composed/agno-message/context.ts
|
|
2700
|
+
import { createContext as createContext3, useContext as useContext3 } from "react";
|
|
2701
|
+
var AgnoMessageContext = createContext3(null);
|
|
2702
|
+
function useAgnoMessageContext() {
|
|
2703
|
+
const ctx = useContext3(AgnoMessageContext);
|
|
2704
|
+
if (!ctx) {
|
|
2705
|
+
throw new Error("useAgnoMessageContext must be used within an <AgnoMessage> provider. " + "Wrap your slots with <AgnoMessage message={...}>.");
|
|
2706
|
+
}
|
|
2707
|
+
return ctx;
|
|
2708
|
+
}
|
|
2709
|
+
|
|
2710
|
+
// src/ui/composed/agno-message/reasoning.tsx
|
|
2711
|
+
import { Lightbulb } from "lucide-react";
|
|
2712
|
+
import { jsx as jsx35, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
2713
|
+
function AgnoMessageReasoning() {
|
|
2714
|
+
const { message, classNames } = useAgnoMessageContext();
|
|
2715
|
+
const steps = message.extra_data?.reasoning_steps;
|
|
2716
|
+
if (!steps || steps.length === 0)
|
|
2717
|
+
return null;
|
|
2718
|
+
return /* @__PURE__ */ jsxs20("div", {
|
|
2719
|
+
className: cn("space-y-2 pt-1", classNames?.assistant?.reasoning),
|
|
2720
|
+
children: [
|
|
2721
|
+
/* @__PURE__ */ jsxs20("div", {
|
|
2722
|
+
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2723
|
+
children: [
|
|
2724
|
+
/* @__PURE__ */ jsx35(Lightbulb, {
|
|
2725
|
+
className: "h-3.5 w-3.5"
|
|
2726
|
+
}),
|
|
2727
|
+
"Reasoning (",
|
|
2728
|
+
steps.length,
|
|
2729
|
+
" steps)"
|
|
2730
|
+
]
|
|
2731
|
+
}),
|
|
2732
|
+
/* @__PURE__ */ jsx35(Accordion, {
|
|
2733
|
+
type: "multiple",
|
|
2734
|
+
className: "w-full",
|
|
2735
|
+
children: steps.map((step, idx) => /* @__PURE__ */ jsxs20(AccordionItem, {
|
|
2736
|
+
value: `reasoning-${idx}`,
|
|
2737
|
+
className: "border-muted",
|
|
2738
|
+
children: [
|
|
2739
|
+
/* @__PURE__ */ jsx35(AccordionTrigger, {
|
|
2740
|
+
className: "text-xs py-1.5 hover:no-underline",
|
|
2741
|
+
children: step.title || `Step ${idx + 1}`
|
|
2742
|
+
}),
|
|
2743
|
+
/* @__PURE__ */ jsxs20(AccordionContent, {
|
|
2744
|
+
className: "space-y-1.5 text-xs text-muted-foreground",
|
|
2745
|
+
children: [
|
|
2746
|
+
step.action && /* @__PURE__ */ jsxs20("div", {
|
|
2747
|
+
children: [
|
|
2748
|
+
/* @__PURE__ */ jsx35("span", {
|
|
2749
|
+
className: "font-medium text-foreground",
|
|
2750
|
+
children: "Action:"
|
|
2751
|
+
}),
|
|
2752
|
+
" ",
|
|
2753
|
+
step.action
|
|
2754
|
+
]
|
|
2755
|
+
}),
|
|
2756
|
+
step.reasoning && /* @__PURE__ */ jsxs20("div", {
|
|
2757
|
+
children: [
|
|
2758
|
+
/* @__PURE__ */ jsx35("span", {
|
|
2759
|
+
className: "font-medium text-foreground",
|
|
2760
|
+
children: "Reasoning:"
|
|
2761
|
+
}),
|
|
2762
|
+
" ",
|
|
2763
|
+
step.reasoning
|
|
2764
|
+
]
|
|
2765
|
+
}),
|
|
2766
|
+
step.result && /* @__PURE__ */ jsxs20("div", {
|
|
2767
|
+
children: [
|
|
2768
|
+
/* @__PURE__ */ jsx35("span", {
|
|
2769
|
+
className: "font-medium text-foreground",
|
|
2770
|
+
children: "Result:"
|
|
2771
|
+
}),
|
|
2772
|
+
" ",
|
|
2773
|
+
step.result
|
|
2774
|
+
]
|
|
2775
|
+
}),
|
|
2776
|
+
step.confidence !== undefined && /* @__PURE__ */ jsxs20("div", {
|
|
2777
|
+
children: [
|
|
2778
|
+
/* @__PURE__ */ jsx35("span", {
|
|
2779
|
+
className: "font-medium text-foreground",
|
|
2780
|
+
children: "Confidence:"
|
|
2781
|
+
}),
|
|
2782
|
+
" ",
|
|
2783
|
+
(step.confidence * 100).toFixed(1),
|
|
2784
|
+
"%"
|
|
2785
|
+
]
|
|
2786
|
+
})
|
|
2787
|
+
]
|
|
2788
|
+
})
|
|
2789
|
+
]
|
|
2790
|
+
}, idx))
|
|
2791
|
+
})
|
|
2792
|
+
]
|
|
2793
|
+
});
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
// src/ui/composed/agno-message/media.tsx
|
|
2797
|
+
import { FileIcon as FileIcon3, Image as ImageIcon2, Music, Paperclip, Video } from "lucide-react";
|
|
2798
|
+
import { jsx as jsx36, jsxs as jsxs21, Fragment as Fragment5 } from "react/jsx-runtime";
|
|
2799
|
+
function AgnoMessageMedia() {
|
|
2800
|
+
const {
|
|
2801
|
+
message,
|
|
2802
|
+
classNames,
|
|
2803
|
+
showImageLightbox,
|
|
2804
|
+
showFilePreview,
|
|
2805
|
+
openImageLightbox,
|
|
2806
|
+
openFilePreview
|
|
2807
|
+
} = useAgnoMessageContext();
|
|
2808
|
+
const mediaClassName = classNames?.assistant?.media;
|
|
2809
|
+
const hasImages = !!message.images && message.images.length > 0;
|
|
2810
|
+
const hasVideos = !!message.videos && message.videos.length > 0;
|
|
2811
|
+
const hasAudio = !!message.audio && message.audio.length > 0;
|
|
2812
|
+
const hasFiles = !!message.files && message.files.length > 0;
|
|
2813
|
+
const hasResponseAudio = !!message.response_audio;
|
|
2814
|
+
if (!hasImages && !hasVideos && !hasAudio && !hasFiles && !hasResponseAudio)
|
|
2815
|
+
return null;
|
|
2816
|
+
return /* @__PURE__ */ jsxs21(Fragment5, {
|
|
2817
|
+
children: [
|
|
2818
|
+
hasImages && /* @__PURE__ */ jsxs21("div", {
|
|
2819
|
+
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2820
|
+
children: [
|
|
2821
|
+
/* @__PURE__ */ jsxs21("div", {
|
|
2822
|
+
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2823
|
+
children: [
|
|
2824
|
+
/* @__PURE__ */ jsx36(ImageIcon2, {
|
|
2825
|
+
className: "h-3.5 w-3.5"
|
|
2826
|
+
}),
|
|
2827
|
+
"Images (",
|
|
2828
|
+
message.images.length,
|
|
2829
|
+
")"
|
|
2830
|
+
]
|
|
2831
|
+
}),
|
|
2832
|
+
/* @__PURE__ */ jsx36("div", {
|
|
2833
|
+
className: "grid grid-cols-2 gap-2",
|
|
2834
|
+
children: message.images.map((img, idx) => /* @__PURE__ */ jsxs21("div", {
|
|
2835
|
+
className: "space-y-1",
|
|
2836
|
+
children: [
|
|
2837
|
+
showImageLightbox ? /* @__PURE__ */ jsx36("button", {
|
|
2838
|
+
type: "button",
|
|
2839
|
+
onClick: () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx),
|
|
2840
|
+
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",
|
|
2841
|
+
children: /* @__PURE__ */ jsx36("img", {
|
|
2842
|
+
src: img.url,
|
|
2843
|
+
alt: img.revised_prompt || "Generated image",
|
|
2844
|
+
className: "w-full rounded-lg"
|
|
2845
|
+
})
|
|
2846
|
+
}) : /* @__PURE__ */ jsx36("img", {
|
|
2847
|
+
src: img.url,
|
|
2848
|
+
alt: img.revised_prompt || "Generated image",
|
|
2849
|
+
className: "w-full rounded-lg border border-border"
|
|
2850
|
+
}),
|
|
2851
|
+
img.revised_prompt && /* @__PURE__ */ jsx36("p", {
|
|
2852
|
+
className: "text-[11px] text-muted-foreground italic px-0.5",
|
|
2853
|
+
children: img.revised_prompt
|
|
2854
|
+
})
|
|
2855
|
+
]
|
|
2856
|
+
}, idx))
|
|
2857
|
+
})
|
|
2858
|
+
]
|
|
2859
|
+
}),
|
|
2860
|
+
hasVideos && /* @__PURE__ */ jsxs21("div", {
|
|
2861
|
+
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2862
|
+
children: [
|
|
2863
|
+
/* @__PURE__ */ jsxs21("div", {
|
|
2864
|
+
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2865
|
+
children: [
|
|
2866
|
+
/* @__PURE__ */ jsx36(Video, {
|
|
2867
|
+
className: "h-3.5 w-3.5"
|
|
2868
|
+
}),
|
|
2869
|
+
"Videos (",
|
|
2870
|
+
message.videos.length,
|
|
2871
|
+
")"
|
|
2872
|
+
]
|
|
2873
|
+
}),
|
|
2874
|
+
/* @__PURE__ */ jsx36("div", {
|
|
2875
|
+
className: "space-y-2",
|
|
2876
|
+
children: message.videos.map((video, idx) => /* @__PURE__ */ jsx36("div", {
|
|
2877
|
+
children: video.url ? /* @__PURE__ */ jsx36("video", {
|
|
2878
|
+
src: video.url,
|
|
2879
|
+
controls: true,
|
|
2880
|
+
className: "w-full rounded-lg border border-border"
|
|
2881
|
+
}) : /* @__PURE__ */ jsxs21("div", {
|
|
2882
|
+
className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
|
|
2883
|
+
children: [
|
|
2884
|
+
"Video ID: ",
|
|
2885
|
+
video.id,
|
|
2886
|
+
" (ETA: ",
|
|
2887
|
+
video.eta,
|
|
2888
|
+
"s)"
|
|
2889
|
+
]
|
|
2890
|
+
})
|
|
2891
|
+
}, idx))
|
|
2892
|
+
})
|
|
2893
|
+
]
|
|
2894
|
+
}),
|
|
2895
|
+
hasAudio && /* @__PURE__ */ jsxs21("div", {
|
|
2896
|
+
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2897
|
+
children: [
|
|
2898
|
+
/* @__PURE__ */ jsxs21("div", {
|
|
2899
|
+
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2900
|
+
children: [
|
|
2901
|
+
/* @__PURE__ */ jsx36(Music, {
|
|
2902
|
+
className: "h-3.5 w-3.5"
|
|
2903
|
+
}),
|
|
2904
|
+
"Audio (",
|
|
2905
|
+
message.audio.length,
|
|
2906
|
+
")"
|
|
2907
|
+
]
|
|
2908
|
+
}),
|
|
2909
|
+
/* @__PURE__ */ jsx36("div", {
|
|
2910
|
+
className: "space-y-2",
|
|
2911
|
+
children: message.audio.map((audio, idx) => /* @__PURE__ */ jsx36("div", {
|
|
2912
|
+
children: audio.url ? /* @__PURE__ */ jsx36("audio", {
|
|
2913
|
+
src: audio.url,
|
|
2914
|
+
controls: true,
|
|
2915
|
+
className: "w-full"
|
|
2916
|
+
}) : audio.base64_audio ? /* @__PURE__ */ jsx36("audio", {
|
|
2917
|
+
src: `data:${audio.mime_type || "audio/wav"};base64,${audio.base64_audio}`,
|
|
2918
|
+
controls: true,
|
|
2919
|
+
className: "w-full"
|
|
2920
|
+
}) : /* @__PURE__ */ jsx36("div", {
|
|
2921
|
+
className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
|
|
2922
|
+
children: "Audio data unavailable"
|
|
2923
|
+
})
|
|
2924
|
+
}, idx))
|
|
2925
|
+
})
|
|
2926
|
+
]
|
|
2927
|
+
}),
|
|
2928
|
+
hasFiles && /* @__PURE__ */ jsxs21("div", {
|
|
2929
|
+
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2930
|
+
children: [
|
|
2931
|
+
/* @__PURE__ */ jsxs21("div", {
|
|
2932
|
+
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2933
|
+
children: [
|
|
2934
|
+
/* @__PURE__ */ jsx36(Paperclip, {
|
|
2935
|
+
className: "h-3.5 w-3.5"
|
|
2936
|
+
}),
|
|
2937
|
+
"Files (",
|
|
2938
|
+
message.files.length,
|
|
2939
|
+
")"
|
|
2940
|
+
]
|
|
2941
|
+
}),
|
|
2942
|
+
/* @__PURE__ */ jsx36("div", {
|
|
2943
|
+
className: "flex flex-wrap gap-2",
|
|
2944
|
+
children: message.files.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx36(FilePreviewCard, {
|
|
2945
|
+
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
2946
|
+
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
2947
|
+
}, idx) : /* @__PURE__ */ jsxs21("div", {
|
|
2948
|
+
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",
|
|
2949
|
+
children: [
|
|
2950
|
+
/* @__PURE__ */ jsx36(FileIcon3, {
|
|
2951
|
+
className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
|
|
2952
|
+
}),
|
|
2953
|
+
/* @__PURE__ */ jsx36("span", {
|
|
2954
|
+
className: "truncate max-w-[180px]",
|
|
2955
|
+
children: file.name
|
|
2956
|
+
}),
|
|
2957
|
+
file.size && /* @__PURE__ */ jsxs21("span", {
|
|
2958
|
+
className: "text-muted-foreground/70",
|
|
2959
|
+
children: [
|
|
2960
|
+
"(",
|
|
2961
|
+
(file.size / 1024).toFixed(1),
|
|
2962
|
+
"KB)"
|
|
2963
|
+
]
|
|
2964
|
+
}),
|
|
2965
|
+
file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsx36("a", {
|
|
2966
|
+
href: file.url,
|
|
2967
|
+
target: "_blank",
|
|
2968
|
+
rel: "noopener noreferrer",
|
|
2969
|
+
className: "text-primary hover:underline font-medium",
|
|
2970
|
+
children: "View"
|
|
2971
|
+
})
|
|
2972
|
+
]
|
|
2973
|
+
}, idx))
|
|
2974
|
+
})
|
|
2975
|
+
]
|
|
2976
|
+
}),
|
|
2977
|
+
hasResponseAudio && message.response_audio && /* @__PURE__ */ jsxs21("div", {
|
|
2978
|
+
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2979
|
+
children: [
|
|
2980
|
+
/* @__PURE__ */ jsxs21("div", {
|
|
2981
|
+
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2982
|
+
children: [
|
|
2983
|
+
/* @__PURE__ */ jsx36(Music, {
|
|
2984
|
+
className: "h-3.5 w-3.5"
|
|
2985
|
+
}),
|
|
2986
|
+
"Response Audio"
|
|
2987
|
+
]
|
|
2988
|
+
}),
|
|
2989
|
+
message.response_audio.transcript && /* @__PURE__ */ jsxs21("div", {
|
|
2990
|
+
className: "text-xs italic bg-muted/50 border border-border p-2.5 rounded-lg text-muted-foreground",
|
|
2991
|
+
children: [
|
|
2992
|
+
'"',
|
|
2993
|
+
message.response_audio.transcript,
|
|
2994
|
+
'"'
|
|
2995
|
+
]
|
|
2996
|
+
}),
|
|
2997
|
+
message.response_audio.content && /* @__PURE__ */ jsx36("audio", {
|
|
2998
|
+
src: `data:audio/wav;base64,${message.response_audio.content}`,
|
|
2999
|
+
controls: true,
|
|
3000
|
+
className: "w-full"
|
|
3001
|
+
})
|
|
3002
|
+
]
|
|
3003
|
+
})
|
|
3004
|
+
]
|
|
3005
|
+
});
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
// src/ui/composed/agno-chat/context.ts
|
|
3009
|
+
import { createContext as createContext4, useContext as useContext4 } from "react";
|
|
3010
|
+
var AgnoChatContext = createContext4(null);
|
|
3011
|
+
function useAgnoChatContext() {
|
|
3012
|
+
const ctx = useContext4(AgnoChatContext);
|
|
3013
|
+
if (!ctx) {
|
|
3014
|
+
throw new Error("useAgnoChatContext must be used within an <AgnoChat> provider. " + "Wrap your component tree with <AgnoChat>.");
|
|
3015
|
+
}
|
|
3016
|
+
return ctx;
|
|
3017
|
+
}
|
|
3018
|
+
|
|
3019
|
+
// src/ui/composed/agno-chat/tool-building-blocks.tsx
|
|
3020
|
+
import { jsx as jsx37, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
3021
|
+
var getToolState = (tool) => tool.tool_call_error ? "output-error" : "output-available";
|
|
3022
|
+
function ToolDebugCard({ tool, defaultOpen }) {
|
|
3023
|
+
const output = tool.result ?? tool.content;
|
|
3024
|
+
return /* @__PURE__ */ jsxs22(Tool, {
|
|
3025
|
+
defaultOpen,
|
|
3026
|
+
children: [
|
|
3027
|
+
/* @__PURE__ */ jsx37(ToolHeader, {
|
|
3028
|
+
title: tool.tool_name,
|
|
3029
|
+
type: "tool-use",
|
|
3030
|
+
state: getToolState(tool)
|
|
3031
|
+
}),
|
|
3032
|
+
/* @__PURE__ */ jsxs22(ToolContent, {
|
|
3033
|
+
children: [
|
|
3034
|
+
/* @__PURE__ */ jsx37(ToolInput, {
|
|
3035
|
+
input: tool.tool_args
|
|
3036
|
+
}),
|
|
3037
|
+
output ? /* @__PURE__ */ jsx37(ToolOutput, {
|
|
3038
|
+
output,
|
|
3039
|
+
errorText: tool.tool_call_error ? "Tool execution failed" : undefined
|
|
3040
|
+
}) : null
|
|
3041
|
+
]
|
|
3042
|
+
})
|
|
3043
|
+
]
|
|
3044
|
+
});
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
// src/ui/composed/agno-message/tools.tsx
|
|
3048
|
+
import { jsx as jsx38 } from "react/jsx-runtime";
|
|
3049
|
+
function AgnoMessageTools({ renderTool: renderToolProp } = {}) {
|
|
3050
|
+
const { message, classNames, renderTool: ctxMsgRenderTool } = useAgnoMessageContext();
|
|
3051
|
+
const { renderTool: ctxChatRenderTool, isDebug } = useAgnoChatContext();
|
|
3052
|
+
const renderTool = renderToolProp ?? ctxMsgRenderTool ?? ctxChatRenderTool;
|
|
3053
|
+
if (!message.tool_calls || message.tool_calls.length === 0)
|
|
3054
|
+
return null;
|
|
3055
|
+
return /* @__PURE__ */ jsx38("div", {
|
|
3056
|
+
className: cn("space-y-2 pt-1", classNames?.assistant?.toolCalls),
|
|
3057
|
+
children: message.tool_calls.map((tool, idx) => {
|
|
3058
|
+
const defaultRender = () => isDebug ? /* @__PURE__ */ jsx38(ToolDebugCard, {
|
|
3059
|
+
tool,
|
|
3060
|
+
defaultOpen: idx === 0
|
|
3061
|
+
}) : null;
|
|
3062
|
+
const node = renderTool ? renderTool(tool, { index: idx, isDebug, defaultRender }) : defaultRender();
|
|
3063
|
+
if (node === null || node === undefined)
|
|
3064
|
+
return null;
|
|
3065
|
+
return /* @__PURE__ */ jsx38("div", {
|
|
3066
|
+
children: node
|
|
3067
|
+
}, tool.tool_call_id || idx);
|
|
3068
|
+
})
|
|
3069
|
+
});
|
|
3070
|
+
}
|
|
3071
|
+
|
|
3072
|
+
// src/ui/composed/agno-message/content.tsx
|
|
3073
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
3074
|
+
function AgnoMessageContent() {
|
|
3075
|
+
const { message } = useAgnoMessageContext();
|
|
3076
|
+
if (!message.content)
|
|
3077
|
+
return null;
|
|
3078
|
+
return /* @__PURE__ */ jsx39("div", {
|
|
3079
|
+
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",
|
|
3080
|
+
children: /* @__PURE__ */ jsx39(Response, {
|
|
3081
|
+
children: message.content
|
|
3082
|
+
})
|
|
3083
|
+
});
|
|
3084
|
+
}
|
|
3085
|
+
|
|
3086
|
+
// src/ui/composed/agno-message/references.tsx
|
|
3087
|
+
import { FileText } from "lucide-react";
|
|
3088
|
+
import { jsx as jsx40, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
3089
|
+
function AgnoMessageReferences() {
|
|
3090
|
+
const { message, classNames } = useAgnoMessageContext();
|
|
3091
|
+
const references = message.extra_data?.references;
|
|
3092
|
+
if (!references || references.length === 0)
|
|
3093
|
+
return null;
|
|
3094
|
+
return /* @__PURE__ */ jsxs23("div", {
|
|
3095
|
+
className: cn("space-y-2 pt-1", classNames?.assistant?.references),
|
|
3096
|
+
children: [
|
|
3097
|
+
/* @__PURE__ */ jsxs23("div", {
|
|
3098
|
+
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3099
|
+
children: [
|
|
3100
|
+
/* @__PURE__ */ jsx40(FileText, {
|
|
3101
|
+
className: "h-3.5 w-3.5"
|
|
3102
|
+
}),
|
|
3103
|
+
"References (",
|
|
3104
|
+
references.length,
|
|
3105
|
+
")"
|
|
3106
|
+
]
|
|
3107
|
+
}),
|
|
3108
|
+
/* @__PURE__ */ jsx40("div", {
|
|
3109
|
+
className: "space-y-2",
|
|
3110
|
+
children: references.map((refData, idx) => /* @__PURE__ */ jsxs23("div", {
|
|
3111
|
+
className: "text-xs space-y-1.5",
|
|
3112
|
+
children: [
|
|
3113
|
+
refData.query && /* @__PURE__ */ jsxs23("div", {
|
|
3114
|
+
className: "font-medium text-foreground",
|
|
3115
|
+
children: [
|
|
3116
|
+
"Query: ",
|
|
3117
|
+
refData.query
|
|
3118
|
+
]
|
|
3119
|
+
}),
|
|
3120
|
+
refData.references.map((ref, refIdx) => /* @__PURE__ */ jsxs23("div", {
|
|
3121
|
+
className: "bg-muted/50 border border-border p-2.5 rounded-lg",
|
|
3122
|
+
children: [
|
|
3123
|
+
/* @__PURE__ */ jsxs23("div", {
|
|
3124
|
+
className: "italic text-muted-foreground mb-1",
|
|
3125
|
+
children: [
|
|
3126
|
+
'"',
|
|
3127
|
+
ref.content,
|
|
3128
|
+
'"'
|
|
3129
|
+
]
|
|
3130
|
+
}),
|
|
3131
|
+
/* @__PURE__ */ jsxs23("div", {
|
|
3132
|
+
className: "text-muted-foreground/70",
|
|
3133
|
+
children: [
|
|
3134
|
+
"Source: ",
|
|
3135
|
+
ref.name,
|
|
3136
|
+
" (chunk ",
|
|
3137
|
+
ref.meta_data.chunk,
|
|
3138
|
+
"/",
|
|
3139
|
+
ref.meta_data.chunk_size,
|
|
3140
|
+
")"
|
|
3141
|
+
]
|
|
3142
|
+
})
|
|
3143
|
+
]
|
|
3144
|
+
}, refIdx))
|
|
3145
|
+
]
|
|
3146
|
+
}, idx))
|
|
3147
|
+
})
|
|
3148
|
+
]
|
|
3149
|
+
});
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
// src/ui/composed/agno-message/footer.tsx
|
|
3153
|
+
import { AlertCircle } from "lucide-react";
|
|
3154
|
+
import { jsx as jsx41, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
3155
|
+
function AgnoMessageFooter({ showTimestamp = true } = {}) {
|
|
3156
|
+
const { message, classNames, actions, isLastAssistantMessage, formatTimestamp } = useAgnoMessageContext();
|
|
3157
|
+
const hasError = message.streamingError;
|
|
3158
|
+
const isCustomTimestamp = !!formatTimestamp;
|
|
3159
|
+
const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
|
|
3160
|
+
if (!actions?.assistant && !showTimestamp && !hasError)
|
|
3161
|
+
return null;
|
|
3162
|
+
return /* @__PURE__ */ jsxs24("div", {
|
|
3163
|
+
className: "flex items-center gap-2 pt-1",
|
|
3164
|
+
children: [
|
|
3165
|
+
actions?.assistant && (() => {
|
|
3166
|
+
const visibility = actions.visibility ?? "visible";
|
|
3167
|
+
if (visibility === "last-assistant" && !isLastAssistantMessage)
|
|
3168
|
+
return null;
|
|
3169
|
+
const useHover = visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage;
|
|
3170
|
+
return /* @__PURE__ */ jsx41("div", {
|
|
3171
|
+
className: cn("flex items-center gap-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100", classNames?.assistant?.actions),
|
|
3172
|
+
children: actions.assistant(message)
|
|
3173
|
+
});
|
|
3174
|
+
})(),
|
|
3175
|
+
hasError && /* @__PURE__ */ jsxs24("span", {
|
|
3176
|
+
className: "flex items-center gap-1 text-[11px] text-destructive",
|
|
3177
|
+
children: [
|
|
3178
|
+
/* @__PURE__ */ jsx41(AlertCircle, {
|
|
3179
|
+
className: "h-3 w-3"
|
|
3180
|
+
}),
|
|
3181
|
+
"Error"
|
|
3182
|
+
]
|
|
3183
|
+
}),
|
|
3184
|
+
showTimestamp && /* @__PURE__ */ jsx41(SmartTimestamp, {
|
|
3185
|
+
date: new Date(message.created_at * 1000),
|
|
3186
|
+
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
3187
|
+
className: "text-[11px] text-muted-foreground"
|
|
3188
|
+
})
|
|
3189
|
+
]
|
|
3190
|
+
});
|
|
3191
|
+
}
|
|
3192
|
+
|
|
3193
|
+
// src/ui/composed/agno-message/message.tsx
|
|
3194
|
+
import { jsx as jsx42, jsxs as jsxs25, Fragment as Fragment6 } from "react/jsx-runtime";
|
|
3195
|
+
function DefaultAssistantComposition({ showTimestamp }) {
|
|
3196
|
+
return /* @__PURE__ */ jsxs25(Fragment6, {
|
|
3197
|
+
children: [
|
|
3198
|
+
/* @__PURE__ */ jsx42(AgnoMessageReasoning, {}),
|
|
3199
|
+
/* @__PURE__ */ jsx42(AgnoMessageMedia, {}),
|
|
3200
|
+
/* @__PURE__ */ jsx42(AgnoMessageTools, {}),
|
|
3201
|
+
/* @__PURE__ */ jsx42(AgnoMessageContent, {}),
|
|
3202
|
+
/* @__PURE__ */ jsx42(AgnoMessageReferences, {}),
|
|
3203
|
+
/* @__PURE__ */ jsx42(AgnoMessageFooter, {
|
|
3204
|
+
showTimestamp
|
|
3205
|
+
})
|
|
3206
|
+
]
|
|
3207
|
+
});
|
|
3208
|
+
}
|
|
3209
|
+
function AgnoMessage({
|
|
2714
3210
|
message,
|
|
2715
3211
|
className,
|
|
2716
3212
|
classNames,
|
|
2717
|
-
renderContent,
|
|
2718
|
-
renderToolCall,
|
|
2719
|
-
renderMedia,
|
|
2720
3213
|
avatars,
|
|
2721
3214
|
actions,
|
|
2722
3215
|
isLastAssistantMessage = false,
|
|
2723
|
-
showReasoning = true,
|
|
2724
|
-
showReferences = true,
|
|
2725
|
-
showTimestamp = true,
|
|
2726
|
-
showGenerativeUI = true,
|
|
2727
|
-
showToolCalls = true,
|
|
2728
3216
|
showFilePreview = true,
|
|
2729
3217
|
showImageLightbox = true,
|
|
3218
|
+
showTimestamp = true,
|
|
2730
3219
|
formatTimestamp,
|
|
2731
|
-
|
|
3220
|
+
renderTool,
|
|
3221
|
+
children
|
|
2732
3222
|
}) {
|
|
2733
3223
|
const isUser = message.role === "user";
|
|
2734
3224
|
const hasError = message.streamingError;
|
|
2735
|
-
const toolsWithUI = message.tool_calls?.filter((tool) => tool.ui_component) || [];
|
|
2736
3225
|
const [preview, setPreview] = useState8(null);
|
|
2737
3226
|
const isCustomTimestamp = !!formatTimestamp;
|
|
2738
|
-
const resolvedFormatTimestamp = formatTimestamp ??
|
|
2739
|
-
const
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
3227
|
+
const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
|
|
3228
|
+
const ctx = useMemo3(() => ({
|
|
3229
|
+
message,
|
|
3230
|
+
isLastAssistantMessage,
|
|
3231
|
+
classNames,
|
|
3232
|
+
actions,
|
|
3233
|
+
avatars,
|
|
3234
|
+
formatTimestamp,
|
|
3235
|
+
showFilePreview,
|
|
3236
|
+
showImageLightbox,
|
|
3237
|
+
openImageLightbox: (images, index) => {
|
|
3238
|
+
if (!showImageLightbox)
|
|
3239
|
+
return;
|
|
3240
|
+
setPreview({ type: "image", images, initialIndex: index });
|
|
3241
|
+
},
|
|
3242
|
+
openFilePreview: (file) => {
|
|
3243
|
+
if (!showFilePreview)
|
|
3244
|
+
return;
|
|
3245
|
+
setPreview({ type: "file", file });
|
|
3246
|
+
},
|
|
3247
|
+
renderTool
|
|
3248
|
+
}), [
|
|
3249
|
+
message,
|
|
3250
|
+
isLastAssistantMessage,
|
|
3251
|
+
classNames,
|
|
3252
|
+
actions,
|
|
3253
|
+
avatars,
|
|
3254
|
+
formatTimestamp,
|
|
3255
|
+
showFilePreview,
|
|
3256
|
+
showImageLightbox,
|
|
3257
|
+
renderTool
|
|
3258
|
+
]);
|
|
2749
3259
|
const closePreview = () => setPreview(null);
|
|
2750
|
-
return /* @__PURE__ */
|
|
2751
|
-
|
|
3260
|
+
return /* @__PURE__ */ jsx42(AgnoMessageContext.Provider, {
|
|
3261
|
+
value: ctx,
|
|
3262
|
+
children: /* @__PURE__ */ jsxs25("div", {
|
|
3263
|
+
className: cn("py-5 first:pt-2", isUser ? "flex justify-end" : "", classNames?.root, className),
|
|
3264
|
+
children: [
|
|
3265
|
+
isUser ? /* @__PURE__ */ jsx42(UserMessageLayout, {
|
|
3266
|
+
message,
|
|
3267
|
+
classNames,
|
|
3268
|
+
avatars,
|
|
3269
|
+
actions,
|
|
3270
|
+
isCustomTimestamp,
|
|
3271
|
+
resolvedFormatTimestamp,
|
|
3272
|
+
showTimestamp,
|
|
3273
|
+
showImageLightbox,
|
|
3274
|
+
showFilePreview,
|
|
3275
|
+
openImageLightbox: ctx.openImageLightbox,
|
|
3276
|
+
openFilePreview: ctx.openFilePreview,
|
|
3277
|
+
hasError
|
|
3278
|
+
}) : /* @__PURE__ */ jsxs25("div", {
|
|
3279
|
+
className: "flex items-start gap-3 group/message",
|
|
3280
|
+
children: [
|
|
3281
|
+
avatars?.assistant,
|
|
3282
|
+
/* @__PURE__ */ jsx42("div", {
|
|
3283
|
+
className: cn("flex-1 min-w-0 space-y-3", classNames?.assistant?.container),
|
|
3284
|
+
children: children ?? /* @__PURE__ */ jsx42(DefaultAssistantComposition, {
|
|
3285
|
+
showTimestamp
|
|
3286
|
+
})
|
|
3287
|
+
})
|
|
3288
|
+
]
|
|
3289
|
+
}),
|
|
3290
|
+
preview?.type === "image" && /* @__PURE__ */ jsx42(ImageLightbox, {
|
|
3291
|
+
open: true,
|
|
3292
|
+
onOpenChange: (open) => {
|
|
3293
|
+
if (!open)
|
|
3294
|
+
closePreview();
|
|
3295
|
+
},
|
|
3296
|
+
images: preview.images,
|
|
3297
|
+
initialIndex: preview.initialIndex
|
|
3298
|
+
}),
|
|
3299
|
+
preview?.type === "file" && /* @__PURE__ */ jsx42(FilePreviewModal, {
|
|
3300
|
+
open: true,
|
|
3301
|
+
onOpenChange: (open) => {
|
|
3302
|
+
if (!open)
|
|
3303
|
+
closePreview();
|
|
3304
|
+
},
|
|
3305
|
+
file: preview.file
|
|
3306
|
+
})
|
|
3307
|
+
]
|
|
3308
|
+
})
|
|
3309
|
+
});
|
|
3310
|
+
}
|
|
3311
|
+
AgnoMessage.Reasoning = AgnoMessageReasoning;
|
|
3312
|
+
AgnoMessage.Media = AgnoMessageMedia;
|
|
3313
|
+
AgnoMessage.Tools = AgnoMessageTools;
|
|
3314
|
+
AgnoMessage.Content = AgnoMessageContent;
|
|
3315
|
+
AgnoMessage.References = AgnoMessageReferences;
|
|
3316
|
+
AgnoMessage.Footer = AgnoMessageFooter;
|
|
3317
|
+
function UserMessageLayout({
|
|
3318
|
+
message,
|
|
3319
|
+
classNames,
|
|
3320
|
+
avatars,
|
|
3321
|
+
actions,
|
|
3322
|
+
isCustomTimestamp,
|
|
3323
|
+
resolvedFormatTimestamp,
|
|
3324
|
+
showTimestamp,
|
|
3325
|
+
showImageLightbox,
|
|
3326
|
+
showFilePreview,
|
|
3327
|
+
openImageLightbox,
|
|
3328
|
+
openFilePreview,
|
|
3329
|
+
hasError
|
|
3330
|
+
}) {
|
|
3331
|
+
return /* @__PURE__ */ jsxs25("div", {
|
|
3332
|
+
className: "flex items-start gap-2.5 max-w-[80%] flex-row-reverse",
|
|
2752
3333
|
children: [
|
|
2753
|
-
|
|
2754
|
-
|
|
3334
|
+
avatars?.user,
|
|
3335
|
+
/* @__PURE__ */ jsxs25("div", {
|
|
3336
|
+
className: "space-y-1.5 flex flex-col items-end min-w-0",
|
|
2755
3337
|
children: [
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
className: "space-y-1.5 flex flex-col items-end min-w-0",
|
|
3338
|
+
(message.images && message.images.length > 0 || message.audio && message.audio.length > 0 || message.files && message.files.length > 0) && /* @__PURE__ */ jsxs25("div", {
|
|
3339
|
+
className: "flex flex-wrap gap-2 justify-end",
|
|
2759
3340
|
children: [
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
}, `img-${idx}`)),
|
|
2767
|
-
message.audio?.map((audio, idx) => /* @__PURE__ */ jsxs20("div", {
|
|
2768
|
-
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",
|
|
2769
|
-
children: [
|
|
2770
|
-
/* @__PURE__ */ jsx35(Music, {
|
|
2771
|
-
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
2772
|
-
}),
|
|
2773
|
-
/* @__PURE__ */ jsx35("span", {
|
|
2774
|
-
className: "truncate max-w-[150px]",
|
|
2775
|
-
children: audio.id || `Audio ${idx + 1}`
|
|
2776
|
-
})
|
|
2777
|
-
]
|
|
2778
|
-
}, `audio-${idx}`)),
|
|
2779
|
-
message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx35(FilePreviewCard, {
|
|
2780
|
-
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
2781
|
-
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
2782
|
-
}, `file-${idx}`) : /* @__PURE__ */ jsxs20("div", {
|
|
2783
|
-
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",
|
|
2784
|
-
children: [
|
|
2785
|
-
/* @__PURE__ */ jsx35(FileIcon3, {
|
|
2786
|
-
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
2787
|
-
}),
|
|
2788
|
-
/* @__PURE__ */ jsx35("span", {
|
|
2789
|
-
className: "truncate max-w-[150px]",
|
|
2790
|
-
children: file.name
|
|
2791
|
-
})
|
|
2792
|
-
]
|
|
2793
|
-
}, `file-${idx}`))
|
|
2794
|
-
]
|
|
2795
|
-
}),
|
|
2796
|
-
message.content && /* @__PURE__ */ jsx35("div", {
|
|
2797
|
-
className: cn("rounded-2xl rounded-br-md px-4 py-2.5", classNames?.user?.bubble ?? "bg-primary text-primary-foreground", hasError && "opacity-70"),
|
|
2798
|
-
children: /* @__PURE__ */ jsx35("p", {
|
|
2799
|
-
className: "text-sm whitespace-pre-wrap",
|
|
2800
|
-
children: message.content
|
|
2801
|
-
})
|
|
2802
|
-
}),
|
|
2803
|
-
(showTimestamp || actions?.user) && /* @__PURE__ */ jsxs20("div", {
|
|
2804
|
-
className: "flex items-center justify-end gap-1.5 px-1",
|
|
3341
|
+
message.images?.map((img, idx) => /* @__PURE__ */ jsx42(FilePreviewCard, {
|
|
3342
|
+
file: { name: img.revised_prompt || `Image ${idx + 1}`, type: "image/png", url: img.url },
|
|
3343
|
+
onClick: showImageLightbox ? () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx) : undefined
|
|
3344
|
+
}, `img-${idx}`)),
|
|
3345
|
+
message.audio?.map((audio, idx) => /* @__PURE__ */ jsxs25("div", {
|
|
3346
|
+
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",
|
|
2805
3347
|
children: [
|
|
2806
|
-
|
|
2807
|
-
className: "
|
|
2808
|
-
children: actions.user(message)
|
|
3348
|
+
/* @__PURE__ */ jsx42(Music2, {
|
|
3349
|
+
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
2809
3350
|
}),
|
|
2810
|
-
/* @__PURE__ */
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
className: "text-[11px] text-muted-foreground"
|
|
2814
|
-
}),
|
|
2815
|
-
hasError && /* @__PURE__ */ jsx35(AlertCircle, {
|
|
2816
|
-
className: "h-3 w-3 text-destructive"
|
|
3351
|
+
/* @__PURE__ */ jsx42("span", {
|
|
3352
|
+
className: "truncate max-w-[150px]",
|
|
3353
|
+
children: audio.id || `Audio ${idx + 1}`
|
|
2817
3354
|
})
|
|
2818
3355
|
]
|
|
2819
|
-
})
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
children: [
|
|
2826
|
-
avatars?.assistant,
|
|
2827
|
-
/* @__PURE__ */ jsxs20("div", {
|
|
2828
|
-
className: cn("flex-1 min-w-0 space-y-3", classNames?.assistant?.container),
|
|
2829
|
-
children: [
|
|
2830
|
-
renderContent ? renderContent(message) : /* @__PURE__ */ jsxs20(Fragment5, {
|
|
3356
|
+
}, `audio-${idx}`)),
|
|
3357
|
+
message.files?.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx42(FilePreviewCard, {
|
|
3358
|
+
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
3359
|
+
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
3360
|
+
}, `file-${idx}`) : /* @__PURE__ */ jsxs25("div", {
|
|
3361
|
+
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",
|
|
2831
3362
|
children: [
|
|
2832
|
-
|
|
2833
|
-
className:
|
|
2834
|
-
children: [
|
|
2835
|
-
/* @__PURE__ */ jsxs20("div", {
|
|
2836
|
-
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2837
|
-
children: [
|
|
2838
|
-
/* @__PURE__ */ jsx35(Lightbulb, {
|
|
2839
|
-
className: "h-3.5 w-3.5"
|
|
2840
|
-
}),
|
|
2841
|
-
"Reasoning (",
|
|
2842
|
-
message.extra_data.reasoning_steps.length,
|
|
2843
|
-
" steps)"
|
|
2844
|
-
]
|
|
2845
|
-
}),
|
|
2846
|
-
/* @__PURE__ */ jsx35(Accordion, {
|
|
2847
|
-
type: "multiple",
|
|
2848
|
-
className: "w-full",
|
|
2849
|
-
children: message.extra_data.reasoning_steps.map((step, idx) => /* @__PURE__ */ jsxs20(AccordionItem, {
|
|
2850
|
-
value: `reasoning-${idx}`,
|
|
2851
|
-
className: "border-muted",
|
|
2852
|
-
children: [
|
|
2853
|
-
/* @__PURE__ */ jsx35(AccordionTrigger, {
|
|
2854
|
-
className: "text-xs py-1.5 hover:no-underline",
|
|
2855
|
-
children: step.title || `Step ${idx + 1}`
|
|
2856
|
-
}),
|
|
2857
|
-
/* @__PURE__ */ jsxs20(AccordionContent, {
|
|
2858
|
-
className: "space-y-1.5 text-xs text-muted-foreground",
|
|
2859
|
-
children: [
|
|
2860
|
-
step.action && /* @__PURE__ */ jsxs20("div", {
|
|
2861
|
-
children: [
|
|
2862
|
-
/* @__PURE__ */ jsx35("span", {
|
|
2863
|
-
className: "font-medium text-foreground",
|
|
2864
|
-
children: "Action:"
|
|
2865
|
-
}),
|
|
2866
|
-
" ",
|
|
2867
|
-
step.action
|
|
2868
|
-
]
|
|
2869
|
-
}),
|
|
2870
|
-
step.reasoning && /* @__PURE__ */ jsxs20("div", {
|
|
2871
|
-
children: [
|
|
2872
|
-
/* @__PURE__ */ jsx35("span", {
|
|
2873
|
-
className: "font-medium text-foreground",
|
|
2874
|
-
children: "Reasoning:"
|
|
2875
|
-
}),
|
|
2876
|
-
" ",
|
|
2877
|
-
step.reasoning
|
|
2878
|
-
]
|
|
2879
|
-
}),
|
|
2880
|
-
step.result && /* @__PURE__ */ jsxs20("div", {
|
|
2881
|
-
children: [
|
|
2882
|
-
/* @__PURE__ */ jsx35("span", {
|
|
2883
|
-
className: "font-medium text-foreground",
|
|
2884
|
-
children: "Result:"
|
|
2885
|
-
}),
|
|
2886
|
-
" ",
|
|
2887
|
-
step.result
|
|
2888
|
-
]
|
|
2889
|
-
}),
|
|
2890
|
-
step.confidence !== undefined && /* @__PURE__ */ jsxs20("div", {
|
|
2891
|
-
children: [
|
|
2892
|
-
/* @__PURE__ */ jsx35("span", {
|
|
2893
|
-
className: "font-medium text-foreground",
|
|
2894
|
-
children: "Confidence:"
|
|
2895
|
-
}),
|
|
2896
|
-
" ",
|
|
2897
|
-
(step.confidence * 100).toFixed(1),
|
|
2898
|
-
"%"
|
|
2899
|
-
]
|
|
2900
|
-
})
|
|
2901
|
-
]
|
|
2902
|
-
})
|
|
2903
|
-
]
|
|
2904
|
-
}, idx))
|
|
2905
|
-
})
|
|
2906
|
-
]
|
|
2907
|
-
}),
|
|
2908
|
-
message.content && /* @__PURE__ */ jsx35("div", {
|
|
2909
|
-
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",
|
|
2910
|
-
children: /* @__PURE__ */ jsx35(Response, {
|
|
2911
|
-
children: message.content
|
|
2912
|
-
})
|
|
3363
|
+
/* @__PURE__ */ jsx42(FileIcon4, {
|
|
3364
|
+
className: "h-3.5 w-3.5 text-muted-foreground"
|
|
2913
3365
|
}),
|
|
2914
|
-
|
|
2915
|
-
className: "
|
|
2916
|
-
children:
|
|
2917
|
-
const uiComponent = tool.ui_component;
|
|
2918
|
-
return /* @__PURE__ */ jsx35("div", {
|
|
2919
|
-
children: uiComponent.layout === "artifact" ? /* @__PURE__ */ jsx35(Artifact, {
|
|
2920
|
-
children: /* @__PURE__ */ jsx35(GenerativeUIRenderer, {
|
|
2921
|
-
spec: uiComponent,
|
|
2922
|
-
className: "w-full p-2"
|
|
2923
|
-
})
|
|
2924
|
-
}) : /* @__PURE__ */ jsx35(GenerativeUIRenderer, {
|
|
2925
|
-
spec: uiComponent,
|
|
2926
|
-
className: "w-full"
|
|
2927
|
-
})
|
|
2928
|
-
}, tool.tool_call_id);
|
|
2929
|
-
})
|
|
2930
|
-
}),
|
|
2931
|
-
toolResultRenderers && message.tool_calls?.map((tool) => {
|
|
2932
|
-
const renderer = toolResultRenderers[tool.tool_name];
|
|
2933
|
-
const content = tool.result ?? tool.content;
|
|
2934
|
-
if (!renderer || !content)
|
|
2935
|
-
return null;
|
|
2936
|
-
return /* @__PURE__ */ jsx35("div", {
|
|
2937
|
-
children: renderer(tool.tool_args, content)
|
|
2938
|
-
}, `result-${tool.tool_call_id}`);
|
|
2939
|
-
}),
|
|
2940
|
-
renderMedia ? renderMedia(message) : (() => {
|
|
2941
|
-
const mediaClassName = classNames?.assistant?.media;
|
|
2942
|
-
return /* @__PURE__ */ jsxs20(Fragment5, {
|
|
2943
|
-
children: [
|
|
2944
|
-
message.images && message.images.length > 0 && /* @__PURE__ */ jsxs20("div", {
|
|
2945
|
-
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2946
|
-
children: [
|
|
2947
|
-
/* @__PURE__ */ jsxs20("div", {
|
|
2948
|
-
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2949
|
-
children: [
|
|
2950
|
-
/* @__PURE__ */ jsx35(ImageIcon2, {
|
|
2951
|
-
className: "h-3.5 w-3.5"
|
|
2952
|
-
}),
|
|
2953
|
-
"Images (",
|
|
2954
|
-
message.images.length,
|
|
2955
|
-
")"
|
|
2956
|
-
]
|
|
2957
|
-
}),
|
|
2958
|
-
/* @__PURE__ */ jsx35("div", {
|
|
2959
|
-
className: "grid grid-cols-2 gap-2",
|
|
2960
|
-
children: message.images.map((img, idx) => /* @__PURE__ */ jsxs20("div", {
|
|
2961
|
-
className: "space-y-1",
|
|
2962
|
-
children: [
|
|
2963
|
-
showImageLightbox ? /* @__PURE__ */ jsx35("button", {
|
|
2964
|
-
type: "button",
|
|
2965
|
-
onClick: () => openImageLightbox(message.images.map((i) => ({ url: i.url, alt: i.revised_prompt })), idx),
|
|
2966
|
-
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",
|
|
2967
|
-
children: /* @__PURE__ */ jsx35("img", {
|
|
2968
|
-
src: img.url,
|
|
2969
|
-
alt: img.revised_prompt || "Generated image",
|
|
2970
|
-
className: "w-full rounded-lg"
|
|
2971
|
-
})
|
|
2972
|
-
}) : /* @__PURE__ */ jsx35("img", {
|
|
2973
|
-
src: img.url,
|
|
2974
|
-
alt: img.revised_prompt || "Generated image",
|
|
2975
|
-
className: "w-full rounded-lg border border-border"
|
|
2976
|
-
}),
|
|
2977
|
-
img.revised_prompt && /* @__PURE__ */ jsx35("p", {
|
|
2978
|
-
className: "text-[11px] text-muted-foreground italic px-0.5",
|
|
2979
|
-
children: img.revised_prompt
|
|
2980
|
-
})
|
|
2981
|
-
]
|
|
2982
|
-
}, idx))
|
|
2983
|
-
})
|
|
2984
|
-
]
|
|
2985
|
-
}),
|
|
2986
|
-
message.videos && message.videos.length > 0 && /* @__PURE__ */ jsxs20("div", {
|
|
2987
|
-
className: cn("space-y-2 pt-1", mediaClassName),
|
|
2988
|
-
children: [
|
|
2989
|
-
/* @__PURE__ */ jsxs20("div", {
|
|
2990
|
-
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
2991
|
-
children: [
|
|
2992
|
-
/* @__PURE__ */ jsx35(Video, {
|
|
2993
|
-
className: "h-3.5 w-3.5"
|
|
2994
|
-
}),
|
|
2995
|
-
"Videos (",
|
|
2996
|
-
message.videos.length,
|
|
2997
|
-
")"
|
|
2998
|
-
]
|
|
2999
|
-
}),
|
|
3000
|
-
/* @__PURE__ */ jsx35("div", {
|
|
3001
|
-
className: "space-y-2",
|
|
3002
|
-
children: message.videos.map((video, idx) => /* @__PURE__ */ jsx35("div", {
|
|
3003
|
-
children: video.url ? /* @__PURE__ */ jsx35("video", {
|
|
3004
|
-
src: video.url,
|
|
3005
|
-
controls: true,
|
|
3006
|
-
className: "w-full rounded-lg border border-border"
|
|
3007
|
-
}) : /* @__PURE__ */ jsxs20("div", {
|
|
3008
|
-
className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
|
|
3009
|
-
children: [
|
|
3010
|
-
"Video ID: ",
|
|
3011
|
-
video.id,
|
|
3012
|
-
" (ETA: ",
|
|
3013
|
-
video.eta,
|
|
3014
|
-
"s)"
|
|
3015
|
-
]
|
|
3016
|
-
})
|
|
3017
|
-
}, idx))
|
|
3018
|
-
})
|
|
3019
|
-
]
|
|
3020
|
-
}),
|
|
3021
|
-
message.audio && message.audio.length > 0 && /* @__PURE__ */ jsxs20("div", {
|
|
3022
|
-
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3023
|
-
children: [
|
|
3024
|
-
/* @__PURE__ */ jsxs20("div", {
|
|
3025
|
-
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3026
|
-
children: [
|
|
3027
|
-
/* @__PURE__ */ jsx35(Music, {
|
|
3028
|
-
className: "h-3.5 w-3.5"
|
|
3029
|
-
}),
|
|
3030
|
-
"Audio (",
|
|
3031
|
-
message.audio.length,
|
|
3032
|
-
")"
|
|
3033
|
-
]
|
|
3034
|
-
}),
|
|
3035
|
-
/* @__PURE__ */ jsx35("div", {
|
|
3036
|
-
className: "space-y-2",
|
|
3037
|
-
children: message.audio.map((audio, idx) => /* @__PURE__ */ jsx35("div", {
|
|
3038
|
-
children: audio.url ? /* @__PURE__ */ jsx35("audio", {
|
|
3039
|
-
src: audio.url,
|
|
3040
|
-
controls: true,
|
|
3041
|
-
className: "w-full"
|
|
3042
|
-
}) : audio.base64_audio ? /* @__PURE__ */ jsx35("audio", {
|
|
3043
|
-
src: `data:${audio.mime_type || "audio/wav"};base64,${audio.base64_audio}`,
|
|
3044
|
-
controls: true,
|
|
3045
|
-
className: "w-full"
|
|
3046
|
-
}) : /* @__PURE__ */ jsx35("div", {
|
|
3047
|
-
className: "bg-muted/50 border border-border p-2.5 rounded-lg text-xs text-muted-foreground",
|
|
3048
|
-
children: "Audio data unavailable"
|
|
3049
|
-
})
|
|
3050
|
-
}, idx))
|
|
3051
|
-
})
|
|
3052
|
-
]
|
|
3053
|
-
}),
|
|
3054
|
-
message.files && message.files.length > 0 && /* @__PURE__ */ jsxs20("div", {
|
|
3055
|
-
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3056
|
-
children: [
|
|
3057
|
-
/* @__PURE__ */ jsxs20("div", {
|
|
3058
|
-
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3059
|
-
children: [
|
|
3060
|
-
/* @__PURE__ */ jsx35(Paperclip, {
|
|
3061
|
-
className: "h-3.5 w-3.5"
|
|
3062
|
-
}),
|
|
3063
|
-
"Files (",
|
|
3064
|
-
message.files.length,
|
|
3065
|
-
")"
|
|
3066
|
-
]
|
|
3067
|
-
}),
|
|
3068
|
-
/* @__PURE__ */ jsx35("div", {
|
|
3069
|
-
className: "flex flex-wrap gap-2",
|
|
3070
|
-
children: message.files.map((file, idx) => showFilePreview ? /* @__PURE__ */ jsx35(FilePreviewCard, {
|
|
3071
|
-
file: { name: file.name, type: file.type, url: file.url, size: file.size },
|
|
3072
|
-
onClick: () => openFilePreview({ name: file.name, type: file.type, url: file.url, size: file.size })
|
|
3073
|
-
}, idx) : /* @__PURE__ */ jsxs20("div", {
|
|
3074
|
-
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",
|
|
3075
|
-
children: [
|
|
3076
|
-
/* @__PURE__ */ jsx35(FileIcon3, {
|
|
3077
|
-
className: "h-3.5 w-3.5 shrink-0 text-muted-foreground"
|
|
3078
|
-
}),
|
|
3079
|
-
/* @__PURE__ */ jsx35("span", {
|
|
3080
|
-
className: "truncate max-w-[180px]",
|
|
3081
|
-
children: file.name
|
|
3082
|
-
}),
|
|
3083
|
-
file.size && /* @__PURE__ */ jsxs20("span", {
|
|
3084
|
-
className: "text-muted-foreground/70",
|
|
3085
|
-
children: [
|
|
3086
|
-
"(",
|
|
3087
|
-
(file.size / 1024).toFixed(1),
|
|
3088
|
-
"KB)"
|
|
3089
|
-
]
|
|
3090
|
-
}),
|
|
3091
|
-
file.url && /^https?:\/\//i.test(file.url) && /* @__PURE__ */ jsx35("a", {
|
|
3092
|
-
href: file.url,
|
|
3093
|
-
target: "_blank",
|
|
3094
|
-
rel: "noopener noreferrer",
|
|
3095
|
-
className: "text-primary hover:underline font-medium",
|
|
3096
|
-
children: "View"
|
|
3097
|
-
})
|
|
3098
|
-
]
|
|
3099
|
-
}, idx))
|
|
3100
|
-
})
|
|
3101
|
-
]
|
|
3102
|
-
}),
|
|
3103
|
-
message.response_audio && /* @__PURE__ */ jsxs20("div", {
|
|
3104
|
-
className: cn("space-y-2 pt-1", mediaClassName),
|
|
3105
|
-
children: [
|
|
3106
|
-
/* @__PURE__ */ jsxs20("div", {
|
|
3107
|
-
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3108
|
-
children: [
|
|
3109
|
-
/* @__PURE__ */ jsx35(Music, {
|
|
3110
|
-
className: "h-3.5 w-3.5"
|
|
3111
|
-
}),
|
|
3112
|
-
"Response Audio"
|
|
3113
|
-
]
|
|
3114
|
-
}),
|
|
3115
|
-
message.response_audio.transcript && /* @__PURE__ */ jsxs20("div", {
|
|
3116
|
-
className: "text-xs italic bg-muted/50 border border-border p-2.5 rounded-lg text-muted-foreground",
|
|
3117
|
-
children: [
|
|
3118
|
-
'"',
|
|
3119
|
-
message.response_audio.transcript,
|
|
3120
|
-
'"'
|
|
3121
|
-
]
|
|
3122
|
-
}),
|
|
3123
|
-
message.response_audio.content && /* @__PURE__ */ jsx35("audio", {
|
|
3124
|
-
src: `data:audio/wav;base64,${message.response_audio.content}`,
|
|
3125
|
-
controls: true,
|
|
3126
|
-
className: "w-full"
|
|
3127
|
-
})
|
|
3128
|
-
]
|
|
3129
|
-
})
|
|
3130
|
-
]
|
|
3131
|
-
});
|
|
3132
|
-
})(),
|
|
3133
|
-
showToolCalls && message.tool_calls && message.tool_calls.length > 0 && /* @__PURE__ */ jsx35("div", {
|
|
3134
|
-
className: cn("space-y-2 pt-1", classNames?.assistant?.toolCalls),
|
|
3135
|
-
children: message.tool_calls.map((tool, idx) => renderToolCall ? renderToolCall(tool, idx) : /* @__PURE__ */ jsxs20(Tool, {
|
|
3136
|
-
defaultOpen: idx === 0,
|
|
3137
|
-
children: [
|
|
3138
|
-
/* @__PURE__ */ jsx35(ToolHeader, {
|
|
3139
|
-
title: tool.tool_name,
|
|
3140
|
-
type: "tool-use",
|
|
3141
|
-
state: getToolState(tool)
|
|
3142
|
-
}),
|
|
3143
|
-
/* @__PURE__ */ jsxs20(ToolContent, {
|
|
3144
|
-
children: [
|
|
3145
|
-
/* @__PURE__ */ jsx35(ToolInput, {
|
|
3146
|
-
input: tool.tool_args
|
|
3147
|
-
}),
|
|
3148
|
-
tool.content && /* @__PURE__ */ jsx35(ToolOutput, {
|
|
3149
|
-
output: tool.content,
|
|
3150
|
-
errorText: tool.tool_call_error ? "Tool execution failed" : undefined
|
|
3151
|
-
})
|
|
3152
|
-
]
|
|
3153
|
-
})
|
|
3154
|
-
]
|
|
3155
|
-
}, tool.tool_call_id || idx))
|
|
3156
|
-
}),
|
|
3157
|
-
showReferences && message.extra_data?.references && message.extra_data.references.length > 0 && /* @__PURE__ */ jsxs20("div", {
|
|
3158
|
-
className: cn("space-y-2 pt-1", classNames?.assistant?.references),
|
|
3159
|
-
children: [
|
|
3160
|
-
/* @__PURE__ */ jsxs20("div", {
|
|
3161
|
-
className: "flex items-center gap-2 text-xs font-medium text-muted-foreground",
|
|
3162
|
-
children: [
|
|
3163
|
-
/* @__PURE__ */ jsx35(FileText, {
|
|
3164
|
-
className: "h-3.5 w-3.5"
|
|
3165
|
-
}),
|
|
3166
|
-
"References (",
|
|
3167
|
-
message.extra_data.references.length,
|
|
3168
|
-
")"
|
|
3169
|
-
]
|
|
3170
|
-
}),
|
|
3171
|
-
/* @__PURE__ */ jsx35("div", {
|
|
3172
|
-
className: "space-y-2",
|
|
3173
|
-
children: message.extra_data.references.map((refData, idx) => /* @__PURE__ */ jsxs20("div", {
|
|
3174
|
-
className: "text-xs space-y-1.5",
|
|
3175
|
-
children: [
|
|
3176
|
-
refData.query && /* @__PURE__ */ jsxs20("div", {
|
|
3177
|
-
className: "font-medium text-foreground",
|
|
3178
|
-
children: [
|
|
3179
|
-
"Query: ",
|
|
3180
|
-
refData.query
|
|
3181
|
-
]
|
|
3182
|
-
}),
|
|
3183
|
-
refData.references.map((ref, refIdx) => /* @__PURE__ */ jsxs20("div", {
|
|
3184
|
-
className: "bg-muted/50 border border-border p-2.5 rounded-lg",
|
|
3185
|
-
children: [
|
|
3186
|
-
/* @__PURE__ */ jsxs20("div", {
|
|
3187
|
-
className: "italic text-muted-foreground mb-1",
|
|
3188
|
-
children: [
|
|
3189
|
-
'"',
|
|
3190
|
-
ref.content,
|
|
3191
|
-
'"'
|
|
3192
|
-
]
|
|
3193
|
-
}),
|
|
3194
|
-
/* @__PURE__ */ jsxs20("div", {
|
|
3195
|
-
className: "text-muted-foreground/70",
|
|
3196
|
-
children: [
|
|
3197
|
-
"Source: ",
|
|
3198
|
-
ref.name,
|
|
3199
|
-
" (chunk ",
|
|
3200
|
-
ref.meta_data.chunk,
|
|
3201
|
-
"/",
|
|
3202
|
-
ref.meta_data.chunk_size,
|
|
3203
|
-
")"
|
|
3204
|
-
]
|
|
3205
|
-
})
|
|
3206
|
-
]
|
|
3207
|
-
}, refIdx))
|
|
3208
|
-
]
|
|
3209
|
-
}, idx))
|
|
3210
|
-
})
|
|
3211
|
-
]
|
|
3366
|
+
/* @__PURE__ */ jsx42("span", {
|
|
3367
|
+
className: "truncate max-w-[150px]",
|
|
3368
|
+
children: file.name
|
|
3212
3369
|
})
|
|
3213
3370
|
]
|
|
3371
|
+
}, `file-${idx}`))
|
|
3372
|
+
]
|
|
3373
|
+
}),
|
|
3374
|
+
message.content && /* @__PURE__ */ jsx42("div", {
|
|
3375
|
+
className: cn("rounded-2xl rounded-br-md px-4 py-2.5", classNames?.user?.bubble ?? "bg-primary text-primary-foreground", hasError && "opacity-70"),
|
|
3376
|
+
children: /* @__PURE__ */ jsx42("p", {
|
|
3377
|
+
className: "text-sm whitespace-pre-wrap",
|
|
3378
|
+
children: message.content
|
|
3379
|
+
})
|
|
3380
|
+
}),
|
|
3381
|
+
(showTimestamp || actions?.user) && /* @__PURE__ */ jsxs25("div", {
|
|
3382
|
+
className: "flex items-center justify-end gap-1.5 px-1",
|
|
3383
|
+
children: [
|
|
3384
|
+
actions?.user && /* @__PURE__ */ jsx42("div", {
|
|
3385
|
+
className: "flex items-center gap-1",
|
|
3386
|
+
children: actions.user(message)
|
|
3214
3387
|
}),
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
|
|
3219
|
-
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
|
-
const useHover = visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage;
|
|
3223
|
-
return /* @__PURE__ */ jsx35("div", {
|
|
3224
|
-
className: cn("flex items-center gap-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100", classNames?.assistant?.actions),
|
|
3225
|
-
children: actions.assistant(message)
|
|
3226
|
-
});
|
|
3227
|
-
})(),
|
|
3228
|
-
hasError && /* @__PURE__ */ jsxs20("span", {
|
|
3229
|
-
className: "flex items-center gap-1 text-[11px] text-destructive",
|
|
3230
|
-
children: [
|
|
3231
|
-
/* @__PURE__ */ jsx35(AlertCircle, {
|
|
3232
|
-
className: "h-3 w-3"
|
|
3233
|
-
}),
|
|
3234
|
-
"Error"
|
|
3235
|
-
]
|
|
3236
|
-
}),
|
|
3237
|
-
showTimestamp && /* @__PURE__ */ jsx35(SmartTimestamp, {
|
|
3238
|
-
date: new Date(message.created_at * 1000),
|
|
3239
|
-
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
3240
|
-
className: "text-[11px] text-muted-foreground"
|
|
3241
|
-
})
|
|
3242
|
-
]
|
|
3388
|
+
/* @__PURE__ */ jsx42(SmartTimestamp, {
|
|
3389
|
+
date: new Date(message.created_at * 1000),
|
|
3390
|
+
formatShort: isCustomTimestamp ? resolvedFormatTimestamp : undefined,
|
|
3391
|
+
className: "text-[11px] text-muted-foreground"
|
|
3392
|
+
}),
|
|
3393
|
+
hasError && /* @__PURE__ */ jsx42(AlertCircle2, {
|
|
3394
|
+
className: "h-3 w-3 text-destructive"
|
|
3243
3395
|
})
|
|
3244
3396
|
]
|
|
3245
3397
|
})
|
|
3246
3398
|
]
|
|
3247
|
-
})
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3399
|
+
})
|
|
3400
|
+
]
|
|
3401
|
+
});
|
|
3402
|
+
}
|
|
3403
|
+
|
|
3404
|
+
// src/ui/composed/AgnoMessageItem.tsx
|
|
3405
|
+
import { jsx as jsx43, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
3406
|
+
function AgnoMessageItem({
|
|
3407
|
+
message,
|
|
3408
|
+
className,
|
|
3409
|
+
classNames,
|
|
3410
|
+
avatars,
|
|
3411
|
+
actions,
|
|
3412
|
+
isLastAssistantMessage = false,
|
|
3413
|
+
showReasoning = true,
|
|
3414
|
+
showReferences = true,
|
|
3415
|
+
showTimestamp = true,
|
|
3416
|
+
showFilePreview = true,
|
|
3417
|
+
showImageLightbox = true,
|
|
3418
|
+
formatTimestamp,
|
|
3419
|
+
renderTool
|
|
3420
|
+
}) {
|
|
3421
|
+
return /* @__PURE__ */ jsxs26(AgnoMessage, {
|
|
3422
|
+
message,
|
|
3423
|
+
className,
|
|
3424
|
+
classNames,
|
|
3425
|
+
avatars,
|
|
3426
|
+
actions,
|
|
3427
|
+
isLastAssistantMessage,
|
|
3428
|
+
showTimestamp,
|
|
3429
|
+
showFilePreview,
|
|
3430
|
+
showImageLightbox,
|
|
3431
|
+
formatTimestamp,
|
|
3432
|
+
renderTool,
|
|
3433
|
+
children: [
|
|
3434
|
+
showReasoning && /* @__PURE__ */ jsx43(AgnoMessage.Reasoning, {}),
|
|
3435
|
+
/* @__PURE__ */ jsx43(AgnoMessage.Media, {}),
|
|
3436
|
+
/* @__PURE__ */ jsx43(AgnoMessage.Tools, {}),
|
|
3437
|
+
/* @__PURE__ */ jsx43(AgnoMessage.Content, {}),
|
|
3438
|
+
showReferences && /* @__PURE__ */ jsx43(AgnoMessage.References, {}),
|
|
3439
|
+
/* @__PURE__ */ jsx43(AgnoMessage.Footer, {
|
|
3440
|
+
showTimestamp
|
|
3264
3441
|
})
|
|
3265
3442
|
]
|
|
3266
3443
|
});
|
|
3267
3444
|
}
|
|
3268
3445
|
// src/ui/composed/AgnoChatInput.tsx
|
|
3269
3446
|
import { CircleStop } from "lucide-react";
|
|
3270
|
-
import { jsx as
|
|
3447
|
+
import { jsx as jsx44, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
3271
3448
|
var DEFAULT_ACCEPTED_FILE_TYPES = "image/*,audio/*,.pdf,.doc,.docx,.txt,.csv,.xlsx,.xls,.ppt,.pptx,.md,.json,.xml";
|
|
3272
3449
|
function normalizeAudio(audio) {
|
|
3273
3450
|
if (audio === true)
|
|
@@ -3287,14 +3464,14 @@ function dataUrlToBlob(dataUrl) {
|
|
|
3287
3464
|
return new Blob([buf], { type: mime });
|
|
3288
3465
|
}
|
|
3289
3466
|
function CancelButton({ onCancel }) {
|
|
3290
|
-
return /* @__PURE__ */
|
|
3467
|
+
return /* @__PURE__ */ jsx44(Button, {
|
|
3291
3468
|
type: "button",
|
|
3292
3469
|
variant: "destructive",
|
|
3293
3470
|
size: "icon",
|
|
3294
3471
|
className: "h-8 w-8 rounded-lg",
|
|
3295
3472
|
onClick: onCancel,
|
|
3296
3473
|
"aria-label": "Stop",
|
|
3297
|
-
children: /* @__PURE__ */
|
|
3474
|
+
children: /* @__PURE__ */ jsx44(CircleStop, {
|
|
3298
3475
|
className: "size-4"
|
|
3299
3476
|
})
|
|
3300
3477
|
});
|
|
@@ -3302,7 +3479,7 @@ function CancelButton({ onCancel }) {
|
|
|
3302
3479
|
function SubmitButton({ disabled, status }) {
|
|
3303
3480
|
const { textInput } = usePromptInputController();
|
|
3304
3481
|
const hasText = textInput.value.trim().length > 0;
|
|
3305
|
-
return /* @__PURE__ */
|
|
3482
|
+
return /* @__PURE__ */ jsx44(PromptInputSubmit, {
|
|
3306
3483
|
disabled: disabled || !hasText,
|
|
3307
3484
|
status
|
|
3308
3485
|
});
|
|
@@ -3311,9 +3488,9 @@ function AttachmentHeader() {
|
|
|
3311
3488
|
const { files } = usePromptInputAttachments();
|
|
3312
3489
|
if (files.length === 0)
|
|
3313
3490
|
return null;
|
|
3314
|
-
return /* @__PURE__ */
|
|
3315
|
-
children: /* @__PURE__ */
|
|
3316
|
-
children: (attachment) => /* @__PURE__ */
|
|
3491
|
+
return /* @__PURE__ */ jsx44(PromptInputHeader, {
|
|
3492
|
+
children: /* @__PURE__ */ jsx44(PromptInputAttachments, {
|
|
3493
|
+
children: (attachment) => /* @__PURE__ */ jsx44(PromptInputAttachment, {
|
|
3317
3494
|
data: attachment
|
|
3318
3495
|
})
|
|
3319
3496
|
})
|
|
@@ -3328,7 +3505,7 @@ function TranscribeAudioRecorder({
|
|
|
3328
3505
|
labels
|
|
3329
3506
|
}) {
|
|
3330
3507
|
const { textInput } = usePromptInputController();
|
|
3331
|
-
return /* @__PURE__ */
|
|
3508
|
+
return /* @__PURE__ */ jsx44(AudioRecorder, {
|
|
3332
3509
|
mode: "transcribe",
|
|
3333
3510
|
transcriptionEndpoint: endpoint,
|
|
3334
3511
|
transcriptionHeaders: headers,
|
|
@@ -3392,8 +3569,8 @@ function AgnoChatInput({
|
|
|
3392
3569
|
};
|
|
3393
3570
|
const computedStatus = status ?? (disabled ? "submitted" : undefined);
|
|
3394
3571
|
const showCancelButton = allowCancelRun && isStreaming && onCancel;
|
|
3395
|
-
return /* @__PURE__ */
|
|
3396
|
-
children: /* @__PURE__ */
|
|
3572
|
+
return /* @__PURE__ */ jsx44(PromptInputProvider, {
|
|
3573
|
+
children: /* @__PURE__ */ jsxs27(PromptInput, {
|
|
3397
3574
|
onSubmit: handleSubmit,
|
|
3398
3575
|
accept: fileUpload?.accept ?? DEFAULT_ACCEPTED_FILE_TYPES,
|
|
3399
3576
|
multiple: fileUpload?.multiple ?? true,
|
|
@@ -3403,35 +3580,35 @@ function AgnoChatInput({
|
|
|
3403
3580
|
dragListenerTarget: dropZoneContainerRef,
|
|
3404
3581
|
className: cn("w-full", className),
|
|
3405
3582
|
children: [
|
|
3406
|
-
/* @__PURE__ */
|
|
3407
|
-
/* @__PURE__ */
|
|
3408
|
-
children: /* @__PURE__ */
|
|
3583
|
+
/* @__PURE__ */ jsx44(AttachmentHeader, {}),
|
|
3584
|
+
/* @__PURE__ */ jsx44(PromptInputBody, {
|
|
3585
|
+
children: /* @__PURE__ */ jsx44(PromptInputTextarea, {
|
|
3409
3586
|
placeholder: placeholder || "Type your message... (Enter to send, Shift+Enter for new line)",
|
|
3410
3587
|
disabled
|
|
3411
3588
|
})
|
|
3412
3589
|
}),
|
|
3413
|
-
/* @__PURE__ */
|
|
3590
|
+
/* @__PURE__ */ jsxs27(PromptInputFooter, {
|
|
3414
3591
|
children: [
|
|
3415
|
-
/* @__PURE__ */
|
|
3592
|
+
/* @__PURE__ */ jsxs27(PromptInputTools, {
|
|
3416
3593
|
children: [
|
|
3417
|
-
showAttachments && /* @__PURE__ */
|
|
3594
|
+
showAttachments && /* @__PURE__ */ jsxs27(PromptInputActionMenu, {
|
|
3418
3595
|
children: [
|
|
3419
|
-
/* @__PURE__ */
|
|
3420
|
-
/* @__PURE__ */
|
|
3421
|
-
children: /* @__PURE__ */
|
|
3596
|
+
/* @__PURE__ */ jsx44(PromptInputActionMenuTrigger, {}),
|
|
3597
|
+
/* @__PURE__ */ jsx44(PromptInputActionMenuContent, {
|
|
3598
|
+
children: /* @__PURE__ */ jsx44(PromptInputActionAddAttachments, {
|
|
3422
3599
|
label: "Add files"
|
|
3423
3600
|
})
|
|
3424
3601
|
})
|
|
3425
3602
|
]
|
|
3426
3603
|
}),
|
|
3427
|
-
audioEnabled && (audioMode === "transcribe" && resolvedAudio?.endpoint ? /* @__PURE__ */
|
|
3604
|
+
audioEnabled && (audioMode === "transcribe" && resolvedAudio?.endpoint ? /* @__PURE__ */ jsx44(TranscribeAudioRecorder, {
|
|
3428
3605
|
endpoint: resolvedAudio.endpoint,
|
|
3429
3606
|
headers: resolvedAudio.headers,
|
|
3430
3607
|
disabled,
|
|
3431
3608
|
parseResponse: resolvedAudio.parseResponse,
|
|
3432
3609
|
onRequestPermission: resolvedAudio.requestPermission,
|
|
3433
3610
|
labels: resolvedAudio.labels
|
|
3434
|
-
}) : /* @__PURE__ */
|
|
3611
|
+
}) : /* @__PURE__ */ jsx44(AudioRecorder, {
|
|
3435
3612
|
onRecordingComplete: handleAudioRecording,
|
|
3436
3613
|
disabled,
|
|
3437
3614
|
onRequestPermission: resolvedAudio?.requestPermission,
|
|
@@ -3440,15 +3617,15 @@ function AgnoChatInput({
|
|
|
3440
3617
|
extraTools
|
|
3441
3618
|
]
|
|
3442
3619
|
}),
|
|
3443
|
-
showCancelButton ? /* @__PURE__ */
|
|
3620
|
+
showCancelButton ? /* @__PURE__ */ jsx44(CancelButton, {
|
|
3444
3621
|
onCancel
|
|
3445
|
-
}) : /* @__PURE__ */
|
|
3622
|
+
}) : /* @__PURE__ */ jsx44(SubmitButton, {
|
|
3446
3623
|
disabled,
|
|
3447
3624
|
status: computedStatus
|
|
3448
3625
|
})
|
|
3449
3626
|
]
|
|
3450
3627
|
}),
|
|
3451
|
-
showAttachments && /* @__PURE__ */
|
|
3628
|
+
showAttachments && /* @__PURE__ */ jsx44(PromptInputDropZone, {
|
|
3452
3629
|
...dropZoneProps,
|
|
3453
3630
|
container: dropZoneContainerRef
|
|
3454
3631
|
})
|
|
@@ -3456,36 +3633,516 @@ function AgnoChatInput({
|
|
|
3456
3633
|
})
|
|
3457
3634
|
});
|
|
3458
3635
|
}
|
|
3459
|
-
// src/ui/composed/agno-chat/
|
|
3460
|
-
|
|
3461
|
-
|
|
3636
|
+
// src/ui/composed/agno-chat/render-tool.ts
|
|
3637
|
+
function byToolName(map, fallback) {
|
|
3638
|
+
return (tool, args) => {
|
|
3639
|
+
if (!Object.prototype.hasOwnProperty.call(map, tool.tool_name)) {
|
|
3640
|
+
return fallback ? fallback(tool, args) : args.defaultRender();
|
|
3641
|
+
}
|
|
3642
|
+
const entry = map[tool.tool_name];
|
|
3643
|
+
if (entry === false)
|
|
3644
|
+
return null;
|
|
3645
|
+
return entry(tool, args);
|
|
3646
|
+
};
|
|
3647
|
+
}
|
|
3648
|
+
// src/ui/composed/generative-components/charts.tsx
|
|
3649
|
+
import {
|
|
3650
|
+
BarChart as RechartsBarChart,
|
|
3651
|
+
Bar,
|
|
3652
|
+
LineChart as RechartsLineChart,
|
|
3653
|
+
Line,
|
|
3654
|
+
AreaChart as RechartsAreaChart,
|
|
3655
|
+
Area,
|
|
3656
|
+
PieChart as RechartsPieChart,
|
|
3657
|
+
Pie,
|
|
3658
|
+
Cell,
|
|
3659
|
+
XAxis,
|
|
3660
|
+
YAxis,
|
|
3661
|
+
CartesianGrid,
|
|
3662
|
+
Legend as Legend2
|
|
3663
|
+
} from "recharts";
|
|
3462
3664
|
|
|
3463
|
-
// src/ui/
|
|
3464
|
-
import
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3665
|
+
// src/ui/components/chart.tsx
|
|
3666
|
+
import * as React11 from "react";
|
|
3667
|
+
import * as RechartsPrimitive from "recharts";
|
|
3668
|
+
import { jsx as jsx45, jsxs as jsxs28, Fragment as Fragment7 } from "react/jsx-runtime";
|
|
3669
|
+
var THEMES = { light: "", dark: ".dark" };
|
|
3670
|
+
var ChartContext = React11.createContext(null);
|
|
3671
|
+
function useChart() {
|
|
3672
|
+
const context = React11.useContext(ChartContext);
|
|
3673
|
+
if (!context) {
|
|
3674
|
+
throw new Error("useChart must be used within a <ChartContainer />");
|
|
3470
3675
|
}
|
|
3471
|
-
return
|
|
3676
|
+
return context;
|
|
3677
|
+
}
|
|
3678
|
+
var ChartContainer = React11.forwardRef(({ id, className, children, config, ...props }, ref) => {
|
|
3679
|
+
const uniqueId = React11.useId();
|
|
3680
|
+
const chartId = `chart-${id || uniqueId.replace(/:/g, "")}`;
|
|
3681
|
+
return /* @__PURE__ */ jsx45(ChartContext.Provider, {
|
|
3682
|
+
value: { config },
|
|
3683
|
+
children: /* @__PURE__ */ jsxs28("div", {
|
|
3684
|
+
"data-chart": chartId,
|
|
3685
|
+
ref,
|
|
3686
|
+
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),
|
|
3687
|
+
...props,
|
|
3688
|
+
children: [
|
|
3689
|
+
/* @__PURE__ */ jsx45(ChartStyle, {
|
|
3690
|
+
id: chartId,
|
|
3691
|
+
config
|
|
3692
|
+
}),
|
|
3693
|
+
/* @__PURE__ */ jsx45(RechartsPrimitive.ResponsiveContainer, {
|
|
3694
|
+
children
|
|
3695
|
+
})
|
|
3696
|
+
]
|
|
3697
|
+
})
|
|
3698
|
+
});
|
|
3699
|
+
});
|
|
3700
|
+
ChartContainer.displayName = "Chart";
|
|
3701
|
+
var ChartStyle = ({ id, config }) => {
|
|
3702
|
+
const colorConfig = Object.entries(config).filter(([, config2]) => config2.theme || config2.color);
|
|
3703
|
+
if (!colorConfig.length) {
|
|
3704
|
+
return null;
|
|
3705
|
+
}
|
|
3706
|
+
return /* @__PURE__ */ jsx45("style", {
|
|
3707
|
+
dangerouslySetInnerHTML: {
|
|
3708
|
+
__html: Object.entries(THEMES).map(([theme, prefix]) => `
|
|
3709
|
+
${prefix} [data-chart=${id}] {
|
|
3710
|
+
${colorConfig.map(([key, itemConfig]) => {
|
|
3711
|
+
const color = itemConfig.theme?.[theme] || itemConfig.color;
|
|
3712
|
+
return color ? ` --color-${key}: ${color};` : null;
|
|
3713
|
+
}).join(`
|
|
3714
|
+
`)}
|
|
3715
|
+
}
|
|
3716
|
+
`).join(`
|
|
3717
|
+
`)
|
|
3718
|
+
}
|
|
3719
|
+
});
|
|
3720
|
+
};
|
|
3721
|
+
var ChartTooltip = RechartsPrimitive.Tooltip;
|
|
3722
|
+
var ChartTooltipContent = React11.forwardRef(({
|
|
3723
|
+
active,
|
|
3724
|
+
payload,
|
|
3725
|
+
className,
|
|
3726
|
+
indicator = "dot",
|
|
3727
|
+
hideLabel = false,
|
|
3728
|
+
hideIndicator = false,
|
|
3729
|
+
label,
|
|
3730
|
+
labelFormatter,
|
|
3731
|
+
labelClassName,
|
|
3732
|
+
formatter,
|
|
3733
|
+
color,
|
|
3734
|
+
nameKey,
|
|
3735
|
+
labelKey
|
|
3736
|
+
}, ref) => {
|
|
3737
|
+
const { config } = useChart();
|
|
3738
|
+
const tooltipLabel = React11.useMemo(() => {
|
|
3739
|
+
if (hideLabel || !payload?.length) {
|
|
3740
|
+
return null;
|
|
3741
|
+
}
|
|
3742
|
+
const [item] = payload;
|
|
3743
|
+
const key = `${labelKey || item?.dataKey || item?.name || "value"}`;
|
|
3744
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
3745
|
+
const value = !labelKey && typeof label === "string" ? config[label]?.label || label : itemConfig?.label;
|
|
3746
|
+
if (labelFormatter) {
|
|
3747
|
+
return /* @__PURE__ */ jsx45("div", {
|
|
3748
|
+
className: cn("font-medium", labelClassName),
|
|
3749
|
+
children: labelFormatter(value, payload)
|
|
3750
|
+
});
|
|
3751
|
+
}
|
|
3752
|
+
if (!value) {
|
|
3753
|
+
return null;
|
|
3754
|
+
}
|
|
3755
|
+
return /* @__PURE__ */ jsx45("div", {
|
|
3756
|
+
className: cn("font-medium", labelClassName),
|
|
3757
|
+
children: value
|
|
3758
|
+
});
|
|
3759
|
+
}, [
|
|
3760
|
+
label,
|
|
3761
|
+
labelFormatter,
|
|
3762
|
+
payload,
|
|
3763
|
+
hideLabel,
|
|
3764
|
+
labelClassName,
|
|
3765
|
+
config,
|
|
3766
|
+
labelKey
|
|
3767
|
+
]);
|
|
3768
|
+
if (!active || !payload?.length) {
|
|
3769
|
+
return null;
|
|
3770
|
+
}
|
|
3771
|
+
const nestLabel = payload.length === 1 && indicator !== "dot";
|
|
3772
|
+
return /* @__PURE__ */ jsxs28("div", {
|
|
3773
|
+
ref,
|
|
3774
|
+
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),
|
|
3775
|
+
children: [
|
|
3776
|
+
!nestLabel ? tooltipLabel : null,
|
|
3777
|
+
/* @__PURE__ */ jsx45("div", {
|
|
3778
|
+
className: "grid gap-1.5",
|
|
3779
|
+
children: payload.filter((item) => item.type !== "none").map((item, index) => {
|
|
3780
|
+
const key = `${nameKey || item.name || item.dataKey || "value"}`;
|
|
3781
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
3782
|
+
const indicatorColor = color || item.payload.fill || item.color;
|
|
3783
|
+
return /* @__PURE__ */ jsx45("div", {
|
|
3784
|
+
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"),
|
|
3785
|
+
children: formatter && item?.value !== undefined && item.name ? formatter(item.value, item.name, item, index, item.payload) : /* @__PURE__ */ jsxs28(Fragment7, {
|
|
3786
|
+
children: [
|
|
3787
|
+
itemConfig?.icon ? /* @__PURE__ */ jsx45(itemConfig.icon, {}) : !hideIndicator && /* @__PURE__ */ jsx45("div", {
|
|
3788
|
+
className: cn("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]", {
|
|
3789
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
3790
|
+
"w-1": indicator === "line",
|
|
3791
|
+
"w-0 border-[1.5px] border-dashed bg-transparent": indicator === "dashed",
|
|
3792
|
+
"my-0.5": nestLabel && indicator === "dashed"
|
|
3793
|
+
}),
|
|
3794
|
+
style: {
|
|
3795
|
+
"--color-bg": indicatorColor,
|
|
3796
|
+
"--color-border": indicatorColor
|
|
3797
|
+
}
|
|
3798
|
+
}),
|
|
3799
|
+
/* @__PURE__ */ jsxs28("div", {
|
|
3800
|
+
className: cn("flex flex-1 justify-between leading-none", nestLabel ? "items-end" : "items-center"),
|
|
3801
|
+
children: [
|
|
3802
|
+
/* @__PURE__ */ jsxs28("div", {
|
|
3803
|
+
className: "grid gap-1.5",
|
|
3804
|
+
children: [
|
|
3805
|
+
nestLabel ? tooltipLabel : null,
|
|
3806
|
+
/* @__PURE__ */ jsx45("span", {
|
|
3807
|
+
className: "text-muted-foreground",
|
|
3808
|
+
children: itemConfig?.label || item.name
|
|
3809
|
+
})
|
|
3810
|
+
]
|
|
3811
|
+
}),
|
|
3812
|
+
item.value && /* @__PURE__ */ jsx45("span", {
|
|
3813
|
+
className: "font-mono font-medium tabular-nums text-foreground",
|
|
3814
|
+
children: item.value.toLocaleString()
|
|
3815
|
+
})
|
|
3816
|
+
]
|
|
3817
|
+
})
|
|
3818
|
+
]
|
|
3819
|
+
})
|
|
3820
|
+
}, item.dataKey);
|
|
3821
|
+
})
|
|
3822
|
+
})
|
|
3823
|
+
]
|
|
3824
|
+
});
|
|
3825
|
+
});
|
|
3826
|
+
ChartTooltipContent.displayName = "ChartTooltip";
|
|
3827
|
+
var ChartLegend = RechartsPrimitive.Legend;
|
|
3828
|
+
var ChartLegendContent = React11.forwardRef(({ className, hideIcon = false, payload, verticalAlign = "bottom", nameKey }, ref) => {
|
|
3829
|
+
const { config } = useChart();
|
|
3830
|
+
if (!payload?.length) {
|
|
3831
|
+
return null;
|
|
3832
|
+
}
|
|
3833
|
+
return /* @__PURE__ */ jsx45("div", {
|
|
3834
|
+
ref,
|
|
3835
|
+
className: cn("flex items-center justify-center gap-4", verticalAlign === "top" ? "pb-3" : "pt-3", className),
|
|
3836
|
+
children: payload.filter((item) => item.type !== "none").map((item) => {
|
|
3837
|
+
const key = `${nameKey || item.dataKey || "value"}`;
|
|
3838
|
+
const itemConfig = getPayloadConfigFromPayload(config, item, key);
|
|
3839
|
+
return /* @__PURE__ */ jsxs28("div", {
|
|
3840
|
+
className: cn("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),
|
|
3841
|
+
children: [
|
|
3842
|
+
itemConfig?.icon && !hideIcon ? /* @__PURE__ */ jsx45(itemConfig.icon, {}) : /* @__PURE__ */ jsx45("div", {
|
|
3843
|
+
className: "h-2 w-2 shrink-0 rounded-[2px]",
|
|
3844
|
+
style: {
|
|
3845
|
+
backgroundColor: item.color
|
|
3846
|
+
}
|
|
3847
|
+
}),
|
|
3848
|
+
itemConfig?.label
|
|
3849
|
+
]
|
|
3850
|
+
}, item.value);
|
|
3851
|
+
})
|
|
3852
|
+
});
|
|
3853
|
+
});
|
|
3854
|
+
ChartLegendContent.displayName = "ChartLegend";
|
|
3855
|
+
function getPayloadConfigFromPayload(config, payload, key) {
|
|
3856
|
+
if (typeof payload !== "object" || payload === null) {
|
|
3857
|
+
return;
|
|
3858
|
+
}
|
|
3859
|
+
const payloadPayload = "payload" in payload && typeof payload.payload === "object" && payload.payload !== null ? payload.payload : undefined;
|
|
3860
|
+
let configLabelKey = key;
|
|
3861
|
+
if (key in payload && typeof payload[key] === "string") {
|
|
3862
|
+
configLabelKey = payload[key];
|
|
3863
|
+
} else if (payloadPayload && key in payloadPayload && typeof payloadPayload[key] === "string") {
|
|
3864
|
+
configLabelKey = payloadPayload[key];
|
|
3865
|
+
}
|
|
3866
|
+
return configLabelKey in config ? config[configLabelKey] : config[key];
|
|
3472
3867
|
}
|
|
3473
3868
|
|
|
3869
|
+
// src/ui/composed/generative-components/charts.tsx
|
|
3870
|
+
import { jsx as jsx46, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
3871
|
+
var DEFAULT_COLORS = [
|
|
3872
|
+
"hsl(var(--chart-1))",
|
|
3873
|
+
"hsl(var(--chart-2))",
|
|
3874
|
+
"hsl(var(--chart-3))",
|
|
3875
|
+
"hsl(var(--chart-4))",
|
|
3876
|
+
"hsl(var(--chart-5))"
|
|
3877
|
+
];
|
|
3878
|
+
function generateChartConfig(series = []) {
|
|
3879
|
+
const config = {};
|
|
3880
|
+
series.forEach((item, index) => {
|
|
3881
|
+
config[item.key] = {
|
|
3882
|
+
label: item.label || item.key,
|
|
3883
|
+
color: item.color || DEFAULT_COLORS[index % DEFAULT_COLORS.length]
|
|
3884
|
+
};
|
|
3885
|
+
});
|
|
3886
|
+
return config;
|
|
3887
|
+
}
|
|
3888
|
+
function EmptyState({ message = "No data available" }) {
|
|
3889
|
+
return /* @__PURE__ */ jsx46("div", {
|
|
3890
|
+
className: "flex items-center justify-center h-[350px] border rounded-md bg-muted/10",
|
|
3891
|
+
children: /* @__PURE__ */ jsx46("p", {
|
|
3892
|
+
className: "text-sm text-muted-foreground",
|
|
3893
|
+
children: message
|
|
3894
|
+
})
|
|
3895
|
+
});
|
|
3896
|
+
}
|
|
3897
|
+
function BarChart(props) {
|
|
3898
|
+
const { data, xKey, bars = [], showLegend = true, showGrid = true, height = 350 } = props;
|
|
3899
|
+
if (!data || data.length === 0)
|
|
3900
|
+
return /* @__PURE__ */ jsx46(EmptyState, {});
|
|
3901
|
+
const config = generateChartConfig(bars);
|
|
3902
|
+
return /* @__PURE__ */ jsx46(ChartContainer, {
|
|
3903
|
+
config,
|
|
3904
|
+
className: "h-[350px]",
|
|
3905
|
+
children: /* @__PURE__ */ jsxs29(RechartsBarChart, {
|
|
3906
|
+
data,
|
|
3907
|
+
height,
|
|
3908
|
+
children: [
|
|
3909
|
+
showGrid && /* @__PURE__ */ jsx46(CartesianGrid, {
|
|
3910
|
+
strokeDasharray: "3 3"
|
|
3911
|
+
}),
|
|
3912
|
+
/* @__PURE__ */ jsx46(XAxis, {
|
|
3913
|
+
dataKey: xKey
|
|
3914
|
+
}),
|
|
3915
|
+
/* @__PURE__ */ jsx46(YAxis, {}),
|
|
3916
|
+
/* @__PURE__ */ jsx46(ChartTooltip, {
|
|
3917
|
+
content: /* @__PURE__ */ jsx46(ChartTooltipContent, {})
|
|
3918
|
+
}),
|
|
3919
|
+
showLegend && /* @__PURE__ */ jsx46(Legend2, {}),
|
|
3920
|
+
bars.map((bar) => /* @__PURE__ */ jsx46(Bar, {
|
|
3921
|
+
dataKey: bar.key,
|
|
3922
|
+
fill: bar.color || `var(--color-${bar.key})`,
|
|
3923
|
+
radius: [4, 4, 0, 0]
|
|
3924
|
+
}, bar.key))
|
|
3925
|
+
]
|
|
3926
|
+
})
|
|
3927
|
+
});
|
|
3928
|
+
}
|
|
3929
|
+
function LineChart(props) {
|
|
3930
|
+
const { data, xKey, lines = [], showLegend = true, showGrid = true, height = 350 } = props;
|
|
3931
|
+
if (!data || data.length === 0)
|
|
3932
|
+
return /* @__PURE__ */ jsx46(EmptyState, {});
|
|
3933
|
+
const config = generateChartConfig(lines);
|
|
3934
|
+
return /* @__PURE__ */ jsx46(ChartContainer, {
|
|
3935
|
+
config,
|
|
3936
|
+
className: "h-[350px]",
|
|
3937
|
+
children: /* @__PURE__ */ jsxs29(RechartsLineChart, {
|
|
3938
|
+
data,
|
|
3939
|
+
height,
|
|
3940
|
+
children: [
|
|
3941
|
+
showGrid && /* @__PURE__ */ jsx46(CartesianGrid, {
|
|
3942
|
+
strokeDasharray: "3 3"
|
|
3943
|
+
}),
|
|
3944
|
+
/* @__PURE__ */ jsx46(XAxis, {
|
|
3945
|
+
dataKey: xKey
|
|
3946
|
+
}),
|
|
3947
|
+
/* @__PURE__ */ jsx46(YAxis, {}),
|
|
3948
|
+
/* @__PURE__ */ jsx46(ChartTooltip, {
|
|
3949
|
+
content: /* @__PURE__ */ jsx46(ChartTooltipContent, {})
|
|
3950
|
+
}),
|
|
3951
|
+
showLegend && /* @__PURE__ */ jsx46(Legend2, {}),
|
|
3952
|
+
lines.map((line) => /* @__PURE__ */ jsx46(Line, {
|
|
3953
|
+
type: "monotone",
|
|
3954
|
+
dataKey: line.key,
|
|
3955
|
+
stroke: line.color || `var(--color-${line.key})`,
|
|
3956
|
+
strokeWidth: 2,
|
|
3957
|
+
dot: { r: 4 }
|
|
3958
|
+
}, line.key))
|
|
3959
|
+
]
|
|
3960
|
+
})
|
|
3961
|
+
});
|
|
3962
|
+
}
|
|
3963
|
+
function AreaChart(props) {
|
|
3964
|
+
const { data, xKey, areas = [], showLegend = true, showGrid = true, height = 350 } = props;
|
|
3965
|
+
if (!data || data.length === 0)
|
|
3966
|
+
return /* @__PURE__ */ jsx46(EmptyState, {});
|
|
3967
|
+
const config = generateChartConfig(areas);
|
|
3968
|
+
return /* @__PURE__ */ jsx46(ChartContainer, {
|
|
3969
|
+
config,
|
|
3970
|
+
className: "h-[350px]",
|
|
3971
|
+
children: /* @__PURE__ */ jsxs29(RechartsAreaChart, {
|
|
3972
|
+
data,
|
|
3973
|
+
height,
|
|
3974
|
+
children: [
|
|
3975
|
+
showGrid && /* @__PURE__ */ jsx46(CartesianGrid, {
|
|
3976
|
+
strokeDasharray: "3 3"
|
|
3977
|
+
}),
|
|
3978
|
+
/* @__PURE__ */ jsx46(XAxis, {
|
|
3979
|
+
dataKey: xKey
|
|
3980
|
+
}),
|
|
3981
|
+
/* @__PURE__ */ jsx46(YAxis, {}),
|
|
3982
|
+
/* @__PURE__ */ jsx46(ChartTooltip, {
|
|
3983
|
+
content: /* @__PURE__ */ jsx46(ChartTooltipContent, {})
|
|
3984
|
+
}),
|
|
3985
|
+
showLegend && /* @__PURE__ */ jsx46(Legend2, {}),
|
|
3986
|
+
areas.map((area) => /* @__PURE__ */ jsx46(Area, {
|
|
3987
|
+
type: "monotone",
|
|
3988
|
+
dataKey: area.key,
|
|
3989
|
+
stroke: area.color || `var(--color-${area.key})`,
|
|
3990
|
+
fill: area.color || `var(--color-${area.key})`,
|
|
3991
|
+
fillOpacity: 0.6
|
|
3992
|
+
}, area.key))
|
|
3993
|
+
]
|
|
3994
|
+
})
|
|
3995
|
+
});
|
|
3996
|
+
}
|
|
3997
|
+
function PieChart(props) {
|
|
3998
|
+
const { data, pie, showLegend = true, height = 350 } = props;
|
|
3999
|
+
if (!data || data.length === 0 || !pie)
|
|
4000
|
+
return /* @__PURE__ */ jsx46(EmptyState, {});
|
|
4001
|
+
const nameKey = pie.nameKey || "name";
|
|
4002
|
+
const config = generateChartConfig(data.map((item) => ({
|
|
4003
|
+
key: item[nameKey],
|
|
4004
|
+
label: item[nameKey]
|
|
4005
|
+
})));
|
|
4006
|
+
return /* @__PURE__ */ jsx46(ChartContainer, {
|
|
4007
|
+
config,
|
|
4008
|
+
className: "h-[350px]",
|
|
4009
|
+
children: /* @__PURE__ */ jsxs29(RechartsPieChart, {
|
|
4010
|
+
height,
|
|
4011
|
+
children: [
|
|
4012
|
+
/* @__PURE__ */ jsx46(Pie, {
|
|
4013
|
+
data,
|
|
4014
|
+
dataKey: pie.dataKey,
|
|
4015
|
+
nameKey,
|
|
4016
|
+
cx: "50%",
|
|
4017
|
+
cy: "50%",
|
|
4018
|
+
outerRadius: 100,
|
|
4019
|
+
label: pie.label,
|
|
4020
|
+
children: data.map((_entry, index) => /* @__PURE__ */ jsx46(Cell, {
|
|
4021
|
+
fill: DEFAULT_COLORS[index % DEFAULT_COLORS.length]
|
|
4022
|
+
}, `cell-${index}`))
|
|
4023
|
+
}),
|
|
4024
|
+
/* @__PURE__ */ jsx46(ChartTooltip, {
|
|
4025
|
+
content: /* @__PURE__ */ jsx46(ChartTooltipContent, {})
|
|
4026
|
+
}),
|
|
4027
|
+
showLegend && /* @__PURE__ */ jsx46(Legend2, {})
|
|
4028
|
+
]
|
|
4029
|
+
})
|
|
4030
|
+
});
|
|
4031
|
+
}
|
|
4032
|
+
// src/ui/composed/generative-components/card-grid.tsx
|
|
4033
|
+
import { jsx as jsx47, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
4034
|
+
function CardGrid(props) {
|
|
4035
|
+
const { cards, columns = { default: 1, md: 2, lg: 3 }, variant = "default" } = props;
|
|
4036
|
+
if (!cards || cards.length === 0) {
|
|
4037
|
+
return /* @__PURE__ */ jsx47("div", {
|
|
4038
|
+
className: "flex items-center justify-center p-8 border rounded-md bg-muted/10",
|
|
4039
|
+
children: /* @__PURE__ */ jsx47("p", {
|
|
4040
|
+
className: "text-sm text-muted-foreground",
|
|
4041
|
+
children: "No items available"
|
|
4042
|
+
})
|
|
4043
|
+
});
|
|
4044
|
+
}
|
|
4045
|
+
const gridCols = {
|
|
4046
|
+
default: columns.default || 1,
|
|
4047
|
+
sm: columns.sm,
|
|
4048
|
+
md: columns.md || 2,
|
|
4049
|
+
lg: columns.lg || 3,
|
|
4050
|
+
xl: columns.xl
|
|
4051
|
+
};
|
|
4052
|
+
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}`);
|
|
4053
|
+
const cardClass = cn("rounded-lg border bg-card text-card-foreground shadow-sm", variant === "bordered" && "border-2", variant === "elevated" && "shadow-lg");
|
|
4054
|
+
return /* @__PURE__ */ jsx47("div", {
|
|
4055
|
+
className: gridClass,
|
|
4056
|
+
children: cards.map((card) => /* @__PURE__ */ jsxs30("div", {
|
|
4057
|
+
className: cardClass,
|
|
4058
|
+
children: [
|
|
4059
|
+
card.image && /* @__PURE__ */ jsx47("div", {
|
|
4060
|
+
className: "aspect-video w-full overflow-hidden rounded-t-lg",
|
|
4061
|
+
children: /* @__PURE__ */ jsx47("img", {
|
|
4062
|
+
src: card.image,
|
|
4063
|
+
alt: card.title,
|
|
4064
|
+
className: "h-full w-full object-cover"
|
|
4065
|
+
})
|
|
4066
|
+
}),
|
|
4067
|
+
/* @__PURE__ */ jsxs30("div", {
|
|
4068
|
+
className: "flex flex-col space-y-1.5 p-6",
|
|
4069
|
+
children: [
|
|
4070
|
+
/* @__PURE__ */ jsx47("h3", {
|
|
4071
|
+
className: "text-lg font-semibold leading-none tracking-tight",
|
|
4072
|
+
children: card.title
|
|
4073
|
+
}),
|
|
4074
|
+
card.description && /* @__PURE__ */ jsx47("p", {
|
|
4075
|
+
className: "text-sm text-muted-foreground",
|
|
4076
|
+
children: card.description
|
|
4077
|
+
})
|
|
4078
|
+
]
|
|
4079
|
+
}),
|
|
4080
|
+
card.metadata && Object.keys(card.metadata).length > 0 && /* @__PURE__ */ jsx47("div", {
|
|
4081
|
+
className: "px-6 pb-4",
|
|
4082
|
+
children: /* @__PURE__ */ jsx47("dl", {
|
|
4083
|
+
className: "space-y-1 text-sm",
|
|
4084
|
+
children: Object.entries(card.metadata).map(([key, value]) => /* @__PURE__ */ jsxs30("div", {
|
|
4085
|
+
className: "flex justify-between",
|
|
4086
|
+
children: [
|
|
4087
|
+
/* @__PURE__ */ jsxs30("dt", {
|
|
4088
|
+
className: "text-muted-foreground",
|
|
4089
|
+
children: [
|
|
4090
|
+
key,
|
|
4091
|
+
":"
|
|
4092
|
+
]
|
|
4093
|
+
}),
|
|
4094
|
+
/* @__PURE__ */ jsx47("dd", {
|
|
4095
|
+
className: "font-medium",
|
|
4096
|
+
children: String(value)
|
|
4097
|
+
})
|
|
4098
|
+
]
|
|
4099
|
+
}, key))
|
|
4100
|
+
})
|
|
4101
|
+
}),
|
|
4102
|
+
card.actions && card.actions.length > 0 && /* @__PURE__ */ jsx47("div", {
|
|
4103
|
+
className: "flex items-center gap-2 p-6 pt-0",
|
|
4104
|
+
children: card.actions.map((action, index) => /* @__PURE__ */ jsx47(Button, {
|
|
4105
|
+
variant: action.variant || "default",
|
|
4106
|
+
size: "sm",
|
|
4107
|
+
onClick: () => {
|
|
4108
|
+
if (action.onClick) {
|
|
4109
|
+
window.dispatchEvent(new CustomEvent("generative-ui-action", {
|
|
4110
|
+
detail: { action: action.onClick, cardId: card.id }
|
|
4111
|
+
}));
|
|
4112
|
+
}
|
|
4113
|
+
},
|
|
4114
|
+
children: action.label
|
|
4115
|
+
}, index))
|
|
4116
|
+
})
|
|
4117
|
+
]
|
|
4118
|
+
}, card.id))
|
|
4119
|
+
});
|
|
4120
|
+
}
|
|
3474
4121
|
// src/ui/composed/agno-chat/agno-chat.tsx
|
|
3475
|
-
import {
|
|
4122
|
+
import { useCallback as useCallback7, useMemo as useMemo5, useRef as useRef6 } from "react";
|
|
4123
|
+
import { useAgnoChat, useAgnoToolExecution } from "@rodrigocoliveira/agno-react";
|
|
4124
|
+
import { jsx as jsx48 } from "react/jsx-runtime";
|
|
4125
|
+
function resolveDebug(debug) {
|
|
4126
|
+
if (typeof debug === "boolean")
|
|
4127
|
+
return debug;
|
|
4128
|
+
return typeof process !== "undefined" && process.env?.NODE_ENV === "development";
|
|
4129
|
+
}
|
|
3476
4130
|
function AgnoChatRoot({
|
|
3477
4131
|
children,
|
|
3478
4132
|
toolHandlers = {},
|
|
3479
4133
|
autoExecuteTools = true,
|
|
3480
|
-
|
|
4134
|
+
renderTool,
|
|
4135
|
+
debug,
|
|
4136
|
+
skipToolsOnSessionLoad,
|
|
3481
4137
|
className,
|
|
3482
4138
|
...divProps
|
|
3483
4139
|
}) {
|
|
3484
4140
|
const chat = useAgnoChat();
|
|
3485
4141
|
const toolExec = useAgnoToolExecution(toolHandlers, autoExecuteTools, {
|
|
3486
|
-
|
|
4142
|
+
skipToolsOnSessionLoad
|
|
3487
4143
|
});
|
|
3488
4144
|
const containerRef = useRef6(null);
|
|
4145
|
+
const isDebug = resolveDebug(debug);
|
|
3489
4146
|
const sendRef = useRef6(chat.sendMessage);
|
|
3490
4147
|
sendRef.current = chat.sendMessage;
|
|
3491
4148
|
const handleSend = useCallback7(async (message) => {
|
|
@@ -3514,7 +4171,7 @@ function AgnoChatRoot({
|
|
|
3514
4171
|
continueWithResults,
|
|
3515
4172
|
executionError
|
|
3516
4173
|
} = toolExec;
|
|
3517
|
-
const contextValue =
|
|
4174
|
+
const contextValue = useMemo5(() => ({
|
|
3518
4175
|
messages,
|
|
3519
4176
|
sendMessage,
|
|
3520
4177
|
clearMessages,
|
|
@@ -3535,7 +4192,8 @@ function AgnoChatRoot({
|
|
|
3535
4192
|
handleSend,
|
|
3536
4193
|
inputDisabled: isStreaming || isPaused,
|
|
3537
4194
|
dropZoneContainerRef: containerRef,
|
|
3538
|
-
|
|
4195
|
+
renderTool,
|
|
4196
|
+
isDebug
|
|
3539
4197
|
}), [
|
|
3540
4198
|
messages,
|
|
3541
4199
|
sendMessage,
|
|
@@ -3555,11 +4213,12 @@ function AgnoChatRoot({
|
|
|
3555
4213
|
continueWithResults,
|
|
3556
4214
|
executionError,
|
|
3557
4215
|
handleSend,
|
|
3558
|
-
|
|
4216
|
+
renderTool,
|
|
4217
|
+
isDebug
|
|
3559
4218
|
]);
|
|
3560
|
-
return /* @__PURE__ */
|
|
4219
|
+
return /* @__PURE__ */ jsx48(AgnoChatContext.Provider, {
|
|
3561
4220
|
value: contextValue,
|
|
3562
|
-
children: /* @__PURE__ */
|
|
4221
|
+
children: /* @__PURE__ */ jsx48("div", {
|
|
3563
4222
|
ref: containerRef,
|
|
3564
4223
|
className: cn("relative h-full flex flex-col", className),
|
|
3565
4224
|
...divProps,
|
|
@@ -3572,22 +4231,22 @@ function AgnoChatRoot({
|
|
|
3572
4231
|
import { isValidElement as isValidElement2, useEffect as useEffect6, useRef as useRef7 } from "react";
|
|
3573
4232
|
|
|
3574
4233
|
// src/ui/composed/agno-chat/suggested-prompts.tsx
|
|
3575
|
-
import { jsx as
|
|
4234
|
+
import { jsx as jsx49, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3576
4235
|
function AgnoChatSuggestedPrompts({ className, prompts }) {
|
|
3577
4236
|
const { handleSend } = useAgnoChatContext();
|
|
3578
4237
|
if (prompts.length === 0)
|
|
3579
4238
|
return null;
|
|
3580
|
-
return /* @__PURE__ */
|
|
4239
|
+
return /* @__PURE__ */ jsx49("div", {
|
|
3581
4240
|
className: cn("grid grid-cols-2 gap-2 w-full max-w-md", className),
|
|
3582
|
-
children: prompts.map((prompt, idx) => /* @__PURE__ */
|
|
4241
|
+
children: prompts.map((prompt, idx) => /* @__PURE__ */ jsxs31("button", {
|
|
3583
4242
|
onClick: () => handleSend(prompt.text),
|
|
3584
4243
|
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",
|
|
3585
4244
|
children: [
|
|
3586
|
-
prompt.icon && /* @__PURE__ */
|
|
4245
|
+
prompt.icon && /* @__PURE__ */ jsx49("span", {
|
|
3587
4246
|
className: "text-muted-foreground group-hover:text-primary transition-colors",
|
|
3588
4247
|
children: prompt.icon
|
|
3589
4248
|
}),
|
|
3590
|
-
/* @__PURE__ */
|
|
4249
|
+
/* @__PURE__ */ jsx49("span", {
|
|
3591
4250
|
className: "text-muted-foreground group-hover:text-foreground transition-colors text-xs leading-snug",
|
|
3592
4251
|
children: prompt.text
|
|
3593
4252
|
})
|
|
@@ -3598,7 +4257,7 @@ function AgnoChatSuggestedPrompts({ className, prompts }) {
|
|
|
3598
4257
|
|
|
3599
4258
|
// src/ui/composed/agno-chat/messages.tsx
|
|
3600
4259
|
import { Bot as Bot2 } from "lucide-react";
|
|
3601
|
-
import { jsx as
|
|
4260
|
+
import { jsx as jsx50, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
3602
4261
|
function ScrollOnNewUserMessage({ messageCount }) {
|
|
3603
4262
|
const { scrollToBottom } = useStickToBottomContext2();
|
|
3604
4263
|
const prevCount = useRef7(messageCount);
|
|
@@ -3622,13 +4281,8 @@ function AgnoChatMessages({
|
|
|
3622
4281
|
showReasoning,
|
|
3623
4282
|
showReferences,
|
|
3624
4283
|
showTimestamp,
|
|
3625
|
-
showGenerativeUI,
|
|
3626
|
-
showToolCalls,
|
|
3627
4284
|
showFilePreview,
|
|
3628
4285
|
showImageLightbox,
|
|
3629
|
-
renderToolCall,
|
|
3630
|
-
renderContent,
|
|
3631
|
-
renderMedia,
|
|
3632
4286
|
formatTimestamp,
|
|
3633
4287
|
messageClassNames,
|
|
3634
4288
|
emptyState,
|
|
@@ -3636,24 +4290,23 @@ function AgnoChatMessages({
|
|
|
3636
4290
|
children,
|
|
3637
4291
|
showThinkingIndicator = true,
|
|
3638
4292
|
renderThinkingIndicator,
|
|
3639
|
-
|
|
4293
|
+
renderTool: propRenderTool,
|
|
3640
4294
|
scrollBehavior,
|
|
3641
4295
|
scrollToBottomButton
|
|
3642
4296
|
}) {
|
|
3643
|
-
const { messages, isStreaming
|
|
3644
|
-
const toolResultRenderers = propToolResultRenderers ?? contextToolResultRenderers;
|
|
4297
|
+
const { messages, isStreaming } = useAgnoChatContext();
|
|
3645
4298
|
const lastMessage = messages[messages.length - 1];
|
|
3646
4299
|
const isThinking = showThinkingIndicator && isStreaming && (!lastMessage || lastMessage.role !== "user") && !lastMessage?.content;
|
|
3647
4300
|
const resolvedScrollButton = (() => {
|
|
3648
4301
|
if (scrollToBottomButton === false)
|
|
3649
4302
|
return null;
|
|
3650
4303
|
if (scrollToBottomButton === undefined || scrollToBottomButton === true) {
|
|
3651
|
-
return /* @__PURE__ */
|
|
4304
|
+
return /* @__PURE__ */ jsx50(ConversationScrollButton, {});
|
|
3652
4305
|
}
|
|
3653
4306
|
if (isValidElement2(scrollToBottomButton))
|
|
3654
4307
|
return scrollToBottomButton;
|
|
3655
4308
|
if (typeof scrollToBottomButton === "object" && scrollToBottomButton !== null && "className" in scrollToBottomButton) {
|
|
3656
|
-
return /* @__PURE__ */
|
|
4309
|
+
return /* @__PURE__ */ jsx50(ConversationScrollButton, {
|
|
3657
4310
|
className: scrollToBottomButton.className
|
|
3658
4311
|
});
|
|
3659
4312
|
}
|
|
@@ -3670,71 +4323,66 @@ function AgnoChatMessages({
|
|
|
3670
4323
|
...showReasoning !== undefined && { showReasoning },
|
|
3671
4324
|
...showReferences !== undefined && { showReferences },
|
|
3672
4325
|
...showTimestamp !== undefined && { showTimestamp },
|
|
3673
|
-
...showGenerativeUI !== undefined && { showGenerativeUI },
|
|
3674
|
-
...showToolCalls !== undefined && { showToolCalls },
|
|
3675
4326
|
...showFilePreview !== undefined && { showFilePreview },
|
|
3676
4327
|
...showImageLightbox !== undefined && { showImageLightbox },
|
|
3677
|
-
...renderToolCall !== undefined && { renderToolCall },
|
|
3678
|
-
...renderContent !== undefined && { renderContent },
|
|
3679
|
-
...renderMedia !== undefined && { renderMedia },
|
|
3680
4328
|
...formatTimestamp !== undefined && { formatTimestamp },
|
|
3681
4329
|
...messageClassNames !== undefined && { classNames: messageClassNames },
|
|
3682
|
-
...
|
|
4330
|
+
...propRenderTool !== undefined && { renderTool: propRenderTool }
|
|
3683
4331
|
};
|
|
3684
|
-
const resolvedEmptyState = children ?? emptyState ?? /* @__PURE__ */
|
|
4332
|
+
const resolvedEmptyState = children ?? emptyState ?? /* @__PURE__ */ jsxs32("div", {
|
|
3685
4333
|
className: "flex flex-col items-center gap-6",
|
|
3686
4334
|
children: [
|
|
3687
|
-
/* @__PURE__ */
|
|
4335
|
+
/* @__PURE__ */ jsxs32("div", {
|
|
3688
4336
|
className: "relative",
|
|
3689
4337
|
children: [
|
|
3690
|
-
/* @__PURE__ */
|
|
4338
|
+
/* @__PURE__ */ jsx50("div", {
|
|
3691
4339
|
className: "h-16 w-16 rounded-2xl bg-primary/10 flex items-center justify-center",
|
|
3692
|
-
children: /* @__PURE__ */
|
|
4340
|
+
children: /* @__PURE__ */ jsx50(Bot2, {
|
|
3693
4341
|
className: "h-8 w-8 text-primary"
|
|
3694
4342
|
})
|
|
3695
4343
|
}),
|
|
3696
|
-
/* @__PURE__ */
|
|
4344
|
+
/* @__PURE__ */ jsx50("div", {
|
|
3697
4345
|
className: "absolute -bottom-1 -right-1 h-5 w-5 rounded-full bg-green-500 border-2 border-background flex items-center justify-center",
|
|
3698
|
-
children: /* @__PURE__ */
|
|
4346
|
+
children: /* @__PURE__ */ jsx50("span", {
|
|
3699
4347
|
className: "h-2 w-2 rounded-full bg-white animate-pulse"
|
|
3700
4348
|
})
|
|
3701
4349
|
})
|
|
3702
4350
|
]
|
|
3703
4351
|
}),
|
|
3704
|
-
/* @__PURE__ */
|
|
4352
|
+
/* @__PURE__ */ jsxs32("div", {
|
|
3705
4353
|
className: "space-y-2 text-center",
|
|
3706
4354
|
children: [
|
|
3707
|
-
/* @__PURE__ */
|
|
4355
|
+
/* @__PURE__ */ jsx50("h3", {
|
|
3708
4356
|
className: "text-xl font-semibold tracking-tight",
|
|
3709
4357
|
children: "Welcome to Agno Chat"
|
|
3710
4358
|
}),
|
|
3711
|
-
/* @__PURE__ */
|
|
4359
|
+
/* @__PURE__ */ jsx50("p", {
|
|
3712
4360
|
className: "text-muted-foreground text-sm max-w-sm",
|
|
3713
4361
|
children: "Start a conversation with your AI agent. Ask questions, explore ideas, or run tools."
|
|
3714
4362
|
})
|
|
3715
4363
|
]
|
|
3716
4364
|
}),
|
|
3717
|
-
suggestedPrompts.length > 0 && /* @__PURE__ */
|
|
4365
|
+
suggestedPrompts.length > 0 && /* @__PURE__ */ jsx50(AgnoChatSuggestedPrompts, {
|
|
3718
4366
|
prompts: suggestedPrompts
|
|
3719
4367
|
})
|
|
3720
4368
|
]
|
|
3721
4369
|
});
|
|
3722
|
-
return /* @__PURE__ */
|
|
4370
|
+
return /* @__PURE__ */ jsxs32(Conversation, {
|
|
3723
4371
|
className: cn("relative flex-1 w-full", className),
|
|
3724
4372
|
scrollBehavior,
|
|
3725
4373
|
children: [
|
|
3726
|
-
/* @__PURE__ */
|
|
4374
|
+
/* @__PURE__ */ jsx50(ScrollOnNewUserMessage, {
|
|
3727
4375
|
messageCount: messages.length
|
|
3728
4376
|
}),
|
|
3729
|
-
/* @__PURE__ */
|
|
4377
|
+
/* @__PURE__ */ jsxs32(ConversationContent, {
|
|
3730
4378
|
className: "max-w-3xl mx-auto",
|
|
3731
4379
|
children: [
|
|
3732
|
-
messages.length === 0 ? /* @__PURE__ */
|
|
4380
|
+
messages.length === 0 ? /* @__PURE__ */ jsx50(ConversationEmptyState, {
|
|
3733
4381
|
children: resolvedEmptyState
|
|
3734
4382
|
}) : messages.map((message, index) => {
|
|
3735
4383
|
if (isThinking && index === messages.length - 1 && message === lastMessage)
|
|
3736
4384
|
return null;
|
|
3737
|
-
return renderMessage ? renderMessage(message, index) : /* @__PURE__ */
|
|
4385
|
+
return renderMessage ? renderMessage(message, index) : /* @__PURE__ */ jsx50(AgnoMessageItem, {
|
|
3738
4386
|
message,
|
|
3739
4387
|
avatars,
|
|
3740
4388
|
actions,
|
|
@@ -3742,9 +4390,9 @@ function AgnoChatMessages({
|
|
|
3742
4390
|
...messageItemProps
|
|
3743
4391
|
}, `msg-${index}-${message.created_at}`);
|
|
3744
4392
|
}),
|
|
3745
|
-
isThinking && /* @__PURE__ */
|
|
4393
|
+
isThinking && /* @__PURE__ */ jsx50("div", {
|
|
3746
4394
|
className: "py-2",
|
|
3747
|
-
children: renderThinkingIndicator ?? /* @__PURE__ */
|
|
4395
|
+
children: renderThinkingIndicator ?? /* @__PURE__ */ jsx50(StreamingIndicator, {
|
|
3748
4396
|
avatar: avatars?.assistant
|
|
3749
4397
|
})
|
|
3750
4398
|
})
|
|
@@ -3756,9 +4404,9 @@ function AgnoChatMessages({
|
|
|
3756
4404
|
}
|
|
3757
4405
|
|
|
3758
4406
|
// src/ui/composed/agno-chat/empty-state.tsx
|
|
3759
|
-
import { jsx as
|
|
4407
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
3760
4408
|
function AgnoChatEmptyState({ children, className, ...props }) {
|
|
3761
|
-
return /* @__PURE__ */
|
|
4409
|
+
return /* @__PURE__ */ jsx51("div", {
|
|
3762
4410
|
className: cn("flex flex-col items-center gap-6", className),
|
|
3763
4411
|
...props,
|
|
3764
4412
|
children
|
|
@@ -3767,7 +4415,7 @@ function AgnoChatEmptyState({ children, className, ...props }) {
|
|
|
3767
4415
|
|
|
3768
4416
|
// src/ui/composed/agno-chat/error-bar.tsx
|
|
3769
4417
|
import { useState as useState9, useEffect as useEffect7, useRef as useRef8 } from "react";
|
|
3770
|
-
import { jsx as
|
|
4418
|
+
import { jsx as jsx52, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
3771
4419
|
function AgnoChatErrorBar({
|
|
3772
4420
|
className,
|
|
3773
4421
|
text,
|
|
@@ -3807,23 +4455,23 @@ function AgnoChatErrorBar({
|
|
|
3807
4455
|
if (children) {
|
|
3808
4456
|
return typeof children === "function" ? children(rawMessage) : children;
|
|
3809
4457
|
}
|
|
3810
|
-
return /* @__PURE__ */
|
|
4458
|
+
return /* @__PURE__ */ jsxs33("div", {
|
|
3811
4459
|
className: "flex items-center gap-2 max-w-3xl mx-auto",
|
|
3812
4460
|
children: [
|
|
3813
|
-
icon && /* @__PURE__ */
|
|
4461
|
+
icon && /* @__PURE__ */ jsx52("span", {
|
|
3814
4462
|
className: "shrink-0",
|
|
3815
4463
|
children: icon
|
|
3816
4464
|
}),
|
|
3817
|
-
/* @__PURE__ */
|
|
4465
|
+
/* @__PURE__ */ jsx52("p", {
|
|
3818
4466
|
className: "text-sm text-destructive flex-1",
|
|
3819
4467
|
children: displayMessage
|
|
3820
4468
|
}),
|
|
3821
|
-
dismissible && /* @__PURE__ */
|
|
4469
|
+
dismissible && /* @__PURE__ */ jsx52("button", {
|
|
3822
4470
|
type: "button",
|
|
3823
4471
|
onClick: () => setHidden(true),
|
|
3824
4472
|
className: "shrink-0 text-destructive/60 hover:text-destructive transition-colors",
|
|
3825
4473
|
"aria-label": "Dismiss error",
|
|
3826
|
-
children: /* @__PURE__ */
|
|
4474
|
+
children: /* @__PURE__ */ jsxs33("svg", {
|
|
3827
4475
|
xmlns: "http://www.w3.org/2000/svg",
|
|
3828
4476
|
width: "16",
|
|
3829
4477
|
height: "16",
|
|
@@ -3834,10 +4482,10 @@ function AgnoChatErrorBar({
|
|
|
3834
4482
|
strokeLinecap: "round",
|
|
3835
4483
|
strokeLinejoin: "round",
|
|
3836
4484
|
children: [
|
|
3837
|
-
/* @__PURE__ */
|
|
4485
|
+
/* @__PURE__ */ jsx52("path", {
|
|
3838
4486
|
d: "M18 6 6 18"
|
|
3839
4487
|
}),
|
|
3840
|
-
/* @__PURE__ */
|
|
4488
|
+
/* @__PURE__ */ jsx52("path", {
|
|
3841
4489
|
d: "m6 6 12 12"
|
|
3842
4490
|
})
|
|
3843
4491
|
]
|
|
@@ -3846,14 +4494,14 @@ function AgnoChatErrorBar({
|
|
|
3846
4494
|
]
|
|
3847
4495
|
});
|
|
3848
4496
|
};
|
|
3849
|
-
return /* @__PURE__ */
|
|
4497
|
+
return /* @__PURE__ */ jsx52("div", {
|
|
3850
4498
|
className: cn("px-4 py-2.5 bg-destructive/5 border-t border-destructive/20", className),
|
|
3851
4499
|
children: renderContent()
|
|
3852
4500
|
});
|
|
3853
4501
|
}
|
|
3854
4502
|
|
|
3855
4503
|
// src/ui/composed/agno-chat/input.tsx
|
|
3856
|
-
import { jsx as
|
|
4504
|
+
import { jsx as jsx53 } from "react/jsx-runtime";
|
|
3857
4505
|
function AgnoChatInputArea({
|
|
3858
4506
|
className,
|
|
3859
4507
|
children,
|
|
@@ -3866,11 +4514,11 @@ function AgnoChatInputArea({
|
|
|
3866
4514
|
dropZoneProps
|
|
3867
4515
|
}) {
|
|
3868
4516
|
const { handleSend, inputDisabled, isStreaming, isPaused, cancelRun, dropZoneContainerRef } = useAgnoChatContext();
|
|
3869
|
-
return /* @__PURE__ */
|
|
4517
|
+
return /* @__PURE__ */ jsx53("div", {
|
|
3870
4518
|
className: cn("border-t border-border bg-background/80 backdrop-blur-sm", className),
|
|
3871
|
-
children: /* @__PURE__ */
|
|
4519
|
+
children: /* @__PURE__ */ jsx53("div", {
|
|
3872
4520
|
className: "mx-auto px-4 py-2",
|
|
3873
|
-
children: children ? children({ onSend: handleSend, disabled: inputDisabled, isStreaming, isPaused }) : /* @__PURE__ */
|
|
4521
|
+
children: children ? children({ onSend: handleSend, disabled: inputDisabled, isStreaming, isPaused }) : /* @__PURE__ */ jsx53(AgnoChatInput, {
|
|
3874
4522
|
onSend: handleSend,
|
|
3875
4523
|
disabled: inputDisabled,
|
|
3876
4524
|
isStreaming,
|
|
@@ -3901,6 +4549,7 @@ export {
|
|
|
3901
4549
|
usePromptInputDropZone,
|
|
3902
4550
|
usePromptInputController,
|
|
3903
4551
|
usePromptInputAttachments,
|
|
4552
|
+
useAgnoMessageContext,
|
|
3904
4553
|
useAgnoChatContext,
|
|
3905
4554
|
isPreviewable,
|
|
3906
4555
|
getFilePreviewType,
|
|
@@ -3909,6 +4558,7 @@ export {
|
|
|
3909
4558
|
formatFullTimestamp,
|
|
3910
4559
|
formatFileSize,
|
|
3911
4560
|
cn,
|
|
4561
|
+
byToolName,
|
|
3912
4562
|
buttonVariants,
|
|
3913
4563
|
badgeVariants,
|
|
3914
4564
|
TooltipTrigger,
|
|
@@ -3918,6 +4568,7 @@ export {
|
|
|
3918
4568
|
ToolOutput,
|
|
3919
4569
|
ToolInput,
|
|
3920
4570
|
ToolHeader,
|
|
4571
|
+
ToolDebugCard,
|
|
3921
4572
|
ToolContent,
|
|
3922
4573
|
Tool,
|
|
3923
4574
|
StreamingIndicator,
|
|
@@ -3968,9 +4619,11 @@ export {
|
|
|
3968
4619
|
PromptInputActionMenu,
|
|
3969
4620
|
PromptInputActionAddAttachments,
|
|
3970
4621
|
PromptInput,
|
|
4622
|
+
PieChart,
|
|
3971
4623
|
MessageContent,
|
|
3972
4624
|
MessageAvatar,
|
|
3973
4625
|
Message,
|
|
4626
|
+
LineChart,
|
|
3974
4627
|
InputGroupTextarea,
|
|
3975
4628
|
InputGroupText,
|
|
3976
4629
|
InputGroupInput,
|
|
@@ -4025,7 +4678,15 @@ export {
|
|
|
4025
4678
|
Collapsible,
|
|
4026
4679
|
CodeBlockCopyButton,
|
|
4027
4680
|
CodeBlock,
|
|
4681
|
+
ChartTooltipContent,
|
|
4682
|
+
ChartTooltip,
|
|
4683
|
+
ChartStyle,
|
|
4684
|
+
ChartLegendContent,
|
|
4685
|
+
ChartLegend,
|
|
4686
|
+
ChartContainer,
|
|
4687
|
+
CardGrid,
|
|
4028
4688
|
Button,
|
|
4689
|
+
BarChart,
|
|
4029
4690
|
Badge,
|
|
4030
4691
|
AvatarImage,
|
|
4031
4692
|
AvatarFallback,
|
|
@@ -4039,7 +4700,16 @@ export {
|
|
|
4039
4700
|
ArtifactActions,
|
|
4040
4701
|
ArtifactAction,
|
|
4041
4702
|
Artifact,
|
|
4703
|
+
AreaChart,
|
|
4704
|
+
AgnoMessageTools,
|
|
4705
|
+
AgnoMessageReferences,
|
|
4706
|
+
AgnoMessageReasoning,
|
|
4707
|
+
AgnoMessageMedia,
|
|
4042
4708
|
AgnoMessageItem,
|
|
4709
|
+
AgnoMessageFooter,
|
|
4710
|
+
AgnoMessageContext,
|
|
4711
|
+
AgnoMessageContent,
|
|
4712
|
+
AgnoMessage,
|
|
4043
4713
|
AgnoChatSuggestedPrompts,
|
|
4044
4714
|
AgnoChatRoot,
|
|
4045
4715
|
AgnoChatMessages,
|
|
@@ -4054,4 +4724,4 @@ export {
|
|
|
4054
4724
|
Accordion
|
|
4055
4725
|
};
|
|
4056
4726
|
|
|
4057
|
-
//# debugId=
|
|
4727
|
+
//# debugId=762A645DC01D022A64756E2164756E21
|