@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.
@@ -2491,6 +2491,7 @@ RatingComment.displayName = "RatingComment";
2491
2491
 
2492
2492
  // src/components/molecules/call-out.tsx
2493
2493
  import * as React33 from "react";
2494
+ import { ChevronDown as ChevronDown3, ChevronUp as ChevronUp2 } from "lucide-react";
2494
2495
 
2495
2496
  // src/components/hooks/use-text-streaming.ts
2496
2497
  import { useState as useState10, useEffect as useEffect10, useRef, useCallback as useCallback2 } from "react";
@@ -2621,10 +2622,26 @@ var CallOutActions = React33.forwardRef(({ className, actions, role, message, ..
2621
2622
  )) });
2622
2623
  });
2623
2624
  var CallOutResponse = React33.forwardRef(
2624
- ({ className, children, role, additionalInfo, isStreaming, handleIsTextStreaming, ...props }, ref) => {
2625
+ ({
2626
+ className,
2627
+ children,
2628
+ role,
2629
+ additionalInfo,
2630
+ toggleAdditionalInfo,
2631
+ isStreaming,
2632
+ handleIsTextStreaming,
2633
+ ...props
2634
+ }, ref) => {
2635
+ const [isAdditionalInfoOpen, setIsAdditionalInfoOpen] = React33.useState(false);
2625
2636
  const content = String(children || "");
2626
2637
  const shouldStream = role === "assistant" && isStreaming;
2627
- const displayedContent = useTextStreaming(content, shouldStream ?? false, handleIsTextStreaming);
2638
+ const displayedContent = useTextStreaming(
2639
+ content,
2640
+ shouldStream ?? false,
2641
+ handleIsTextStreaming
2642
+ );
2643
+ const showAsToggle = additionalInfo && toggleAdditionalInfo;
2644
+ const showInline = additionalInfo && !toggleAdditionalInfo;
2628
2645
  return /* @__PURE__ */ jsxs19(
2629
2646
  "div",
2630
2647
  {
@@ -2639,16 +2656,52 @@ var CallOutResponse = React33.forwardRef(
2639
2656
  ...props,
2640
2657
  children: [
2641
2658
  /* @__PURE__ */ jsx42(RichText, { content: displayedContent }),
2642
- additionalInfo && /* @__PURE__ */ jsx42(
2659
+ showInline && /* @__PURE__ */ jsx42(
2643
2660
  "div",
2644
2661
  {
2645
2662
  className: cn(
2646
2663
  "alq--callout-response-additional-info",
2647
- "mt-2 text-sm text-muted-foreground",
2664
+ "mt-2 text-sm text-muted-foreground whitespace-pre-line",
2648
2665
  "border-t border-border pt-2"
2649
2666
  ),
2650
2667
  children: additionalInfo
2651
2668
  }
2669
+ ),
2670
+ showAsToggle && /* @__PURE__ */ jsxs19(
2671
+ "div",
2672
+ {
2673
+ className: cn(
2674
+ "alq--callout-response-additional-info",
2675
+ "mt-2 border-t border-border pt-2"
2676
+ ),
2677
+ children: [
2678
+ /* @__PURE__ */ jsxs19(
2679
+ Button,
2680
+ {
2681
+ type: "button",
2682
+ variant: "ghost",
2683
+ size: "sm",
2684
+ className: "h-auto py-1.5 px-0 text-xs text-muted-foreground hover:bg-transparent hover:text-muted-foreground -ml-1",
2685
+ onClick: () => setIsAdditionalInfoOpen((prev) => !prev),
2686
+ "aria-expanded": isAdditionalInfoOpen,
2687
+ children: [
2688
+ isAdditionalInfoOpen ? /* @__PURE__ */ jsx42(ChevronUp2, { className: "h-4 w-4 mr-1.5 shrink-0 transition-transform" }) : /* @__PURE__ */ jsx42(ChevronDown3, { className: "h-4 w-4 mr-1.5 shrink-0 transition-transform" }),
2689
+ isAdditionalInfoOpen ? "Hide details" : "Show details"
2690
+ ]
2691
+ }
2692
+ ),
2693
+ /* @__PURE__ */ jsx42(
2694
+ "div",
2695
+ {
2696
+ className: cn(
2697
+ "grid transition-[grid-template-rows] duration-200 ease-out",
2698
+ isAdditionalInfoOpen ? "grid-rows-[1fr]" : "grid-rows-[0fr]"
2699
+ ),
2700
+ children: /* @__PURE__ */ jsx42("div", { className: "overflow-hidden", children: /* @__PURE__ */ jsx42("div", { className: "text-sm text-muted-foreground pt-1 whitespace-pre-line", children: additionalInfo }) })
2701
+ }
2702
+ )
2703
+ ]
2704
+ }
2652
2705
  )
2653
2706
  ]
2654
2707
  }
@@ -2737,7 +2790,9 @@ var AssistantMessageArea = React34.forwardRef(
2737
2790
  {
2738
2791
  role: "assistant",
2739
2792
  "data-error-code": message.error_code,
2740
- additionalInfo: showDetailedErrors ? message.error_detail : void 0,
2793
+ additionalInfo: showDetailedErrors ? `${message.error_detail}
2794
+ stream id: ${message.stream_id}` : void 0,
2795
+ toggleAdditionalInfo: true,
2741
2796
  children: getErrorMessage(message.error_code)
2742
2797
  }
2743
2798
  ),