@copilotz/chat-ui 0.1.19 → 0.1.21
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 +81 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +83 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +57 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -630,6 +630,78 @@ var ThinkingIndicator = (0, import_react.memo)(function ThinkingIndicator2({ lab
|
|
|
630
630
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-sm text-muted-foreground animate-pulse", children: label })
|
|
631
631
|
] });
|
|
632
632
|
});
|
|
633
|
+
var ThinkingBlock = (0, import_react.memo)(function ThinkingBlock2({ content, isStreaming = false, label = "Thinking", chunkSize = 12e3 }) {
|
|
634
|
+
const [open, setOpen] = (0, import_react.useState)(isStreaming);
|
|
635
|
+
(0, import_react.useEffect)(() => {
|
|
636
|
+
if (isStreaming) setOpen(true);
|
|
637
|
+
}, [isStreaming]);
|
|
638
|
+
(0, import_react.useEffect)(() => {
|
|
639
|
+
if (!isStreaming && open) {
|
|
640
|
+
const timer = setTimeout(() => setOpen(false), 600);
|
|
641
|
+
return () => clearTimeout(timer);
|
|
642
|
+
}
|
|
643
|
+
}, [isStreaming, open]);
|
|
644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mb-3 relative rounded-lg overflow-hidden", children: [
|
|
645
|
+
isStreaming && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
646
|
+
"div",
|
|
647
|
+
{
|
|
648
|
+
className: "absolute inset-0 rounded-lg pointer-events-none",
|
|
649
|
+
style: {
|
|
650
|
+
padding: "1px",
|
|
651
|
+
background: "linear-gradient(135deg, hsl(var(--primary) / 0.4), hsl(var(--muted-foreground) / 0.2), hsl(var(--primary) / 0.4))",
|
|
652
|
+
backgroundSize: "200% 200%",
|
|
653
|
+
animation: "thinking-shimmer 2s ease-in-out infinite"
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
),
|
|
657
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
658
|
+
"div",
|
|
659
|
+
{
|
|
660
|
+
className: `relative rounded-lg border bg-muted/30 ${isStreaming ? "border-transparent" : "border-muted-foreground/20"}`,
|
|
661
|
+
style: isStreaming ? { margin: "1px" } : void 0,
|
|
662
|
+
children: [
|
|
663
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
664
|
+
"button",
|
|
665
|
+
{
|
|
666
|
+
type: "button",
|
|
667
|
+
className: "flex w-full items-center gap-2 px-3 py-2 text-left text-xs font-medium text-muted-foreground hover:text-foreground/70 transition-colors",
|
|
668
|
+
onClick: () => setOpen((v) => !v),
|
|
669
|
+
children: [
|
|
670
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.BrainCircuit, { className: `h-3.5 w-3.5 flex-shrink-0 ${isStreaming ? "animate-pulse text-primary" : ""}` }),
|
|
671
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "flex-1", children: [
|
|
672
|
+
isStreaming ? label : `${label}`,
|
|
673
|
+
isStreaming && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { className: "ml-1 inline-flex gap-0.5", children: [
|
|
674
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "inline-block w-1 h-1 bg-current rounded-full animate-bounce", style: { animationDelay: "0ms" } }),
|
|
675
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "inline-block w-1 h-1 bg-current rounded-full animate-bounce", style: { animationDelay: "150ms" } }),
|
|
676
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "inline-block w-1 h-1 bg-current rounded-full animate-bounce", style: { animationDelay: "300ms" } })
|
|
677
|
+
] })
|
|
678
|
+
] }),
|
|
679
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.ChevronDown, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.ChevronRight, { className: "h-3 w-3" })
|
|
680
|
+
]
|
|
681
|
+
}
|
|
682
|
+
),
|
|
683
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "px-3 pb-3", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "border-l-2 border-muted-foreground/20 pl-3", children: [
|
|
684
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
685
|
+
PlainTextContent,
|
|
686
|
+
{
|
|
687
|
+
content,
|
|
688
|
+
className: "text-xs text-muted-foreground/80 leading-5",
|
|
689
|
+
chunkSize
|
|
690
|
+
}
|
|
691
|
+
),
|
|
692
|
+
isStreaming && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "inline-block w-1.5 h-3 bg-muted-foreground/40 animate-pulse ml-0.5" })
|
|
693
|
+
] }) })
|
|
694
|
+
]
|
|
695
|
+
}
|
|
696
|
+
),
|
|
697
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("style", { children: `
|
|
698
|
+
@keyframes thinking-shimmer {
|
|
699
|
+
0%, 100% { background-position: 0% 50%; }
|
|
700
|
+
50% { background-position: 100% 50%; }
|
|
701
|
+
}
|
|
702
|
+
` })
|
|
703
|
+
] });
|
|
704
|
+
});
|
|
633
705
|
var markdownComponents = {
|
|
634
706
|
code: ({ node, className, children, ...props }) => {
|
|
635
707
|
const inline = props.inline;
|
|
@@ -1020,6 +1092,15 @@ var Message = (0, import_react.memo)(({
|
|
|
1020
1092
|
] })
|
|
1021
1093
|
] })
|
|
1022
1094
|
] }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_jsx_runtime7.Fragment, { children: [
|
|
1095
|
+
!messageIsUser && message.reasoning && message.reasoning.trim().length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1096
|
+
ThinkingBlock,
|
|
1097
|
+
{
|
|
1098
|
+
content: message.reasoning,
|
|
1099
|
+
isStreaming: message.isStreaming,
|
|
1100
|
+
label: thinkingLabel,
|
|
1101
|
+
chunkSize: normalizedChunkChars
|
|
1102
|
+
}
|
|
1103
|
+
),
|
|
1023
1104
|
enableToolCallsDisplay && message.toolCalls && message.toolCalls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToolCallsDisplay, { toolCalls: message.toolCalls, label: toolUsedLabel }) }),
|
|
1024
1105
|
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1025
1106
|
StreamingText,
|