@copilotz/chat-ui 0.6.1 → 0.6.2

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
@@ -558,7 +558,7 @@ var AssistantActivitySummary = memo(function AssistantActivitySummary2({
558
558
  const isActive = activity.isActive;
559
559
  const icon = activity.summary.kind === "using_tools" ? /* @__PURE__ */ jsx7(Wrench, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") }) : activity.summary.kind === "preparing_answer" ? /* @__PURE__ */ jsx7(Sparkles, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") }) : /* @__PURE__ */ jsx7(Brain, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") });
560
560
  return /* @__PURE__ */ jsxs2("div", { className: cn(
561
- "flex items-center gap-2 rounded-lg border px-3 py-2 text-sm transition-colors",
561
+ "flex w-full min-w-0 items-center gap-2 rounded-lg border px-3 py-2 text-sm transition-colors",
562
562
  isActive ? "border-primary/30 bg-primary/5 text-foreground" : "border-border/60 bg-muted/20 text-muted-foreground"
563
563
  ), children: [
564
564
  icon,
@@ -606,7 +606,7 @@ var AssistantActivity = memo(function AssistantActivity2({
606
606
  }
607
607
  if (displayMode === "summary") {
608
608
  if (!activity.isActive && activity.isComplete) return null;
609
- return /* @__PURE__ */ jsx7("div", { className: "mb-3", children: /* @__PURE__ */ jsx7(AssistantActivitySummary, { activity, labels }) });
609
+ return /* @__PURE__ */ jsx7("div", { className: "mb-3 w-full", children: /* @__PURE__ */ jsx7(AssistantActivitySummary, { activity, labels }) });
610
610
  }
611
611
  const hasDetails = Boolean(activity.reasoning) || Boolean(activity.toolCalls?.length);
612
612
  const defaultOpen = activity.isActive && hasDetails;
@@ -616,8 +616,8 @@ var AssistantActivity = memo(function AssistantActivity2({
616
616
  setOpen(true);
617
617
  }
618
618
  }, [activity.isActive, hasDetails]);
619
- return /* @__PURE__ */ jsx7("div", { className: "mb-3", children: /* @__PURE__ */ jsx7(Collapsible, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
620
- /* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-2", children: [
619
+ return /* @__PURE__ */ jsx7("div", { className: "mb-3 w-full", children: /* @__PURE__ */ jsx7(Collapsible, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
620
+ /* @__PURE__ */ jsxs2("div", { className: "flex w-full items-center gap-2", children: [
621
621
  /* @__PURE__ */ jsx7("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx7(AssistantActivitySummary, { activity, labels }) }),
622
622
  hasDetails && /* @__PURE__ */ jsx7(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs2(Button, { variant: "ghost", size: "sm", className: "h-9 shrink-0 px-2 text-xs text-muted-foreground", children: [
623
623
  open ? labels?.activityHideDetails || "Hide details" : labels?.activityShowDetails || "Show details",
@@ -637,6 +637,12 @@ import {
637
637
  X
638
638
  } from "lucide-react";
639
639
  import { Fragment, jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
640
+ var hasRenderableAssistantBody = (message) => {
641
+ if (message.role !== "assistant") return true;
642
+ if (typeof message.content === "string" && message.content.trim().length > 0) return true;
643
+ if (Array.isArray(message.attachments) && message.attachments.length > 0) return true;
644
+ return Boolean(message.activity);
645
+ };
640
646
  var defaultMarkdownComponents = {
641
647
  code: ({ node, className, children, ...props }) => {
642
648
  const inline = props.inline;
@@ -882,6 +888,9 @@ var Message = memo2(({
882
888
  const [showActions, setShowActions] = useState2(false);
883
889
  const [copied, setCopied] = useState2(false);
884
890
  const messageIsUser = isUser ?? message.role === "user";
891
+ if (!hasRenderableAssistantBody(message)) {
892
+ return null;
893
+ }
885
894
  const agentSender = !messageIsUser && message.senderAgentId ? agentOptions.find(
886
895
  (a) => a.id === message.senderAgentId || a.name.toLowerCase() === (message.senderAgentId ?? "").toLowerCase() || a.name.toLowerCase() === (message.senderName ?? "").toLowerCase()
887
896
  ) : void 0;
@@ -975,7 +984,7 @@ var Message = memo2(({
975
984
  message.isEdited && /* @__PURE__ */ jsx8(Badge, { variant: "outline", className: "text-xs", children: "editado" })
976
985
  ] })
977
986
  ] }),
978
- /* @__PURE__ */ jsx8("div", { className: `flex-1 min-w-0 ${messageIsUser ? "text-right" : "text-left"} ${horizontalOffsetClass}`, children: /* @__PURE__ */ jsxs3("div", { className: `relative inline-flex flex-col overflow-hidden text-left ${messageIsUser ? "rounded-lg p-3 bg-primary text-primary-foreground ml-auto max-w-[85%]" : "max-w-full"}`, children: [
987
+ /* @__PURE__ */ jsx8("div", { className: `flex-1 min-w-0 ${messageIsUser ? "text-right" : "text-left"} ${horizontalOffsetClass}`, children: /* @__PURE__ */ jsxs3("div", { className: `relative overflow-hidden text-left ${messageIsUser ? "ml-auto inline-flex max-w-[85%] flex-col rounded-lg bg-primary p-3 text-primary-foreground" : "flex w-full max-w-full flex-col"}`, children: [
979
988
  isEditing ? /* @__PURE__ */ jsxs3("div", { className: "space-y-2", children: [
980
989
  /* @__PURE__ */ jsx8(
981
990
  Textarea,