@rodrigocoliveira/agno-react 2.1.1 → 2.3.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.
Files changed (110) hide show
  1. package/dist/context/AgnoContext.d.ts +1 -1
  2. package/dist/context/AgnoContext.d.ts.map +1 -1
  3. package/dist/context/ToolHandlerContext.d.ts +1 -1
  4. package/dist/context/ToolHandlerContext.d.ts.map +1 -1
  5. package/dist/hooks/useAgnoChat.d.ts +1 -0
  6. package/dist/hooks/useAgnoChat.d.ts.map +1 -1
  7. package/dist/hooks/useAgnoSessionState.d.ts +11 -0
  8. package/dist/hooks/useAgnoSessionState.d.ts.map +1 -1
  9. package/dist/index.js +20 -19
  10. package/dist/index.js.map +7 -7
  11. package/dist/index.mjs +20 -19
  12. package/dist/index.mjs.map +7 -7
  13. package/dist/ui/components/artifact.d.ts +8 -8
  14. package/dist/ui/components/artifact.d.ts.map +1 -1
  15. package/dist/ui/components/audio-recorder.d.ts +1 -1
  16. package/dist/ui/components/audio-recorder.d.ts.map +1 -1
  17. package/dist/ui/components/chart.d.ts +1 -1
  18. package/dist/ui/components/chart.d.ts.map +1 -1
  19. package/dist/ui/components/code-block.d.ts +2 -2
  20. package/dist/ui/components/code-block.d.ts.map +1 -1
  21. package/dist/ui/components/conversation.d.ts +4 -4
  22. package/dist/ui/components/conversation.d.ts.map +1 -1
  23. package/dist/ui/components/file-preview-card.d.ts +1 -1
  24. package/dist/ui/components/file-preview-card.d.ts.map +1 -1
  25. package/dist/ui/components/file-preview-modal.d.ts +1 -1
  26. package/dist/ui/components/file-preview-modal.d.ts.map +1 -1
  27. package/dist/ui/components/image-lightbox.d.ts +1 -1
  28. package/dist/ui/components/image-lightbox.d.ts.map +1 -1
  29. package/dist/ui/components/message.d.ts +3 -3
  30. package/dist/ui/components/message.d.ts.map +1 -1
  31. package/dist/ui/components/prompt-input/attachments.d.ts +3 -3
  32. package/dist/ui/components/prompt-input/attachments.d.ts.map +1 -1
  33. package/dist/ui/components/prompt-input/buttons.d.ts +6 -6
  34. package/dist/ui/components/prompt-input/buttons.d.ts.map +1 -1
  35. package/dist/ui/components/prompt-input/command.d.ts +7 -7
  36. package/dist/ui/components/prompt-input/command.d.ts.map +1 -1
  37. package/dist/ui/components/prompt-input/drop-zone.d.ts +1 -1
  38. package/dist/ui/components/prompt-input/drop-zone.d.ts.map +1 -1
  39. package/dist/ui/components/prompt-input/footer.d.ts +4 -4
  40. package/dist/ui/components/prompt-input/footer.d.ts.map +1 -1
  41. package/dist/ui/components/prompt-input/model-select.d.ts +5 -5
  42. package/dist/ui/components/prompt-input/model-select.d.ts.map +1 -1
  43. package/dist/ui/components/prompt-input/prompt-input.d.ts +1 -1
  44. package/dist/ui/components/prompt-input/prompt-input.d.ts.map +1 -1
  45. package/dist/ui/components/prompt-input/provider.d.ts +1 -1
  46. package/dist/ui/components/prompt-input/provider.d.ts.map +1 -1
  47. package/dist/ui/components/prompt-input/speech.d.ts +1 -1
  48. package/dist/ui/components/prompt-input/speech.d.ts.map +1 -1
  49. package/dist/ui/components/prompt-input/tabs.d.ts +5 -5
  50. package/dist/ui/components/prompt-input/tabs.d.ts.map +1 -1
  51. package/dist/ui/components/prompt-input/textarea.d.ts +1 -1
  52. package/dist/ui/components/prompt-input/textarea.d.ts.map +1 -1
  53. package/dist/ui/components/response.d.ts +1 -1
  54. package/dist/ui/components/response.d.ts.map +1 -1
  55. package/dist/ui/components/smart-timestamp.d.ts +1 -1
  56. package/dist/ui/components/smart-timestamp.d.ts.map +1 -1
  57. package/dist/ui/components/streaming-indicator.d.ts +1 -1
  58. package/dist/ui/components/streaming-indicator.d.ts.map +1 -1
  59. package/dist/ui/components/tool.d.ts +5 -5
  60. package/dist/ui/components/tool.d.ts.map +1 -1
  61. package/dist/ui/composed/AgnoChatInput.d.ts +1 -1
  62. package/dist/ui/composed/AgnoChatInput.d.ts.map +1 -1
  63. package/dist/ui/composed/AgnoMessageItem.d.ts +3 -1
  64. package/dist/ui/composed/AgnoMessageItem.d.ts.map +1 -1
  65. package/dist/ui/composed/agno-chat/agno-chat.d.ts +18 -1
  66. package/dist/ui/composed/agno-chat/agno-chat.d.ts.map +1 -1
  67. package/dist/ui/composed/agno-chat/empty-state.d.ts +1 -1
  68. package/dist/ui/composed/agno-chat/empty-state.d.ts.map +1 -1
  69. package/dist/ui/composed/agno-chat/error-bar.d.ts +1 -1
  70. package/dist/ui/composed/agno-chat/error-bar.d.ts.map +1 -1
  71. package/dist/ui/composed/agno-chat/input.d.ts +1 -1
  72. package/dist/ui/composed/agno-chat/input.d.ts.map +1 -1
  73. package/dist/ui/composed/agno-chat/messages.d.ts +1 -1
  74. package/dist/ui/composed/agno-chat/messages.d.ts.map +1 -1
  75. package/dist/ui/composed/agno-chat/suggested-prompts.d.ts +1 -1
  76. package/dist/ui/composed/agno-chat/suggested-prompts.d.ts.map +1 -1
  77. package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts +1 -1
  78. package/dist/ui/composed/agno-chat/tool-building-blocks.d.ts.map +1 -1
  79. package/dist/ui/composed/agno-message/content.d.ts +1 -1
  80. package/dist/ui/composed/agno-message/content.d.ts.map +1 -1
  81. package/dist/ui/composed/agno-message/context.d.ts +7 -0
  82. package/dist/ui/composed/agno-message/context.d.ts.map +1 -1
  83. package/dist/ui/composed/agno-message/footer.d.ts +1 -1
  84. package/dist/ui/composed/agno-message/footer.d.ts.map +1 -1
  85. package/dist/ui/composed/agno-message/media.d.ts +1 -1
  86. package/dist/ui/composed/agno-message/media.d.ts.map +1 -1
  87. package/dist/ui/composed/agno-message/message.d.ts +8 -1
  88. package/dist/ui/composed/agno-message/message.d.ts.map +1 -1
  89. package/dist/ui/composed/agno-message/reasoning.d.ts +1 -1
  90. package/dist/ui/composed/agno-message/reasoning.d.ts.map +1 -1
  91. package/dist/ui/composed/agno-message/references.d.ts +1 -1
  92. package/dist/ui/composed/agno-message/references.d.ts.map +1 -1
  93. package/dist/ui/composed/agno-message/tools.d.ts +1 -1
  94. package/dist/ui/composed/agno-message/tools.d.ts.map +1 -1
  95. package/dist/ui/composed/generative-components/card-grid.d.ts +1 -1
  96. package/dist/ui/composed/generative-components/card-grid.d.ts.map +1 -1
  97. package/dist/ui/composed/generative-components/charts.d.ts +4 -4
  98. package/dist/ui/composed/generative-components/charts.d.ts.map +1 -1
  99. package/dist/ui/primitives/badge.d.ts +1 -1
  100. package/dist/ui/primitives/badge.d.ts.map +1 -1
  101. package/dist/ui/primitives/command.d.ts +1 -1
  102. package/dist/ui/primitives/dialog.d.ts +2 -2
  103. package/dist/ui/primitives/dropdown-menu.d.ts +1 -1
  104. package/dist/ui/primitives/input-group.d.ts +6 -6
  105. package/dist/ui/primitives/input-group.d.ts.map +1 -1
  106. package/dist/ui.js +27 -15
  107. package/dist/ui.js.map +8 -8
  108. package/dist/ui.mjs +27 -15
  109. package/dist/ui.mjs.map +8 -8
  110. package/package.json +3 -3
package/dist/ui.mjs CHANGED
@@ -3153,25 +3153,27 @@ function AgnoMessageReferences() {
3153
3153
  import { AlertCircle } from "lucide-react";
3154
3154
  import { jsx as jsx41, jsxs as jsxs24 } from "react/jsx-runtime";
3155
3155
  function AgnoMessageFooter({ showTimestamp = true } = {}) {
3156
- const { message, classNames, actions, isLastAssistantMessage, formatTimestamp } = useAgnoMessageContext();
3156
+ const { message, classNames, actions, isLastAssistantMessage, isStreamingThisMessage, formatTimestamp } = useAgnoMessageContext();
3157
3157
  const hasError = message.streamingError;
3158
3158
  const isCustomTimestamp = !!formatTimestamp;
3159
3159
  const resolvedFormatTimestamp = formatTimestamp ?? formatSmartTimestamp;
3160
- if (!actions?.assistant && !showTimestamp && !hasError)
3160
+ if (isStreamingThisMessage)
3161
3161
  return null;
3162
+ const hasActions = !!actions?.assistant;
3163
+ const visibility = actions?.visibility ?? "visible";
3164
+ if (hasActions && visibility === "last-assistant" && !isLastAssistantMessage) {
3165
+ return null;
3166
+ }
3167
+ if (!hasActions && !showTimestamp && !hasError)
3168
+ return null;
3169
+ const useHover = hasActions && (visibility === "hover" || visibility === "hover-last-visible" && !isLastAssistantMessage);
3162
3170
  return /* @__PURE__ */ jsxs24("div", {
3163
- className: "flex items-center gap-2 pt-1",
3171
+ className: cn("flex items-center gap-2 pt-1 transition-opacity", useHover && "opacity-0 group-hover/message:opacity-100"),
3164
3172
  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
- })(),
3173
+ hasActions && /* @__PURE__ */ jsx41("div", {
3174
+ className: cn("flex items-center gap-1", classNames?.assistant?.actions),
3175
+ children: actions.assistant(message)
3176
+ }),
3175
3177
  hasError && /* @__PURE__ */ jsxs24("span", {
3176
3178
  className: "flex items-center gap-1 text-[11px] text-destructive",
3177
3179
  children: [
@@ -3213,6 +3215,7 @@ function AgnoMessage({
3213
3215
  avatars,
3214
3216
  actions,
3215
3217
  isLastAssistantMessage = false,
3218
+ isStreamingThisMessage = false,
3216
3219
  showFilePreview = true,
3217
3220
  showImageLightbox = true,
3218
3221
  showTimestamp = true,
@@ -3228,6 +3231,7 @@ function AgnoMessage({
3228
3231
  const ctx = useMemo3(() => ({
3229
3232
  message,
3230
3233
  isLastAssistantMessage,
3234
+ isStreamingThisMessage,
3231
3235
  classNames,
3232
3236
  actions,
3233
3237
  avatars,
@@ -3248,6 +3252,7 @@ function AgnoMessage({
3248
3252
  }), [
3249
3253
  message,
3250
3254
  isLastAssistantMessage,
3255
+ isStreamingThisMessage,
3251
3256
  classNames,
3252
3257
  actions,
3253
3258
  avatars,
@@ -3410,6 +3415,7 @@ function AgnoMessageItem({
3410
3415
  avatars,
3411
3416
  actions,
3412
3417
  isLastAssistantMessage = false,
3418
+ isStreamingThisMessage = false,
3413
3419
  showReasoning = true,
3414
3420
  showReferences = true,
3415
3421
  showTimestamp = true,
@@ -3425,6 +3431,7 @@ function AgnoMessageItem({
3425
3431
  avatars,
3426
3432
  actions,
3427
3433
  isLastAssistantMessage,
3434
+ isStreamingThisMessage,
3428
3435
  showTimestamp,
3429
3436
  showFilePreview,
3430
3437
  showImageLightbox,
@@ -4134,6 +4141,7 @@ function AgnoChatRoot({
4134
4141
  renderTool,
4135
4142
  debug,
4136
4143
  skipToolsOnSessionLoad,
4144
+ background,
4137
4145
  className,
4138
4146
  ...divProps
4139
4147
  }) {
@@ -4145,9 +4153,12 @@ function AgnoChatRoot({
4145
4153
  const isDebug = resolveDebug(debug);
4146
4154
  const sendRef = useRef6(chat.sendMessage);
4147
4155
  sendRef.current = chat.sendMessage;
4156
+ const backgroundRef = useRef6(background);
4157
+ backgroundRef.current = background;
4148
4158
  const handleSend = useCallback7(async (message) => {
4149
4159
  try {
4150
- await sendRef.current(message);
4160
+ const bg = backgroundRef.current;
4161
+ await sendRef.current(message, bg !== undefined ? { background: bg } : undefined);
4151
4162
  } catch {}
4152
4163
  }, []);
4153
4164
  const {
@@ -4387,6 +4398,7 @@ function AgnoChatMessages({
4387
4398
  avatars,
4388
4399
  actions,
4389
4400
  isLastAssistantMessage: index === lastAssistantIndex,
4401
+ isStreamingThisMessage: index === lastAssistantIndex && isStreaming,
4390
4402
  ...messageItemProps
4391
4403
  }, `msg-${index}-${message.created_at}`);
4392
4404
  }),
@@ -4724,4 +4736,4 @@ export {
4724
4736
  Accordion
4725
4737
  };
4726
4738
 
4727
- //# debugId=762A645DC01D022A64756E2164756E21
4739
+ //# debugId=D1033843768AD28964756E2164756E21