@smartspace/chat-ui 1.14.4-pr.660.70349c4 → 1.14.4-pr.661.6142901

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/dist/index.js CHANGED
@@ -20626,6 +20626,25 @@ function MessageErrorDetails({
20626
20626
  ] })
20627
20627
  ] });
20628
20628
  }
20629
+ function MessageReasoning({ text: text6 }) {
20630
+ const [expanded, setExpanded] = useState(false);
20631
+ return /* @__PURE__ */ jsxs("div", { className: "mb-1", children: [
20632
+ /* @__PURE__ */ jsxs(
20633
+ "button",
20634
+ {
20635
+ type: "button",
20636
+ onClick: () => setExpanded((prev) => !prev),
20637
+ "aria-expanded": expanded,
20638
+ className: "m-0 inline-flex w-auto cursor-pointer appearance-none items-center gap-1 border-0 bg-transparent p-0 text-[11px] font-medium leading-none text-muted-foreground hover:text-foreground",
20639
+ children: [
20640
+ expanded ? /* @__PURE__ */ jsx(ChevronDown, { className: "h-3 w-3 shrink-0" }) : /* @__PURE__ */ jsx(ChevronRight, { className: "h-3 w-3 shrink-0" }),
20641
+ expanded ? "Hide reasoning" : "Show reasoning"
20642
+ ]
20643
+ }
20644
+ ),
20645
+ expanded && /* @__PURE__ */ jsx("div", { className: "mt-1.5 rounded-md bg-secondary/60 p-2 text-[13px] text-muted-foreground", children: /* @__PURE__ */ jsx(MessageMarkdown, { value: text6 }) })
20646
+ ] });
20647
+ }
20629
20648
  var ThinkingSection = ({ status }) => /* @__PURE__ */ jsxs(
20630
20649
  "div",
20631
20650
  {
@@ -20749,10 +20768,16 @@ var MessageItem = ({
20749
20768
  let keyCounter = 0;
20750
20769
  let lastStatusText = null;
20751
20770
  let hasOutputContent = false;
20771
+ let firstOutputIndex = null;
20772
+ const markOutput = () => {
20773
+ if (firstOutputIndex === null) firstOutputIndex = bubbles.length;
20774
+ hasOutputContent = true;
20775
+ };
20776
+ const reasoningTexts = [];
20752
20777
  const groupHasAnything = () => groupContent.length > 0 || groupFiles.length > 0 || groupSources.length > 0;
20753
20778
  const flush = (nextType) => {
20754
20779
  if (groupHasAnything()) {
20755
- if (groupType === "Output" /* OUTPUT */) hasOutputContent = true;
20780
+ if (groupType === "Output" /* OUTPUT */) markOutput();
20756
20781
  bubbles.push(
20757
20782
  /* @__PURE__ */ jsx(
20758
20783
  MessageBubble,
@@ -20862,6 +20887,12 @@ var MessageItem = ({
20862
20887
  groupOpen = true;
20863
20888
  break;
20864
20889
  }
20890
+ case "reasoning": {
20891
+ if (typeof v.value === "string" && v.value.trim() !== "") {
20892
+ reasoningTexts.push(v.value);
20893
+ }
20894
+ continue;
20895
+ }
20865
20896
  case "sources": {
20866
20897
  groupSources = coerceSources(v.value);
20867
20898
  if (groupSources.length > 0) groupOpen = true;
@@ -20879,7 +20910,7 @@ var MessageItem = ({
20879
20910
  lastCreatedByUserId = v.createdByUserId;
20880
20911
  }
20881
20912
  if (groupOpen && groupHasAnything()) {
20882
- if (groupType === "Output" /* OUTPUT */) hasOutputContent = true;
20913
+ if (groupType === "Output" /* OUTPUT */) markOutput();
20883
20914
  bubbles.push(
20884
20915
  /* @__PURE__ */ jsx(
20885
20916
  MessageBubble,
@@ -20900,6 +20931,19 @@ var MessageItem = ({
20900
20931
  )
20901
20932
  );
20902
20933
  }
20934
+ if (reasoningTexts.length > 0) {
20935
+ bubbles.splice(
20936
+ firstOutputIndex ?? bubbles.length,
20937
+ 0,
20938
+ /* @__PURE__ */ jsx(
20939
+ MessageReasoning,
20940
+ {
20941
+ text: reasoningTexts.join("\n\n")
20942
+ },
20943
+ `reasoning-${message.id ?? "msg"}`
20944
+ )
20945
+ );
20946
+ }
20903
20947
  const showThinking = isLive && (lastStatusText !== null || !hasOutputContent);
20904
20948
  if (showThinking) {
20905
20949
  bubbles.push(