@copilotkit/react-ui 0.11.0 → 0.13.0-alpha.0
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/.turbo/turbo-build.log +216 -197
- package/CHANGELOG.md +22 -0
- package/dist/components/chat-components/chat-list.mjs +440 -12
- package/dist/components/chat-components/chat-list.mjs.map +1 -1
- package/dist/components/chat-components/chat-message-actions.mjs +168 -7
- package/dist/components/chat-components/chat-message-actions.mjs.map +1 -1
- package/dist/components/chat-components/chat-message.mjs +403 -10
- package/dist/components/chat-components/chat-message.mjs.map +1 -1
- package/dist/components/chat-components/chat-panel.mjs +300 -9
- package/dist/components/chat-components/chat-panel.mjs.map +1 -1
- package/dist/components/chat-components/chat-scroll-anchor.mjs +44 -4
- package/dist/components/chat-components/chat-scroll-anchor.mjs.map +1 -1
- package/dist/components/chat-components/clear-history.mjs +273 -74
- package/dist/components/chat-components/clear-history.mjs.map +1 -1
- package/dist/components/chat-components/copilot-chat.mjs +808 -21
- package/dist/components/chat-components/copilot-chat.mjs.map +1 -1
- package/dist/components/chat-components/default-empty-screen.mjs +175 -7
- package/dist/components/chat-components/default-empty-screen.mjs.map +1 -1
- package/dist/components/chat-components/external-link.d.ts +1 -1
- package/dist/components/chat-components/external-link.mjs +25 -3
- package/dist/components/chat-components/external-link.mjs.map +1 -1
- package/dist/components/chat-components/markdown.mjs +10 -3
- package/dist/components/chat-components/markdown.mjs.map +1 -1
- package/dist/components/chat-components/prompt-form.d.ts +1 -1
- package/dist/components/chat-components/prompt-form.mjs +227 -8
- package/dist/components/chat-components/prompt-form.mjs.map +1 -1
- package/dist/components/chat-components/theme-toggle.mjs +143 -31
- package/dist/components/chat-components/theme-toggle.mjs.map +1 -1
- package/dist/components/chat-components/toaster.mjs +7 -3
- package/dist/components/chat-components/toaster.mjs.map +1 -1
- package/dist/components/chat-components/ui/alert-dialog.mjs +199 -5
- package/dist/components/chat-components/ui/alert-dialog.mjs.map +1 -1
- package/dist/components/chat-components/ui/badge.d.ts +1 -1
- package/dist/components/chat-components/ui/badge.mjs +50 -10
- package/dist/components/chat-components/ui/badge.mjs.map +1 -1
- package/dist/components/chat-components/ui/button.mjs +85 -4
- package/dist/components/chat-components/ui/button.mjs.map +1 -1
- package/dist/components/chat-components/ui/codeblock.mjs +283 -7
- package/dist/components/chat-components/ui/codeblock.mjs.map +1 -1
- package/dist/components/chat-components/ui/dialog.mjs +128 -85
- package/dist/components/chat-components/ui/dialog.mjs.map +1 -1
- package/dist/components/chat-components/ui/dropdown-menu.mjs +103 -47
- package/dist/components/chat-components/ui/dropdown-menu.mjs.map +1 -1
- package/dist/components/chat-components/ui/icons.mjs +554 -4
- package/dist/components/chat-components/ui/icons.mjs.map +1 -1
- package/dist/components/chat-components/ui/input.mjs +59 -15
- package/dist/components/chat-components/ui/input.mjs.map +1 -1
- package/dist/components/chat-components/ui/label.mjs +52 -13
- package/dist/components/chat-components/ui/label.mjs.map +1 -1
- package/dist/components/chat-components/ui/select.mjs +156 -71
- package/dist/components/chat-components/ui/select.mjs.map +1 -1
- package/dist/components/chat-components/ui/separator.mjs +68 -4
- package/dist/components/chat-components/ui/separator.mjs.map +1 -1
- package/dist/components/chat-components/ui/sheet.mjs +127 -74
- package/dist/components/chat-components/ui/sheet.mjs.map +1 -1
- package/dist/components/chat-components/ui/switch.mjs +69 -18
- package/dist/components/chat-components/ui/switch.mjs.map +1 -1
- package/dist/components/chat-components/ui/textarea.mjs +58 -14
- package/dist/components/chat-components/ui/textarea.mjs.map +1 -1
- package/dist/components/chat-components/ui/tooltip.mjs +72 -4
- package/dist/components/chat-components/ui/tooltip.mjs.map +1 -1
- package/dist/components/index.mjs +924 -25
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/sidebar/copilot-sidebar-ui-provider.d.ts +1 -1
- package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs +919 -24
- package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs.map +1 -1
- package/dist/components/sidebar/copilot-sidebar.mjs +841 -22
- package/dist/components/sidebar/copilot-sidebar.mjs.map +1 -1
- package/dist/components/sidebar/sidebar-context.mjs +10 -3
- package/dist/components/sidebar/sidebar-context.mjs.map +1 -1
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.mjs +0 -2
- package/dist/context/index.mjs.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.mjs +0 -2
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/use-at-bottom.mjs +19 -3
- package/dist/hooks/use-at-bottom.mjs.map +1 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +1 -1
- package/dist/hooks/use-copy-to-clipboard.mjs +26 -3
- package/dist/hooks/use-copy-to-clipboard.mjs.map +1 -1
- package/dist/hooks/use-enter-submit.mjs +16 -3
- package/dist/hooks/use-enter-submit.mjs.map +1 -1
- package/dist/index.mjs +924 -28
- package/dist/index.mjs.map +1 -1
- package/dist/lib/utils.mjs +62 -3
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/lib/utils.test.d.ts +1 -0
- package/dist/lib/utils.test.mjs +0 -1
- package/dist/lib/utils.test.mjs.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.mjs +0 -2
- package/dist/types/index.mjs.map +1 -1
- package/dist/types/types.mjs +0 -2
- package/dist/types/types.mjs.map +1 -1
- package/package.json +6 -6
- package/src/components/chat-components/chat-list.tsx +2 -6
- package/src/components/chat-components/chat-message-actions.tsx +2 -6
- package/src/components/chat-components/chat-message.tsx +2 -6
- package/src/components/chat-components/chat-panel.tsx +3 -17
- package/src/components/chat-components/clear-history.tsx +1 -2
- package/src/components/chat-components/copilot-chat.tsx +6 -5
- package/src/components/chat-components/default-empty-screen.tsx +3 -9
- package/src/components/chat-components/external-link.tsx +2 -14
- package/src/components/chat-components/markdown.tsx +1 -2
- package/src/components/chat-components/prompt-form.tsx +2 -8
- package/src/components/chat-components/ui/alert-dialog.tsx +9 -33
- package/src/components/chat-components/ui/badge.tsx +3 -6
- package/src/components/chat-components/ui/button.tsx +7 -15
- package/src/components/chat-components/ui/codeblock.tsx +1 -4
- package/src/components/chat-components/ui/dialog.tsx +8 -30
- package/src/components/chat-components/ui/dropdown-menu.tsx +7 -18
- package/src/components/chat-components/ui/icons.tsx +6 -29
- package/src/components/chat-components/ui/input.tsx +3 -4
- package/src/components/chat-components/ui/label.tsx +3 -8
- package/src/components/chat-components/ui/select.tsx +4 -4
- package/src/components/chat-components/ui/separator.tsx +13 -18
- package/src/components/chat-components/ui/sheet.tsx +7 -23
- package/src/components/chat-components/ui/switch.tsx +2 -2
- package/src/components/chat-components/ui/textarea.tsx +3 -4
- package/src/components/chat-components/ui/tooltip.tsx +1 -1
- package/src/components/sidebar/copilot-sidebar-ui-provider.tsx +2 -6
- package/src/components/sidebar/copilot-sidebar.tsx +1 -3
- package/src/hooks/use-at-bottom.tsx +1 -4
- package/src/hooks/use-copy-to-clipboard.tsx +1 -3
- package/src/hooks/use-enter-submit.tsx +2 -8
- package/src/lib/utils.ts +2 -5
- package/dist/chunk-2NO6SF5H.mjs +0 -53
- package/dist/chunk-2NO6SF5H.mjs.map +0 -1
- package/dist/chunk-6LAC5RA2.mjs +0 -28
- package/dist/chunk-6LAC5RA2.mjs.map +0 -1
- package/dist/chunk-6LRNF2VU.mjs +0 -12
- package/dist/chunk-6LRNF2VU.mjs.map +0 -1
- package/dist/chunk-6UJWRTL6.mjs +0 -45
- package/dist/chunk-6UJWRTL6.mjs.map +0 -1
- package/dist/chunk-7KPMJBGH.mjs +0 -48
- package/dist/chunk-7KPMJBGH.mjs.map +0 -1
- package/dist/chunk-7NSRDJ5C.mjs +0 -3
- package/dist/chunk-7NSRDJ5C.mjs.map +0 -1
- package/dist/chunk-APH6ZQHG.mjs +0 -69
- package/dist/chunk-APH6ZQHG.mjs.map +0 -1
- package/dist/chunk-BIPCPNHG.mjs +0 -18
- package/dist/chunk-BIPCPNHG.mjs.map +0 -1
- package/dist/chunk-BS6RR2DJ.mjs +0 -25
- package/dist/chunk-BS6RR2DJ.mjs.map +0 -1
- package/dist/chunk-DOMJCSI6.mjs +0 -26
- package/dist/chunk-DOMJCSI6.mjs.map +0 -1
- package/dist/chunk-H4VKQGVU.mjs +0 -3
- package/dist/chunk-H4VKQGVU.mjs.map +0 -1
- package/dist/chunk-HKSY5T7Y.mjs +0 -140
- package/dist/chunk-HKSY5T7Y.mjs.map +0 -1
- package/dist/chunk-I2AB5FK4.mjs +0 -123
- package/dist/chunk-I2AB5FK4.mjs.map +0 -1
- package/dist/chunk-IU3WTXLQ.mjs +0 -3
- package/dist/chunk-IU3WTXLQ.mjs.map +0 -1
- package/dist/chunk-KR7MH7XO.mjs +0 -481
- package/dist/chunk-KR7MH7XO.mjs.map +0 -1
- package/dist/chunk-KXJV37FS.mjs +0 -33
- package/dist/chunk-KXJV37FS.mjs.map +0 -1
- package/dist/chunk-LMCFSE4V.mjs +0 -29
- package/dist/chunk-LMCFSE4V.mjs.map +0 -1
- package/dist/chunk-MC6KTH4X.mjs +0 -12
- package/dist/chunk-MC6KTH4X.mjs.map +0 -1
- package/dist/chunk-MRXNTQOX.mjs +0 -55
- package/dist/chunk-MRXNTQOX.mjs.map +0 -1
- package/dist/chunk-N7KB3Z57.mjs +0 -23
- package/dist/chunk-N7KB3Z57.mjs.map +0 -1
- package/dist/chunk-RSONJDLO.mjs +0 -28
- package/dist/chunk-RSONJDLO.mjs.map +0 -1
- package/dist/chunk-TUPGAO7T.mjs +0 -72
- package/dist/chunk-TUPGAO7T.mjs.map +0 -1
- package/dist/chunk-TVTG3V4F.mjs +0 -40
- package/dist/chunk-TVTG3V4F.mjs.map +0 -1
- package/dist/chunk-U6NJWGTV.mjs +0 -3
- package/dist/chunk-U6NJWGTV.mjs.map +0 -1
- package/dist/chunk-UKKJ6H2K.mjs +0 -90
- package/dist/chunk-UKKJ6H2K.mjs.map +0 -1
- package/dist/chunk-V6QYUEJR.mjs +0 -47
- package/dist/chunk-V6QYUEJR.mjs.map +0 -1
- package/dist/chunk-VSNDSL6W.mjs +0 -74
- package/dist/chunk-VSNDSL6W.mjs.map +0 -1
- package/dist/chunk-ZB6JHNDT.mjs +0 -75
- package/dist/chunk-ZB6JHNDT.mjs.map +0 -1
package/dist/chunk-VSNDSL6W.mjs
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { ExternalLink } from './chunk-KXJV37FS.mjs';
|
|
2
|
-
import { Button } from './chunk-V6QYUEJR.mjs';
|
|
3
|
-
import { IconArrowRight } from './chunk-KR7MH7XO.mjs';
|
|
4
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
var exampleMessages = [
|
|
7
|
-
{
|
|
8
|
-
heading: "Explain technical concepts",
|
|
9
|
-
message: `What is a "serverless function"?`
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
heading: "Summarize an article",
|
|
13
|
-
message: "Summarize the following article for a 2nd grader: \n"
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
heading: "Draft an email",
|
|
17
|
-
message: `Draft an email to my boss about the following:
|
|
18
|
-
`
|
|
19
|
-
}
|
|
20
|
-
];
|
|
21
|
-
var DefaultEmptyScreen = (props) => {
|
|
22
|
-
return /* @__PURE__ */ jsx("div", {
|
|
23
|
-
className: "mx-auto max-w-2xl px-4",
|
|
24
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
25
|
-
className: "rounded-lg border bg-background p-8",
|
|
26
|
-
children: [
|
|
27
|
-
/* @__PURE__ */ jsx("h1", {
|
|
28
|
-
className: "mb-2 text-lg font-semibold",
|
|
29
|
-
children: "Welcome to CopilotKit! \u{1F44B}"
|
|
30
|
-
}),
|
|
31
|
-
/* @__PURE__ */ jsxs("p", {
|
|
32
|
-
className: "mb-2 leading-normal text-muted-foreground",
|
|
33
|
-
children: [
|
|
34
|
-
"This is a Copilot built with",
|
|
35
|
-
" ",
|
|
36
|
-
/* @__PURE__ */ jsx(ExternalLink, {
|
|
37
|
-
href: "https://recursively.ai",
|
|
38
|
-
children: "recursively.ai's"
|
|
39
|
-
}),
|
|
40
|
-
" ",
|
|
41
|
-
/* @__PURE__ */ jsx(ExternalLink, {
|
|
42
|
-
href: "https://github.com/RecursivelyAI/CopilotKit",
|
|
43
|
-
children: "CopilotKit"
|
|
44
|
-
}),
|
|
45
|
-
" ",
|
|
46
|
-
"."
|
|
47
|
-
]
|
|
48
|
-
}),
|
|
49
|
-
/* @__PURE__ */ jsx("p", {
|
|
50
|
-
className: "leading-normal text-muted-foreground",
|
|
51
|
-
children: "You can start a conversation here or try the following examples:"
|
|
52
|
-
}),
|
|
53
|
-
/* @__PURE__ */ jsx("div", {
|
|
54
|
-
className: "mt-4 flex flex-col items-start space-y-2",
|
|
55
|
-
children: exampleMessages.map((message, index) => /* @__PURE__ */ jsxs(Button, {
|
|
56
|
-
variant: "link",
|
|
57
|
-
className: "h-auto p-0 text-base",
|
|
58
|
-
onClick: () => props.setInput(message.message),
|
|
59
|
-
children: [
|
|
60
|
-
/* @__PURE__ */ jsx(IconArrowRight, {
|
|
61
|
-
className: "mr-2 text-muted-foreground"
|
|
62
|
-
}),
|
|
63
|
-
message.heading
|
|
64
|
-
]
|
|
65
|
-
}, index))
|
|
66
|
-
})
|
|
67
|
-
]
|
|
68
|
-
})
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
export { DefaultEmptyScreen };
|
|
73
|
-
//# sourceMappingURL=out.js.map
|
|
74
|
-
//# sourceMappingURL=chunk-VSNDSL6W.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/chat-components/default-empty-screen.tsx"],"names":[],"mappings":";;;;;;;;;;;AA+BQ,cAGA,YAHA;AA/BR;AAQA,IAAM,kBAAkB;AAAA,EACtB;AAAA,IACE,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,SAAS;AAAA,IACT,SAAS;AAAA,EACX;AAAA,EACA;AAAA,IACE,SAAS;AAAA,IACT,SAAS;AAAA;AAAA,EACX;AACF;AAMO,IAAM,qBAAiD,CAAC,UAAU;AACvE,SACE,oBAAC;AAAA,IAAI,WAAU;AAAA,IACb,+BAAC;AAAA,MAAI,WAAU;AAAA,MACb;AAAA,4BAAC;AAAA,UAAG,WAAU;AAAA,UAA6B;AAAA,SAE3C;AAAA,QACA,qBAAC;AAAA,UAAE,WAAU;AAAA,UAA4C;AAAA;AAAA,YAC1B;AAAA,YAC7B,oBAAC;AAAA,cAAa,MAAK;AAAA,cAAyB;AAAA,aAE5C;AAAA,YAAgB;AAAA,YAChB,oBAAC;AAAA,cAAa,MAAK;AAAA,cAA8C;AAAA,aAEjE;AAAA,YAAgB;AAAA,YAAI;AAAA;AAAA,SAEtB;AAAA,QACA,oBAAC;AAAA,UAAE,WAAU;AAAA,UAAuC;AAAA,SAEpD;AAAA,QACA,oBAAC;AAAA,UAAI,WAAU;AAAA,UACZ,0BAAgB,IAAI,CAAC,SAAS,UAC7B,qBAAC;AAAA,YAEC,SAAQ;AAAA,YACR,WAAU;AAAA,YACV,SAAS,MAAM,MAAM,SAAS,QAAQ,OAAO;AAAA,YAE7C;AAAA,kCAAC;AAAA,gBAAe,WAAU;AAAA,eAA6B;AAAA,cACtD,QAAQ;AAAA;AAAA,aANJ,KAOP,CACD;AAAA,SACH;AAAA;AAAA,KACF;AAAA,GACF;AAEJ","sourcesContent":["\"use client\";\nimport React from \"react\";\nimport { UseChatHelpers } from \"ai/react\";\n\nimport { Button } from \"./ui/button\";\nimport { ExternalLink } from \"./external-link\";\nimport { IconArrowRight } from \"./ui/icons\";\n\nconst exampleMessages = [\n {\n heading: \"Explain technical concepts\",\n message: `What is a \"serverless function\"?`,\n },\n {\n heading: \"Summarize an article\",\n message: \"Summarize the following article for a 2nd grader: \\n\",\n },\n {\n heading: \"Draft an email\",\n message: `Draft an email to my boss about the following: \\n`,\n },\n];\n\nexport interface EmptyScreenProps {\n setInput: React.Dispatch<React.SetStateAction<string>>;\n}\n\nexport const DefaultEmptyScreen: React.FC<EmptyScreenProps> = (props) => {\n return (\n <div className=\"mx-auto max-w-2xl px-4\">\n <div className=\"rounded-lg border bg-background p-8\">\n <h1 className=\"mb-2 text-lg font-semibold\">\n Welcome to CopilotKit! 👋\n </h1>\n <p className=\"mb-2 leading-normal text-muted-foreground\">\n This is a Copilot built with{\" \"}\n <ExternalLink href=\"https://recursively.ai\">\n recursively.ai's\n </ExternalLink>{\" \"}\n <ExternalLink href=\"https://github.com/RecursivelyAI/CopilotKit\">\n CopilotKit\n </ExternalLink>{\" \"}\n .\n </p>\n <p className=\"leading-normal text-muted-foreground\">\n You can start a conversation here or try the following examples:\n </p>\n <div className=\"mt-4 flex flex-col items-start space-y-2\">\n {exampleMessages.map((message, index) => (\n <Button\n key={index}\n variant=\"link\"\n className=\"h-auto p-0 text-base\"\n onClick={() => props.setInput(message.message)}\n >\n <IconArrowRight className=\"mr-2 text-muted-foreground\" />\n {message.heading}\n </Button>\n ))}\n </div>\n </div>\n </div>\n );\n};\n"]}
|
package/dist/chunk-ZB6JHNDT.mjs
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { CodeBlock } from './chunk-HKSY5T7Y.mjs';
|
|
2
|
-
import { MemoizedReactMarkdown } from './chunk-6LRNF2VU.mjs';
|
|
3
|
-
import { ChatMessageActions } from './chunk-6UJWRTL6.mjs';
|
|
4
|
-
import { IconUser, IconOpenAI } from './chunk-KR7MH7XO.mjs';
|
|
5
|
-
import { cn } from './chunk-TVTG3V4F.mjs';
|
|
6
|
-
import { __objRest, __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
7
|
-
import remarkGfm from 'remark-gfm';
|
|
8
|
-
import remarkMath from 'remark-math';
|
|
9
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
-
|
|
11
|
-
function ChatMessage(_a) {
|
|
12
|
-
var _b = _a, { message } = _b, props = __objRest(_b, ["message"]);
|
|
13
|
-
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({
|
|
14
|
-
className: cn("group relative mb-4 flex items-start")
|
|
15
|
-
}, props), {
|
|
16
|
-
children: [
|
|
17
|
-
/* @__PURE__ */ jsx("div", {
|
|
18
|
-
className: cn(
|
|
19
|
-
"flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-md border shadow",
|
|
20
|
-
message.role === "user" ? "bg-background" : "bg-primary text-primary-foreground"
|
|
21
|
-
),
|
|
22
|
-
children: message.role === "user" ? /* @__PURE__ */ jsx(IconUser, {}) : /* @__PURE__ */ jsx(IconOpenAI, {})
|
|
23
|
-
}),
|
|
24
|
-
/* @__PURE__ */ jsxs("div", {
|
|
25
|
-
className: "ml-4 flex-1 space-y-2 overflow-hidden px-1",
|
|
26
|
-
children: [
|
|
27
|
-
/* @__PURE__ */ jsx(MemoizedReactMarkdown, {
|
|
28
|
-
className: "prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 text-sm",
|
|
29
|
-
remarkPlugins: [remarkGfm, remarkMath],
|
|
30
|
-
components: {
|
|
31
|
-
p({ children }) {
|
|
32
|
-
return /* @__PURE__ */ jsx("p", {
|
|
33
|
-
className: "mb-2 last:mb-0",
|
|
34
|
-
children
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
code(_a2) {
|
|
38
|
-
var _b2 = _a2, { children, className, inline } = _b2, props2 = __objRest(_b2, ["children", "className", "inline"]);
|
|
39
|
-
if (children.length) {
|
|
40
|
-
if (children[0] == "\u258D") {
|
|
41
|
-
return /* @__PURE__ */ jsx("span", {
|
|
42
|
-
className: "mt-1 animate-pulse cursor-default",
|
|
43
|
-
children: "\u258D"
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
children[0] = children[0].replace("`\u258D`", "\u258D");
|
|
47
|
-
}
|
|
48
|
-
const match = /language-(\w+)/.exec(className || "");
|
|
49
|
-
if (inline) {
|
|
50
|
-
return /* @__PURE__ */ jsx("code", __spreadProps(__spreadValues({
|
|
51
|
-
className
|
|
52
|
-
}, props2), {
|
|
53
|
-
children
|
|
54
|
-
}));
|
|
55
|
-
}
|
|
56
|
-
return /* @__PURE__ */ jsx(CodeBlock, __spreadValues({
|
|
57
|
-
language: match && match[1] || "",
|
|
58
|
-
value: String(children).replace(/\n$/, "")
|
|
59
|
-
}, props2), Math.random());
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
children: message.content
|
|
63
|
-
}),
|
|
64
|
-
/* @__PURE__ */ jsx(ChatMessageActions, {
|
|
65
|
-
message
|
|
66
|
-
})
|
|
67
|
-
]
|
|
68
|
-
})
|
|
69
|
-
]
|
|
70
|
-
}));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export { ChatMessage };
|
|
74
|
-
//# sourceMappingURL=out.js.map
|
|
75
|
-
//# sourceMappingURL=chunk-ZB6JHNDT.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/chat-components/chat-message.tsx"],"names":["_a","_b","props"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,eAAe;AACtB,OAAO,gBAAgB;AAuBY,cAE7B,YAF6B;AAX5B,SAAS,YAAY,IAAyC;AAAzC,eAAE,UAd9B,IAc4B,IAAc,kBAAd,IAAc,CAAZ;AAC5B,SACE,qBAAC;AAAA,IAAI,WAAW,GAAG,sCAAsC;AAAA,KAAO,QAA/D;AAAA,IACC;AAAA,0BAAC;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA,QAAQ,SAAS,SACb,kBACA;AAAA,QACN;AAAA,QAEC,kBAAQ,SAAS,SAAS,oBAAC,YAAS,IAAK,oBAAC,cAAW;AAAA,OACxD;AAAA,MACA,qBAAC;AAAA,QAAI,WAAU;AAAA,QACb;AAAA,8BAAC;AAAA,YACC,WAAU;AAAA,YACV,eAAe,CAAC,WAAW,UAAU;AAAA,YACrC,YAAY;AAAA,cACV,EAAE,EAAE,SAAS,GAAG;AACd,uBAAO,oBAAC;AAAA,kBAAE,WAAU;AAAA,kBAAkB;AAAA,iBAAS;AAAA,cACjD;AAAA,cACA,KAAKA,KAA2C;AAA3C,oBAAAC,MAAAD,KAAE,YAAU,WAAW,OAnCxC,IAmCiBC,KAAkCC,SAAA,UAAlCD,KAAkC,CAAhC,YAAU,aAAW;AAC1B,oBAAI,SAAS,QAAQ;AACnB,sBAAI,SAAS,MAAM,UAAK;AACtB,2BACE,oBAAC;AAAA,sBAAK,WAAU;AAAA,sBAAoC;AAAA,qBAAC;AAAA,kBAEzD;AAEA,2BAAS,KAAM,SAAS,GAAc,QAAQ,YAAO,QAAG;AAAA,gBAC1D;AAEA,sBAAM,QAAQ,iBAAiB,KAAK,aAAa,EAAE;AAEnD,oBAAI,QAAQ;AACV,yBACE,oBAAC;AAAA,oBAAK;AAAA,qBAA0BC,SAA/B;AAAA,oBACE;AAAA,oBACH;AAAA,gBAEJ;AAEA,uBACE,oBAAC;AAAA,kBAEC,UAAW,SAAS,MAAM,MAAO;AAAA,kBACjC,OAAO,OAAO,QAAQ,EAAE,QAAQ,OAAO,EAAE;AAAA,mBACrCA,SAHC,KAAK,OAAO,CAInB;AAAA,cAEJ;AAAA,YACF;AAAA,YAEC,kBAAQ;AAAA,WACX;AAAA,UACA,oBAAC;AAAA,YAAmB;AAAA,WAAkB;AAAA;AAAA,OACxC;AAAA;AAAA,IACF;AAEJ","sourcesContent":["import { Message } from \"ai\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\n\nimport { cn } from \"../../lib/utils\";\nimport { CodeBlock } from \"./ui/codeblock\";\nimport { MemoizedReactMarkdown } from \"./markdown\";\nimport { IconOpenAI, IconUser } from \"./ui/icons\";\nimport { ChatMessageActions } from \"./chat-message-actions\";\n\nexport interface ChatMessageProps {\n message: Message;\n}\n\nexport function ChatMessage({ message, ...props }: ChatMessageProps) {\n return (\n <div className={cn(\"group relative mb-4 flex items-start\")} {...props}>\n <div\n className={cn(\n \"flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-md border shadow\",\n message.role === \"user\"\n ? \"bg-background\"\n : \"bg-primary text-primary-foreground\"\n )}\n >\n {message.role === \"user\" ? <IconUser /> : <IconOpenAI />}\n </div>\n <div className=\"ml-4 flex-1 space-y-2 overflow-hidden px-1\">\n <MemoizedReactMarkdown\n className=\"prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 text-sm\"\n remarkPlugins={[remarkGfm, remarkMath]}\n components={{\n p({ children }) {\n return <p className=\"mb-2 last:mb-0\">{children}</p>;\n },\n code({ children, className, inline, ...props }) {\n if (children.length) {\n if (children[0] == \"▍\") {\n return (\n <span className=\"mt-1 animate-pulse cursor-default\">▍</span>\n );\n }\n\n children[0] = (children[0] as string).replace(\"`▍`\", \"▍\");\n }\n\n const match = /language-(\\w+)/.exec(className || \"\");\n\n if (inline) {\n return (\n <code className={className} {...props}>\n {children}\n </code>\n );\n }\n\n return (\n <CodeBlock\n key={Math.random()}\n language={(match && match[1]) || \"\"}\n value={String(children).replace(/\\n$/, \"\")}\n {...props}\n />\n );\n },\n }}\n >\n {message.content}\n </MemoizedReactMarkdown>\n <ChatMessageActions message={message} />\n </div>\n </div>\n );\n}\n"]}
|