@copilotz/chat-ui 0.6.0 → 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.cjs +14 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -599,7 +599,7 @@ var AssistantActivitySummary = (0, import_react.memo)(function AssistantActivity
|
|
|
599
599
|
const isActive = activity.isActive;
|
|
600
600
|
const icon = activity.summary.kind === "using_tools" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.Wrench, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") }) : activity.summary.kind === "preparing_answer" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.Sparkles, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.Brain, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") });
|
|
601
601
|
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cn(
|
|
602
|
-
"flex items-center gap-2 rounded-lg border px-3 py-2 text-sm transition-colors",
|
|
602
|
+
"flex w-full min-w-0 items-center gap-2 rounded-lg border px-3 py-2 text-sm transition-colors",
|
|
603
603
|
isActive ? "border-primary/30 bg-primary/5 text-foreground" : "border-border/60 bg-muted/20 text-muted-foreground"
|
|
604
604
|
), children: [
|
|
605
605
|
icon,
|
|
@@ -647,7 +647,7 @@ var AssistantActivity = (0, import_react.memo)(function AssistantActivity2({
|
|
|
647
647
|
}
|
|
648
648
|
if (displayMode === "summary") {
|
|
649
649
|
if (!activity.isActive && activity.isComplete) return null;
|
|
650
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AssistantActivitySummary, { activity, labels }) });
|
|
650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mb-3 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AssistantActivitySummary, { activity, labels }) });
|
|
651
651
|
}
|
|
652
652
|
const hasDetails = Boolean(activity.reasoning) || Boolean(activity.toolCalls?.length);
|
|
653
653
|
const defaultOpen = activity.isActive && hasDetails;
|
|
@@ -657,8 +657,8 @@ var AssistantActivity = (0, import_react.memo)(function AssistantActivity2({
|
|
|
657
657
|
setOpen(true);
|
|
658
658
|
}
|
|
659
659
|
}, [activity.isActive, hasDetails]);
|
|
660
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Collapsible, { open, onOpenChange: setOpen, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-2", children: [
|
|
661
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mb-3 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Collapsible, { open, onOpenChange: setOpen, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-2", children: [
|
|
661
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex w-full items-center gap-2", children: [
|
|
662
662
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AssistantActivitySummary, { activity, labels }) }),
|
|
663
663
|
hasDetails && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Button, { variant: "ghost", size: "sm", className: "h-9 shrink-0 px-2 text-xs text-muted-foreground", children: [
|
|
664
664
|
open ? labels?.activityHideDetails || "Hide details" : labels?.activityShowDetails || "Show details",
|
|
@@ -672,6 +672,12 @@ var AssistantActivity = (0, import_react.memo)(function AssistantActivity2({
|
|
|
672
672
|
// src/components/chat/Message.tsx
|
|
673
673
|
var import_lucide_react2 = require("lucide-react");
|
|
674
674
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
675
|
+
var hasRenderableAssistantBody = (message) => {
|
|
676
|
+
if (message.role !== "assistant") return true;
|
|
677
|
+
if (typeof message.content === "string" && message.content.trim().length > 0) return true;
|
|
678
|
+
if (Array.isArray(message.attachments) && message.attachments.length > 0) return true;
|
|
679
|
+
return Boolean(message.activity);
|
|
680
|
+
};
|
|
675
681
|
var defaultMarkdownComponents = {
|
|
676
682
|
code: ({ node, className, children, ...props }) => {
|
|
677
683
|
const inline = props.inline;
|
|
@@ -917,6 +923,9 @@ var Message = (0, import_react2.memo)(({
|
|
|
917
923
|
const [showActions, setShowActions] = (0, import_react2.useState)(false);
|
|
918
924
|
const [copied, setCopied] = (0, import_react2.useState)(false);
|
|
919
925
|
const messageIsUser = isUser ?? message.role === "user";
|
|
926
|
+
if (!hasRenderableAssistantBody(message)) {
|
|
927
|
+
return null;
|
|
928
|
+
}
|
|
920
929
|
const agentSender = !messageIsUser && message.senderAgentId ? agentOptions.find(
|
|
921
930
|
(a) => a.id === message.senderAgentId || a.name.toLowerCase() === (message.senderAgentId ?? "").toLowerCase() || a.name.toLowerCase() === (message.senderName ?? "").toLowerCase()
|
|
922
931
|
) : void 0;
|
|
@@ -1010,7 +1019,7 @@ var Message = (0, import_react2.memo)(({
|
|
|
1010
1019
|
message.isEdited && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Badge, { variant: "outline", className: "text-xs", children: "editado" })
|
|
1011
1020
|
] })
|
|
1012
1021
|
] }),
|
|
1013
|
-
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `flex-1 min-w-0 ${messageIsUser ? "text-right" : "text-left"} ${horizontalOffsetClass}`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `relative
|
|
1022
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `flex-1 min-w-0 ${messageIsUser ? "text-right" : "text-left"} ${horizontalOffsetClass}`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("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: [
|
|
1014
1023
|
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-2", children: [
|
|
1015
1024
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1016
1025
|
Textarea,
|