@alquimia-ai/ui 1.7.0 → 1.8.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.
@@ -59,9 +59,10 @@ interface AssistantInputProps extends React$1.FormHTMLAttributes<HTMLFormElement
59
59
  sendMessageFunc: (event: React$1.FormEvent<HTMLFormElement>) => Promise<void>;
60
60
  isButtonDisabled: boolean;
61
61
  input: string;
62
- handleInputChange: (event: React$1.ChangeEvent<HTMLInputElement>) => void;
62
+ handleInputChange: (event: React$1.ChangeEvent<HTMLTextAreaElement>) => void;
63
63
  isMessageStreaming: boolean;
64
64
  speechToTextComponent?: React$1.ReactNode;
65
+ userToolboxComponent?: React$1.ReactNode;
65
66
  placeholders?: [string, string];
66
67
  }
67
68
  declare const AssistantInput: React$1.ForwardRefExoticComponent<AssistantInputProps & React$1.RefAttributes<HTMLFormElement>>;
@@ -59,9 +59,10 @@ interface AssistantInputProps extends React$1.FormHTMLAttributes<HTMLFormElement
59
59
  sendMessageFunc: (event: React$1.FormEvent<HTMLFormElement>) => Promise<void>;
60
60
  isButtonDisabled: boolean;
61
61
  input: string;
62
- handleInputChange: (event: React$1.ChangeEvent<HTMLInputElement>) => void;
62
+ handleInputChange: (event: React$1.ChangeEvent<HTMLTextAreaElement>) => void;
63
63
  isMessageStreaming: boolean;
64
64
  speechToTextComponent?: React$1.ReactNode;
65
+ userToolboxComponent?: React$1.ReactNode;
65
66
  placeholders?: [string, string];
66
67
  }
67
68
  declare const AssistantInput: React$1.ForwardRefExoticComponent<AssistantInputProps & React$1.RefAttributes<HTMLFormElement>>;
@@ -2753,15 +2753,6 @@ var AssistantMessageArea = React34.forwardRef(
2753
2753
  role: message.role,
2754
2754
  message,
2755
2755
  children: [
2756
- message.created_at && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "text-xs text-muted-foreground/80 pb-1", children: new Date(Number(message.created_at)).toLocaleString("es-ES", {
2757
- day: "2-digit",
2758
- month: "2-digit",
2759
- year: "numeric",
2760
- hour: "2-digit",
2761
- minute: "2-digit",
2762
- second: "2-digit",
2763
- hour12: false
2764
- }) }),
2765
2756
  streamingMessageId === message.id && (isLoading || message.content.length === 0) && !message.error_code && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { children: thinkIndicator ?? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ThinkIndicator, {}) }),
2766
2757
  message.error_code && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2767
2758
  CallOutResponse,
@@ -2771,25 +2762,45 @@ var AssistantMessageArea = React34.forwardRef(
2771
2762
  children: "We have an internal error, please try again later."
2772
2763
  }
2773
2764
  ),
2774
- message.tooler && !message.error_code && hasToolResult(message.tooler) && toolFactory?.createTool(message.tooler?.tool_summary?.name, message.tooler?.tool_output?.result),
2775
- message.content && !message.error_code && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2776
- CallOutResponse,
2777
- {
2778
- role: message.role,
2779
- isStreaming: streamingMessageId === message.id,
2780
- handleIsTextStreaming,
2781
- additionalInfo: streamingMessageId !== message.id ? message?.additionalInfo : void 0,
2782
- children: message.content
2783
- }
2765
+ message.tooler && !message.error_code && hasToolResult(message.tooler) && toolFactory?.createTool(
2766
+ message.tooler?.tool_summary?.name,
2767
+ message.tooler?.tool_output?.result
2784
2768
  ),
2785
- actions && streamingMessageId !== message.id && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2786
- CallOutActions,
2769
+ message.content && !message.error_code && /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
2770
+ "div",
2787
2771
  {
2788
- actions,
2789
- message,
2790
- role: message.role
2791
- },
2792
- message.id
2772
+ "data-role": message.role,
2773
+ className: "alq--callout-message-container",
2774
+ children: [
2775
+ message.created_at && streamingMessageId !== message.id && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "text-xs text-muted-foreground/80 pb-1 alq--callout-message-date", children: new Date(Number(message.created_at)).toLocaleString(
2776
+ "es-ES",
2777
+ {
2778
+ hour: "2-digit",
2779
+ minute: "2-digit",
2780
+ hour12: false
2781
+ }
2782
+ ) }),
2783
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2784
+ CallOutResponse,
2785
+ {
2786
+ role: message.role,
2787
+ isStreaming: streamingMessageId === message.id,
2788
+ handleIsTextStreaming,
2789
+ additionalInfo: streamingMessageId !== message.id ? message?.additionalInfo : void 0,
2790
+ children: message.content
2791
+ }
2792
+ ),
2793
+ actions && streamingMessageId !== message.id && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2794
+ CallOutActions,
2795
+ {
2796
+ actions,
2797
+ message,
2798
+ role: message.role
2799
+ },
2800
+ message.id
2801
+ )
2802
+ ]
2803
+ }
2793
2804
  )
2794
2805
  ]
2795
2806
  },
@@ -2811,6 +2822,7 @@ var AssistantInput = React34.forwardRef(
2811
2822
  handleInputChange,
2812
2823
  isMessageStreaming,
2813
2824
  speechToTextComponent,
2825
+ userToolboxComponent,
2814
2826
  placeholders,
2815
2827
  ...props
2816
2828
  }, ref) => {
@@ -2819,40 +2831,48 @@ var AssistantInput = React34.forwardRef(
2819
2831
  "form",
2820
2832
  {
2821
2833
  onSubmit: sendMessageFunc,
2822
- className: cn("flex items-center space-x-4", className),
2834
+ className: cn("flex items-center relative", className),
2823
2835
  ref,
2824
2836
  ...props,
2825
2837
  children: [
2826
2838
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2827
- "input",
2839
+ "textarea",
2828
2840
  {
2829
- type: "text",
2830
2841
  disabled: isButtonDisabled,
2831
2842
  value: input,
2832
2843
  onChange: handleInputChange,
2833
2844
  placeholder,
2834
2845
  className: cn(
2835
- "flex-1 text-sm p-3 rounded-lg focus:outline-none w-full",
2846
+ "flex-1 text-sm p-3 rounded-lg focus:outline-none w-full resize-none",
2836
2847
  "border border-input bg-background text-foreground",
2837
2848
  "placeholder:text-muted-foreground",
2838
2849
  "focus:ring-2 focus:ring-ring",
2839
2850
  "disabled:opacity-50 disabled:cursor-not-allowed"
2840
- )
2841
- }
2842
- ),
2843
- speechToTextComponent && speechToTextComponent,
2844
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2845
- "button",
2846
- {
2847
- type: "submit",
2848
- disabled: isButtonDisabled,
2849
- className: cn(
2850
- "w-10 h-10 rounded-full flex items-center justify-center alq--assistant-button-send",
2851
- isButtonDisabled ? "bg-muted text-muted-foreground" : "bg-primary text-primary-foreground hover:bg-primary/90"
2852
2851
  ),
2853
- children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react14.Send, { className: "w-5 h-5" })
2852
+ onKeyDown: (e) => {
2853
+ if (e.key === "Enter" && !e.shiftKey) {
2854
+ e.preventDefault();
2855
+ sendMessageFunc(e);
2856
+ }
2857
+ }
2854
2858
  }
2855
- )
2859
+ ),
2860
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "relative alq--assistant-actions", children: [
2861
+ userToolboxComponent && userToolboxComponent,
2862
+ speechToTextComponent && speechToTextComponent,
2863
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
2864
+ "button",
2865
+ {
2866
+ type: "submit",
2867
+ disabled: isButtonDisabled,
2868
+ className: cn(
2869
+ "w-10 h-10 rounded-full flex items-center justify-center alq--assistant-button-send",
2870
+ isButtonDisabled ? "bg-muted text-muted-foreground" : "bg-primary text-primary-foreground hover:bg-primary/90"
2871
+ ),
2872
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react14.Send, { className: "w-5 h-5" })
2873
+ }
2874
+ )
2875
+ ] })
2856
2876
  ]
2857
2877
  }
2858
2878
  );