@alquimia-ai/ui 1.8.2 → 1.8.4

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.
@@ -44,6 +44,7 @@ interface AssistantMessageAreaProps extends React$1.HTMLAttributes<HTMLDivElemen
44
44
  additionalInfo?: string;
45
45
  loading?: boolean;
46
46
  tooler?: Tooler[];
47
+ stream_id?: string;
47
48
  })[];
48
49
  actions?: MessageAction[];
49
50
  messagesEndRef: any;
@@ -44,6 +44,7 @@ interface AssistantMessageAreaProps extends React$1.HTMLAttributes<HTMLDivElemen
44
44
  additionalInfo?: string;
45
45
  loading?: boolean;
46
46
  tooler?: Tooler[];
47
+ stream_id?: string;
47
48
  })[];
48
49
  actions?: MessageAction[];
49
50
  messagesEndRef: any;
@@ -2531,6 +2531,7 @@ RatingComment.displayName = "RatingComment";
2531
2531
 
2532
2532
  // src/components/molecules/call-out.tsx
2533
2533
  var React33 = __toESM(require("react"));
2534
+ var import_lucide_react14 = require("lucide-react");
2534
2535
 
2535
2536
  // src/components/hooks/use-text-streaming.ts
2536
2537
  var import_react8 = require("react");
@@ -2661,10 +2662,26 @@ var CallOutActions = React33.forwardRef(({ className, actions, role, message, ..
2661
2662
  )) });
2662
2663
  });
2663
2664
  var CallOutResponse = React33.forwardRef(
2664
- ({ className, children, role, additionalInfo, isStreaming, handleIsTextStreaming, ...props }, ref) => {
2665
+ ({
2666
+ className,
2667
+ children,
2668
+ role,
2669
+ additionalInfo,
2670
+ toggleAdditionalInfo,
2671
+ isStreaming,
2672
+ handleIsTextStreaming,
2673
+ ...props
2674
+ }, ref) => {
2675
+ const [isAdditionalInfoOpen, setIsAdditionalInfoOpen] = React33.useState(false);
2665
2676
  const content = String(children || "");
2666
2677
  const shouldStream = role === "assistant" && isStreaming;
2667
- const displayedContent = useTextStreaming(content, shouldStream ?? false, handleIsTextStreaming);
2678
+ const displayedContent = useTextStreaming(
2679
+ content,
2680
+ shouldStream ?? false,
2681
+ handleIsTextStreaming
2682
+ );
2683
+ const showAsToggle = additionalInfo && toggleAdditionalInfo;
2684
+ const showInline = additionalInfo && !toggleAdditionalInfo;
2668
2685
  return /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
2669
2686
  "div",
2670
2687
  {
@@ -2679,16 +2696,52 @@ var CallOutResponse = React33.forwardRef(
2679
2696
  ...props,
2680
2697
  children: [
2681
2698
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(RichText, { content: displayedContent }),
2682
- additionalInfo && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
2699
+ showInline && /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
2683
2700
  "div",
2684
2701
  {
2685
2702
  className: cn(
2686
2703
  "alq--callout-response-additional-info",
2687
- "mt-2 text-sm text-muted-foreground",
2704
+ "mt-2 text-sm text-muted-foreground whitespace-pre-line",
2688
2705
  "border-t border-border pt-2"
2689
2706
  ),
2690
2707
  children: additionalInfo
2691
2708
  }
2709
+ ),
2710
+ showAsToggle && /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
2711
+ "div",
2712
+ {
2713
+ className: cn(
2714
+ "alq--callout-response-additional-info",
2715
+ "mt-2 border-t border-border pt-2"
2716
+ ),
2717
+ children: [
2718
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)(
2719
+ Button,
2720
+ {
2721
+ type: "button",
2722
+ variant: "ghost",
2723
+ size: "sm",
2724
+ className: "h-auto py-1.5 px-0 text-xs text-muted-foreground hover:bg-transparent hover:text-muted-foreground -ml-1",
2725
+ onClick: () => setIsAdditionalInfoOpen((prev) => !prev),
2726
+ "aria-expanded": isAdditionalInfoOpen,
2727
+ children: [
2728
+ isAdditionalInfoOpen ? /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react14.ChevronUp, { className: "h-4 w-4 mr-1.5 shrink-0 transition-transform" }) : /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_lucide_react14.ChevronDown, { className: "h-4 w-4 mr-1.5 shrink-0 transition-transform" }),
2729
+ isAdditionalInfoOpen ? "Hide details" : "Show details"
2730
+ ]
2731
+ }
2732
+ ),
2733
+ /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
2734
+ "div",
2735
+ {
2736
+ className: cn(
2737
+ "grid transition-[grid-template-rows] duration-200 ease-out",
2738
+ isAdditionalInfoOpen ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
2739
+ ),
2740
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("div", { className: "text-sm text-muted-foreground pt-1 whitespace-pre-line", children: additionalInfo }) })
2741
+ }
2742
+ )
2743
+ ]
2744
+ }
2692
2745
  )
2693
2746
  ]
2694
2747
  }
@@ -2701,7 +2754,7 @@ CallOutActions.displayName = "CallOutActions";
2701
2754
  CallOutResponse.displayName = "CallOutResponse";
2702
2755
 
2703
2756
  // src/components/organisms/assistant.tsx
2704
- var import_lucide_react14 = require("lucide-react");
2757
+ var import_lucide_react15 = require("lucide-react");
2705
2758
  var import_jsx_runtime43 = require("react/jsx-runtime");
2706
2759
  var Assistant = React34.forwardRef(
2707
2760
  ({ className, sdk, title, description, children, ...props }, ref) => {
@@ -2777,7 +2830,9 @@ var AssistantMessageArea = React34.forwardRef(
2777
2830
  {
2778
2831
  role: "assistant",
2779
2832
  "data-error-code": message.error_code,
2780
- additionalInfo: showDetailedErrors ? message.error_detail : void 0,
2833
+ additionalInfo: showDetailedErrors ? `${message.error_detail}
2834
+ stream id: ${message.stream_id}` : void 0,
2835
+ toggleAdditionalInfo: true,
2781
2836
  children: getErrorMessage(message.error_code)
2782
2837
  }
2783
2838
  ),
@@ -2885,7 +2940,7 @@ var AssistantInput = React34.forwardRef(
2885
2940
  "w-10 h-10 rounded-full flex items-center justify-center alq--assistant-button-send",
2886
2941
  isButtonDisabled ? "bg-muted text-muted-foreground" : "bg-primary text-primary-foreground hover:bg-primary/90"
2887
2942
  ),
2888
- children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react14.Send, { className: "w-5 h-5" })
2943
+ children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react15.Send, { className: "w-5 h-5" })
2889
2944
  }
2890
2945
  )
2891
2946
  ] })