@copilotkit/react-ui 0.10.0 → 0.12.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 +62 -62
- package/CHANGELOG.md +29 -0
- package/dist/{chunk-KR7MH7XO.mjs → chunk-34MTYKUD.mjs} +4 -12
- package/dist/chunk-34MTYKUD.mjs.map +1 -0
- package/dist/{chunk-UKKJ6H2K.mjs → chunk-4ENGXGIC.mjs} +6 -11
- package/dist/chunk-4ENGXGIC.mjs.map +1 -0
- package/dist/{chunk-V6QYUEJR.mjs → chunk-5HCN6SPC.mjs} +2 -2
- package/dist/chunk-5HCN6SPC.mjs.map +1 -0
- package/dist/{chunk-RSONJDLO.mjs → chunk-6RG3YDAC.mjs} +2 -2
- package/dist/{chunk-TUPGAO7T.mjs → chunk-AYVNEHBC.mjs} +4 -6
- package/dist/chunk-AYVNEHBC.mjs.map +1 -0
- package/dist/{chunk-2NO6SF5H.mjs → chunk-CRRPHVT3.mjs} +10 -6
- package/dist/chunk-CRRPHVT3.mjs.map +1 -0
- package/dist/{chunk-KXJV37FS.mjs → chunk-D72RVITD.mjs} +2 -5
- package/dist/chunk-D72RVITD.mjs.map +1 -0
- package/dist/{chunk-6UJWRTL6.mjs → chunk-ESP3H6NQ.mjs} +6 -12
- package/dist/chunk-ESP3H6NQ.mjs.map +1 -0
- package/dist/{chunk-VSNDSL6W.mjs → chunk-EXOYIXGQ.mjs} +4 -4
- package/dist/{chunk-VSNDSL6W.mjs.map → chunk-EXOYIXGQ.mjs.map} +1 -1
- package/dist/{chunk-LMCFSE4V.mjs → chunk-GBPOPYU3.mjs} +4 -6
- package/dist/chunk-GBPOPYU3.mjs.map +1 -0
- package/dist/{chunk-7KPMJBGH.mjs → chunk-GWX3NPF5.mjs} +2 -2
- package/dist/{chunk-7KPMJBGH.mjs.map → chunk-GWX3NPF5.mjs.map} +1 -1
- package/dist/{chunk-I2AB5FK4.mjs → chunk-HKSE5ISX.mjs} +8 -26
- package/dist/chunk-HKSE5ISX.mjs.map +1 -0
- package/dist/{chunk-BIPCPNHG.mjs → chunk-OHWEJUCS.mjs} +1 -1
- package/dist/chunk-OHWEJUCS.mjs.map +1 -0
- package/dist/{chunk-BS6RR2DJ.mjs → chunk-PY4F436T.mjs} +2 -2
- package/dist/{chunk-BS6RR2DJ.mjs.map → chunk-PY4F436T.mjs.map} +1 -1
- package/dist/{chunk-TVTG3V4F.mjs → chunk-Q6YO7LDK.mjs} +1 -1
- package/dist/chunk-Q6YO7LDK.mjs.map +1 -0
- package/dist/{chunk-6LRNF2VU.mjs → chunk-TEYIQHMK.mjs} +1 -1
- package/dist/chunk-TEYIQHMK.mjs.map +1 -0
- package/dist/chunk-VUNHHCOA.mjs +24 -0
- package/dist/chunk-VUNHHCOA.mjs.map +1 -0
- package/dist/{chunk-HKSY5T7Y.mjs → chunk-XEVSX2QD.mjs} +5 -8
- package/dist/chunk-XEVSX2QD.mjs.map +1 -0
- package/dist/{chunk-ZB6JHNDT.mjs → chunk-XLGSWCCV.mjs} +6 -6
- package/dist/chunk-XLGSWCCV.mjs.map +1 -0
- package/dist/{chunk-APH6ZQHG.mjs → chunk-ZA25IBKF.mjs} +4 -4
- package/dist/chunk-ZA25IBKF.mjs.map +1 -0
- package/dist/{chunk-6LAC5RA2.mjs → chunk-ZLFSBGYI.mjs} +2 -4
- package/dist/chunk-ZLFSBGYI.mjs.map +1 -0
- package/dist/{chunk-N7KB3Z57.mjs → chunk-ZYC5YVDO.mjs} +2 -4
- package/dist/chunk-ZYC5YVDO.mjs.map +1 -0
- package/dist/components/chat-components/chat-list.mjs +10 -10
- package/dist/components/chat-components/chat-message-actions.mjs +5 -5
- package/dist/components/chat-components/chat-message.mjs +8 -8
- package/dist/components/chat-components/chat-panel.mjs +7 -7
- package/dist/components/chat-components/chat-scroll-anchor.mjs +2 -2
- package/dist/components/chat-components/clear-history.mjs +4 -4
- package/dist/components/chat-components/clear-history.mjs.map +1 -1
- package/dist/components/chat-components/copilot-chat.mjs +19 -19
- package/dist/components/chat-components/default-empty-screen.mjs +5 -5
- package/dist/components/chat-components/external-link.d.ts +1 -1
- package/dist/components/chat-components/external-link.mjs +1 -1
- package/dist/components/chat-components/markdown.mjs +1 -1
- package/dist/components/chat-components/prompt-form.d.ts +1 -1
- package/dist/components/chat-components/prompt-form.mjs +6 -6
- package/dist/components/chat-components/theme-toggle.mjs +3 -3
- package/dist/components/chat-components/ui/alert-dialog.mjs +3 -3
- package/dist/components/chat-components/ui/badge.mjs +1 -1
- package/dist/components/chat-components/ui/badge.mjs.map +1 -1
- package/dist/components/chat-components/ui/button.mjs +2 -2
- package/dist/components/chat-components/ui/codeblock.mjs +5 -5
- package/dist/components/chat-components/ui/dialog.mjs +8 -31
- package/dist/components/chat-components/ui/dialog.mjs.map +1 -1
- package/dist/components/chat-components/ui/dropdown-menu.mjs +3 -11
- package/dist/components/chat-components/ui/dropdown-menu.mjs.map +1 -1
- package/dist/components/chat-components/ui/icons.mjs +2 -2
- package/dist/components/chat-components/ui/input.mjs +1 -1
- package/dist/components/chat-components/ui/input.mjs.map +1 -1
- package/dist/components/chat-components/ui/label.mjs +1 -1
- package/dist/components/chat-components/ui/label.mjs.map +1 -1
- package/dist/components/chat-components/ui/select.mjs +2 -2
- package/dist/components/chat-components/ui/select.mjs.map +1 -1
- package/dist/components/chat-components/ui/separator.mjs +2 -2
- package/dist/components/chat-components/ui/sheet.mjs +6 -23
- package/dist/components/chat-components/ui/sheet.mjs.map +1 -1
- package/dist/components/chat-components/ui/switch.mjs +1 -1
- package/dist/components/chat-components/ui/switch.mjs.map +1 -1
- package/dist/components/chat-components/ui/textarea.mjs +1 -1
- package/dist/components/chat-components/ui/textarea.mjs.map +1 -1
- package/dist/components/chat-components/ui/tooltip.mjs +2 -2
- package/dist/components/index.mjs +21 -21
- package/dist/components/sidebar/copilot-sidebar-ui-provider.d.ts +1 -1
- package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs +21 -21
- package/dist/components/sidebar/copilot-sidebar.mjs +20 -20
- package/dist/hooks/use-at-bottom.mjs +1 -1
- package/dist/hooks/use-copy-to-clipboard.d.ts +1 -1
- package/dist/hooks/use-copy-to-clipboard.mjs +1 -1
- package/dist/hooks/use-enter-submit.mjs +1 -1
- package/dist/index.mjs +21 -21
- package/dist/lib/utils.mjs +1 -1
- package/package.json +2 -2
- 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.map +0 -1
- package/dist/chunk-6LAC5RA2.mjs.map +0 -1
- package/dist/chunk-6LRNF2VU.mjs.map +0 -1
- package/dist/chunk-6UJWRTL6.mjs.map +0 -1
- package/dist/chunk-APH6ZQHG.mjs.map +0 -1
- package/dist/chunk-BIPCPNHG.mjs.map +0 -1
- package/dist/chunk-DOMJCSI6.mjs +0 -26
- package/dist/chunk-DOMJCSI6.mjs.map +0 -1
- package/dist/chunk-HKSY5T7Y.mjs.map +0 -1
- package/dist/chunk-I2AB5FK4.mjs.map +0 -1
- package/dist/chunk-KR7MH7XO.mjs.map +0 -1
- package/dist/chunk-KXJV37FS.mjs.map +0 -1
- package/dist/chunk-LMCFSE4V.mjs.map +0 -1
- package/dist/chunk-N7KB3Z57.mjs.map +0 -1
- package/dist/chunk-TUPGAO7T.mjs.map +0 -1
- package/dist/chunk-TVTG3V4F.mjs.map +0 -1
- package/dist/chunk-UKKJ6H2K.mjs.map +0 -1
- package/dist/chunk-V6QYUEJR.mjs.map +0 -1
- package/dist/chunk-ZB6JHNDT.mjs.map +0 -1
- /package/dist/{chunk-RSONJDLO.mjs.map → chunk-6RG3YDAC.mjs.map} +0 -0
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
export { CopilotSidebar } from '../../chunk-
|
|
2
|
-
import '../../chunk-
|
|
3
|
-
import '../../chunk-
|
|
4
|
-
import '../../chunk-
|
|
5
|
-
import '../../chunk-
|
|
6
|
-
import '../../chunk-
|
|
7
|
-
import '../../chunk-
|
|
8
|
-
import '../../chunk-
|
|
9
|
-
import '../../chunk-
|
|
10
|
-
import '../../chunk-
|
|
11
|
-
import '../../chunk-
|
|
12
|
-
import '../../chunk-
|
|
13
|
-
import '../../chunk-
|
|
14
|
-
import '../../chunk-
|
|
15
|
-
import '../../chunk-
|
|
16
|
-
import '../../chunk-
|
|
17
|
-
import '../../chunk-
|
|
18
|
-
import '../../chunk-
|
|
19
|
-
import '../../chunk-
|
|
20
|
-
import '../../chunk-
|
|
1
|
+
export { CopilotSidebar } from '../../chunk-GWX3NPF5.mjs';
|
|
2
|
+
import '../../chunk-CRRPHVT3.mjs';
|
|
3
|
+
import '../../chunk-EXOYIXGQ.mjs';
|
|
4
|
+
import '../../chunk-D72RVITD.mjs';
|
|
5
|
+
import '../../chunk-GBPOPYU3.mjs';
|
|
6
|
+
import '../../chunk-VUNHHCOA.mjs';
|
|
7
|
+
import '../../chunk-XLGSWCCV.mjs';
|
|
8
|
+
import '../../chunk-XEVSX2QD.mjs';
|
|
9
|
+
import '../../chunk-TEYIQHMK.mjs';
|
|
10
|
+
import '../../chunk-ESP3H6NQ.mjs';
|
|
11
|
+
import '../../chunk-ZA25IBKF.mjs';
|
|
12
|
+
import '../../chunk-4ENGXGIC.mjs';
|
|
13
|
+
import '../../chunk-PY4F436T.mjs';
|
|
14
|
+
import '../../chunk-5HCN6SPC.mjs';
|
|
15
|
+
import '../../chunk-34MTYKUD.mjs';
|
|
16
|
+
import '../../chunk-Q6YO7LDK.mjs';
|
|
17
|
+
import '../../chunk-6RG3YDAC.mjs';
|
|
18
|
+
import '../../chunk-ZYC5YVDO.mjs';
|
|
19
|
+
import '../../chunk-ZLFSBGYI.mjs';
|
|
20
|
+
import '../../chunk-OHWEJUCS.mjs';
|
|
21
21
|
import '../../chunk-MRXNTQOX.mjs';
|
|
22
22
|
//# sourceMappingURL=out.js.map
|
|
23
23
|
//# sourceMappingURL=copilot-sidebar.mjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
interface useCopyToClipboardProps {
|
|
2
2
|
timeout?: number;
|
|
3
3
|
}
|
|
4
|
-
declare function useCopyToClipboard({ timeout
|
|
4
|
+
declare function useCopyToClipboard({ timeout }: useCopyToClipboardProps): {
|
|
5
5
|
isCopied: Boolean;
|
|
6
6
|
copyToClipboard: (value: string) => void;
|
|
7
7
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import './chunk-7NSRDJ5C.mjs';
|
|
2
2
|
import './chunk-U6NJWGTV.mjs';
|
|
3
|
-
export { CopilotSidebarUIProvider } from './chunk-
|
|
4
|
-
export { CopilotSidebar } from './chunk-
|
|
3
|
+
export { CopilotSidebarUIProvider } from './chunk-AYVNEHBC.mjs';
|
|
4
|
+
export { CopilotSidebar } from './chunk-GWX3NPF5.mjs';
|
|
5
5
|
export { CopilotSidebarContext } from './chunk-MC6KTH4X.mjs';
|
|
6
|
-
export { CopilotChat } from './chunk-
|
|
7
|
-
import './chunk-
|
|
8
|
-
import './chunk-
|
|
9
|
-
import './chunk-
|
|
10
|
-
import './chunk-
|
|
11
|
-
import './chunk-
|
|
12
|
-
import './chunk-
|
|
13
|
-
import './chunk-
|
|
14
|
-
import './chunk-
|
|
15
|
-
import './chunk-
|
|
16
|
-
import './chunk-
|
|
17
|
-
export { Tooltip, TooltipProvider } from './chunk-
|
|
18
|
-
import './chunk-
|
|
19
|
-
import './chunk-
|
|
20
|
-
import './chunk-
|
|
21
|
-
import './chunk-
|
|
6
|
+
export { CopilotChat } from './chunk-CRRPHVT3.mjs';
|
|
7
|
+
import './chunk-EXOYIXGQ.mjs';
|
|
8
|
+
import './chunk-D72RVITD.mjs';
|
|
9
|
+
import './chunk-GBPOPYU3.mjs';
|
|
10
|
+
import './chunk-VUNHHCOA.mjs';
|
|
11
|
+
import './chunk-XLGSWCCV.mjs';
|
|
12
|
+
import './chunk-XEVSX2QD.mjs';
|
|
13
|
+
import './chunk-TEYIQHMK.mjs';
|
|
14
|
+
import './chunk-ESP3H6NQ.mjs';
|
|
15
|
+
import './chunk-ZA25IBKF.mjs';
|
|
16
|
+
import './chunk-4ENGXGIC.mjs';
|
|
17
|
+
export { Tooltip, TooltipProvider } from './chunk-PY4F436T.mjs';
|
|
18
|
+
import './chunk-5HCN6SPC.mjs';
|
|
19
|
+
import './chunk-34MTYKUD.mjs';
|
|
20
|
+
import './chunk-Q6YO7LDK.mjs';
|
|
21
|
+
import './chunk-6RG3YDAC.mjs';
|
|
22
22
|
import './chunk-IU3WTXLQ.mjs';
|
|
23
23
|
import './chunk-H4VKQGVU.mjs';
|
|
24
|
-
import './chunk-
|
|
25
|
-
import './chunk-
|
|
26
|
-
import './chunk-
|
|
24
|
+
import './chunk-ZYC5YVDO.mjs';
|
|
25
|
+
import './chunk-ZLFSBGYI.mjs';
|
|
26
|
+
import './chunk-OHWEJUCS.mjs';
|
|
27
27
|
import './chunk-MRXNTQOX.mjs';
|
|
28
28
|
//# sourceMappingURL=out.js.map
|
|
29
29
|
//# sourceMappingURL=index.mjs.map
|
package/dist/lib/utils.mjs
CHANGED
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.12.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"**/*.css"
|
|
10
10
|
],
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"remark-gfm": "^3.0.1",
|
|
61
61
|
"remark-math": "^5.1.1",
|
|
62
62
|
"tailwind-merge": "^1.13.2",
|
|
63
|
-
"@copilotkit/react-core": "0.
|
|
63
|
+
"@copilotkit/react-core": "0.14.0"
|
|
64
64
|
},
|
|
65
65
|
"scripts": {
|
|
66
66
|
"build": "tsup --treeshake",
|
|
@@ -9,9 +9,7 @@ export interface ChatList {
|
|
|
9
9
|
|
|
10
10
|
export function ChatList({ messages }: ChatList) {
|
|
11
11
|
// we don't want to display system messages
|
|
12
|
-
const displayedMessages = messages.filter(
|
|
13
|
-
(message) => message.role !== "system"
|
|
14
|
-
);
|
|
12
|
+
const displayedMessages = messages.filter((message) => message.role !== "system");
|
|
15
13
|
|
|
16
14
|
if (!displayedMessages.length) {
|
|
17
15
|
return null;
|
|
@@ -22,9 +20,7 @@ export function ChatList({ messages }: ChatList) {
|
|
|
22
20
|
{displayedMessages.map((message, index) => (
|
|
23
21
|
<div key={index}>
|
|
24
22
|
<ChatMessage message={message} />
|
|
25
|
-
{index < displayedMessages.length - 1 &&
|
|
26
|
-
<Separator className="my-4 md:my-4" />
|
|
27
|
-
)}
|
|
23
|
+
{index < displayedMessages.length - 1 && <Separator className="my-4 md:my-4" />}
|
|
28
24
|
</div>
|
|
29
25
|
))}
|
|
30
26
|
</div>
|
|
@@ -11,11 +11,7 @@ interface ChatMessageActionsProps extends React.ComponentProps<"div"> {
|
|
|
11
11
|
message: Message;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export function ChatMessageActions({
|
|
15
|
-
message,
|
|
16
|
-
className,
|
|
17
|
-
...props
|
|
18
|
-
}: ChatMessageActionsProps) {
|
|
14
|
+
export function ChatMessageActions({ message, className, ...props }: ChatMessageActionsProps) {
|
|
19
15
|
const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 });
|
|
20
16
|
|
|
21
17
|
const onCopy = () => {
|
|
@@ -27,7 +23,7 @@ export function ChatMessageActions({
|
|
|
27
23
|
<div
|
|
28
24
|
className={cn(
|
|
29
25
|
"flex items-center justify-end transition-opacity group-hover:opacity-100 md:absolute md:-right-10 md:-top-2 md:opacity-0",
|
|
30
|
-
className
|
|
26
|
+
className,
|
|
31
27
|
)}
|
|
32
28
|
{...props}
|
|
33
29
|
>
|
|
@@ -18,9 +18,7 @@ export function ChatMessage({ message, ...props }: ChatMessageProps) {
|
|
|
18
18
|
<div
|
|
19
19
|
className={cn(
|
|
20
20
|
"flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-md border shadow",
|
|
21
|
-
message.role === "user"
|
|
22
|
-
? "bg-background"
|
|
23
|
-
: "bg-primary text-primary-foreground"
|
|
21
|
+
message.role === "user" ? "bg-background" : "bg-primary text-primary-foreground",
|
|
24
22
|
)}
|
|
25
23
|
>
|
|
26
24
|
{message.role === "user" ? <IconUser /> : <IconOpenAI />}
|
|
@@ -36,9 +34,7 @@ export function ChatMessage({ message, ...props }: ChatMessageProps) {
|
|
|
36
34
|
code({ children, className, inline, ...props }) {
|
|
37
35
|
if (children.length) {
|
|
38
36
|
if (children[0] == "▍") {
|
|
39
|
-
return
|
|
40
|
-
<span className="mt-1 animate-pulse cursor-default">▍</span>
|
|
41
|
-
);
|
|
37
|
+
return <span className="mt-1 animate-pulse cursor-default">▍</span>;
|
|
42
38
|
}
|
|
43
39
|
|
|
44
40
|
children[0] = (children[0] as string).replace("`▍`", "▍");
|
|
@@ -7,13 +7,7 @@ import { IconRefresh, IconStop } from "./ui/icons";
|
|
|
7
7
|
export interface ChatPanelProps
|
|
8
8
|
extends Pick<
|
|
9
9
|
UseChatHelpers,
|
|
10
|
-
| "
|
|
11
|
-
| "isLoading"
|
|
12
|
-
| "reload"
|
|
13
|
-
| "messages"
|
|
14
|
-
| "stop"
|
|
15
|
-
| "input"
|
|
16
|
-
| "setInput"
|
|
10
|
+
"append" | "isLoading" | "reload" | "messages" | "stop" | "input" | "setInput"
|
|
17
11
|
> {
|
|
18
12
|
id?: string;
|
|
19
13
|
}
|
|
@@ -36,21 +30,13 @@ export function ChatPanel({
|
|
|
36
30
|
<div className="mx-auto sm:max-w-2xl sm:px-4">
|
|
37
31
|
<div className="flex h-10 items-center justify-center mb-4">
|
|
38
32
|
{isLoading ? (
|
|
39
|
-
<Button
|
|
40
|
-
variant="outline"
|
|
41
|
-
onClick={() => stop()}
|
|
42
|
-
className="bg-background"
|
|
43
|
-
>
|
|
33
|
+
<Button variant="outline" onClick={() => stop()} className="bg-background">
|
|
44
34
|
<IconStop className="mr-2" />
|
|
45
35
|
Stop generating
|
|
46
36
|
</Button>
|
|
47
37
|
) : (
|
|
48
38
|
messages?.length > 0 && (
|
|
49
|
-
<Button
|
|
50
|
-
variant="outline"
|
|
51
|
-
onClick={() => reload()}
|
|
52
|
-
className="bg-background"
|
|
53
|
-
>
|
|
39
|
+
<Button variant="outline" onClick={() => reload()} className="bg-background">
|
|
54
40
|
<IconRefresh className="mr-2" />
|
|
55
41
|
Regenerate response
|
|
56
42
|
</Button>
|
|
@@ -40,8 +40,7 @@ export function ClearHistory({ clearChats }: ClearHistoryProps) {
|
|
|
40
40
|
<AlertDialogHeader>
|
|
41
41
|
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
42
42
|
<AlertDialogDescription>
|
|
43
|
-
This will permanently delete your chat history and remove your data
|
|
44
|
-
from our servers.
|
|
43
|
+
This will permanently delete your chat history and remove your data from our servers.
|
|
45
44
|
</AlertDialogDescription>
|
|
46
45
|
</AlertDialogHeader>
|
|
47
46
|
<AlertDialogFooter>
|
|
@@ -13,9 +13,7 @@ interface ChatComponentInjectionsProps {
|
|
|
13
13
|
EmptyScreen?: React.FC<EmptyScreenProps>;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
interface CopilotChatProps
|
|
17
|
-
extends UseCopilotChatOptions,
|
|
18
|
-
ChatComponentInjectionsProps {}
|
|
16
|
+
interface CopilotChatProps extends UseCopilotChatOptions, ChatComponentInjectionsProps {}
|
|
19
17
|
|
|
20
18
|
export function CopilotChat({
|
|
21
19
|
id,
|
|
@@ -23,8 +21,11 @@ export function CopilotChat({
|
|
|
23
21
|
makeSystemMessage,
|
|
24
22
|
EmptyScreen = DefaultEmptyScreen,
|
|
25
23
|
}: CopilotChatProps) {
|
|
26
|
-
const { visibleMessages, append, reload, stop, isLoading, input, setInput } =
|
|
27
|
-
|
|
24
|
+
const { visibleMessages, append, reload, stop, isLoading, input, setInput } = useCopilotChat({
|
|
25
|
+
id,
|
|
26
|
+
initialMessages,
|
|
27
|
+
makeSystemMessage,
|
|
28
|
+
});
|
|
28
29
|
|
|
29
30
|
return (
|
|
30
31
|
<div className="w-full h-full flex flex-col overflow-hidden box-border items-start">
|
|
@@ -29,17 +29,11 @@ export const DefaultEmptyScreen: React.FC<EmptyScreenProps> = (props) => {
|
|
|
29
29
|
return (
|
|
30
30
|
<div className="mx-auto max-w-2xl px-4">
|
|
31
31
|
<div className="rounded-lg border bg-background p-8">
|
|
32
|
-
<h1 className="mb-2 text-lg font-semibold">
|
|
33
|
-
Welcome to CopilotKit! 👋
|
|
34
|
-
</h1>
|
|
32
|
+
<h1 className="mb-2 text-lg font-semibold">Welcome to CopilotKit! 👋</h1>
|
|
35
33
|
<p className="mb-2 leading-normal text-muted-foreground">
|
|
36
34
|
This is a Copilot built with{" "}
|
|
37
|
-
<ExternalLink href="https://recursively.ai">
|
|
38
|
-
|
|
39
|
-
</ExternalLink>{" "}
|
|
40
|
-
<ExternalLink href="https://github.com/RecursivelyAI/CopilotKit">
|
|
41
|
-
CopilotKit
|
|
42
|
-
</ExternalLink>{" "}
|
|
35
|
+
<ExternalLink href="https://recursively.ai">recursively.ai's</ExternalLink>{" "}
|
|
36
|
+
<ExternalLink href="https://github.com/RecursivelyAI/CopilotKit">CopilotKit</ExternalLink>{" "}
|
|
43
37
|
.
|
|
44
38
|
</p>
|
|
45
39
|
<p className="leading-normal text-muted-foreground">
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
export function ExternalLink({
|
|
2
|
-
href,
|
|
3
|
-
children,
|
|
4
|
-
}: {
|
|
5
|
-
href: string;
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
}) {
|
|
1
|
+
export function ExternalLink({ href, children }: { href: string; children: React.ReactNode }) {
|
|
8
2
|
return (
|
|
9
3
|
<a
|
|
10
4
|
href={href}
|
|
@@ -12,13 +6,7 @@ export function ExternalLink({
|
|
|
12
6
|
className="inline-flex flex-1 justify-center gap-1 leading-4 hover:underline"
|
|
13
7
|
>
|
|
14
8
|
<span>{children}</span>
|
|
15
|
-
<svg
|
|
16
|
-
aria-hidden="true"
|
|
17
|
-
height="7"
|
|
18
|
-
viewBox="0 0 6 6"
|
|
19
|
-
width="7"
|
|
20
|
-
className="opacity-70"
|
|
21
|
-
>
|
|
9
|
+
<svg aria-hidden="true" height="7" viewBox="0 0 6 6" width="7" className="opacity-70">
|
|
22
10
|
<path
|
|
23
11
|
d="M1.25215 5.54731L0.622742 4.9179L3.78169 1.75597H1.3834L1.38936 0.890915H5.27615V4.78069H4.40513L4.41109 2.38538L1.25215 5.54731Z"
|
|
24
12
|
fill="currentColor"
|
|
@@ -4,6 +4,5 @@ import ReactMarkdown, { Options } from "react-markdown";
|
|
|
4
4
|
export const MemoizedReactMarkdown: FC<Options> = memo(
|
|
5
5
|
ReactMarkdown,
|
|
6
6
|
(prevProps, nextProps) =>
|
|
7
|
-
prevProps.children === nextProps.children &&
|
|
8
|
-
prevProps.className === nextProps.className
|
|
7
|
+
prevProps.children === nextProps.children && prevProps.className === nextProps.className,
|
|
9
8
|
);
|
|
@@ -9,18 +9,12 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "./ui/tooltip";
|
|
|
9
9
|
import { IconArrowElbow, IconPlus } from "./ui/icons";
|
|
10
10
|
// import Link from "next/link";
|
|
11
11
|
|
|
12
|
-
export interface PromptProps
|
|
13
|
-
extends Pick<UseChatHelpers, "input" | "setInput"> {
|
|
12
|
+
export interface PromptProps extends Pick<UseChatHelpers, "input" | "setInput"> {
|
|
14
13
|
onSubmit: (value: string) => Promise<void>;
|
|
15
14
|
isLoading: boolean;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
export function PromptForm({
|
|
19
|
-
onSubmit,
|
|
20
|
-
input,
|
|
21
|
-
setInput,
|
|
22
|
-
isLoading,
|
|
23
|
-
}: PromptProps) {
|
|
17
|
+
export function PromptForm({ onSubmit, input, setInput, isLoading }: PromptProps) {
|
|
24
18
|
const { formRef, onKeyDown } = useEnterSubmit();
|
|
25
19
|
const inputRef = React.useRef<HTMLTextAreaElement>(null);
|
|
26
20
|
|
|
@@ -30,7 +30,7 @@ const AlertDialogOverlay = React.forwardRef<
|
|
|
30
30
|
<AlertDialogPrimitive.Overlay
|
|
31
31
|
className={cn(
|
|
32
32
|
"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm transition-opacity animate-in fade-in",
|
|
33
|
-
className
|
|
33
|
+
className,
|
|
34
34
|
)}
|
|
35
35
|
{...props}
|
|
36
36
|
ref={ref}
|
|
@@ -48,7 +48,7 @@ const AlertDialogContent = React.forwardRef<
|
|
|
48
48
|
ref={ref}
|
|
49
49
|
className={cn(
|
|
50
50
|
"fixed z-50 grid w-full max-w-lg scale-100 gap-4 border bg-background p-6 opacity-100 shadow-lg animate-in fade-in-90 slide-in-from-bottom-10 sm:rounded-lg sm:zoom-in-90 sm:slide-in-from-bottom-0 md:w-full",
|
|
51
|
-
className
|
|
51
|
+
className,
|
|
52
52
|
)}
|
|
53
53
|
{...props}
|
|
54
54
|
/>
|
|
@@ -56,29 +56,14 @@ const AlertDialogContent = React.forwardRef<
|
|
|
56
56
|
));
|
|
57
57
|
AlertDialogContent.displayName = AlertDialogPrimitive.Content.displayName;
|
|
58
58
|
|
|
59
|
-
const AlertDialogHeader = ({
|
|
60
|
-
className,
|
|
61
|
-
...props
|
|
62
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
63
|
-
<div
|
|
64
|
-
className={cn(
|
|
65
|
-
"flex flex-col space-y-2 text-center sm:text-left",
|
|
66
|
-
className
|
|
67
|
-
)}
|
|
68
|
-
{...props}
|
|
69
|
-
/>
|
|
59
|
+
const AlertDialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
60
|
+
<div className={cn("flex flex-col space-y-2 text-center sm:text-left", className)} {...props} />
|
|
70
61
|
);
|
|
71
62
|
AlertDialogHeader.displayName = "AlertDialogHeader";
|
|
72
63
|
|
|
73
|
-
const AlertDialogFooter = ({
|
|
74
|
-
className,
|
|
75
|
-
...props
|
|
76
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
64
|
+
const AlertDialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
77
65
|
<div
|
|
78
|
-
className={cn(
|
|
79
|
-
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
80
|
-
className
|
|
81
|
-
)}
|
|
66
|
+
className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
|
|
82
67
|
{...props}
|
|
83
68
|
/>
|
|
84
69
|
);
|
|
@@ -106,18 +91,13 @@ const AlertDialogDescription = React.forwardRef<
|
|
|
106
91
|
{...props}
|
|
107
92
|
/>
|
|
108
93
|
));
|
|
109
|
-
AlertDialogDescription.displayName =
|
|
110
|
-
AlertDialogPrimitive.Description.displayName;
|
|
94
|
+
AlertDialogDescription.displayName = AlertDialogPrimitive.Description.displayName;
|
|
111
95
|
|
|
112
96
|
const AlertDialogAction = React.forwardRef<
|
|
113
97
|
React.ElementRef<typeof AlertDialogPrimitive.Action>,
|
|
114
98
|
React.ComponentPropsWithoutRef<typeof AlertDialogPrimitive.Action>
|
|
115
99
|
>(({ className, ...props }, ref) => (
|
|
116
|
-
<AlertDialogPrimitive.Action
|
|
117
|
-
ref={ref}
|
|
118
|
-
className={cn(buttonVariants(), className)}
|
|
119
|
-
{...props}
|
|
120
|
-
/>
|
|
100
|
+
<AlertDialogPrimitive.Action ref={ref} className={cn(buttonVariants(), className)} {...props} />
|
|
121
101
|
));
|
|
122
102
|
AlertDialogAction.displayName = AlertDialogPrimitive.Action.displayName;
|
|
123
103
|
|
|
@@ -127,11 +107,7 @@ const AlertDialogCancel = React.forwardRef<
|
|
|
127
107
|
>(({ className, ...props }, ref) => (
|
|
128
108
|
<AlertDialogPrimitive.Cancel
|
|
129
109
|
ref={ref}
|
|
130
|
-
className={cn(
|
|
131
|
-
buttonVariants({ variant: "outline" }),
|
|
132
|
-
"mt-2 sm:mt-0",
|
|
133
|
-
className
|
|
134
|
-
)}
|
|
110
|
+
className={cn(buttonVariants({ variant: "outline" }), "mt-2 sm:mt-0", className)}
|
|
135
111
|
{...props}
|
|
136
112
|
/>
|
|
137
113
|
));
|
|
@@ -8,8 +8,7 @@ const badgeVariants = cva(
|
|
|
8
8
|
{
|
|
9
9
|
variants: {
|
|
10
10
|
variant: {
|
|
11
|
-
default:
|
|
12
|
-
"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
|
11
|
+
default: "border-transparent bg-primary text-primary-foreground hover:bg-primary/80",
|
|
13
12
|
secondary:
|
|
14
13
|
"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
15
14
|
destructive:
|
|
@@ -20,7 +19,7 @@ const badgeVariants = cva(
|
|
|
20
19
|
defaultVariants: {
|
|
21
20
|
variant: "default",
|
|
22
21
|
},
|
|
23
|
-
}
|
|
22
|
+
},
|
|
24
23
|
);
|
|
25
24
|
|
|
26
25
|
export interface BadgeProps
|
|
@@ -28,9 +27,7 @@ export interface BadgeProps
|
|
|
28
27
|
VariantProps<typeof badgeVariants> {}
|
|
29
28
|
|
|
30
29
|
function Badge({ className, variant, ...props }: BadgeProps) {
|
|
31
|
-
return (
|
|
32
|
-
<div className={cn(badgeVariants({ variant }), className)} {...props} />
|
|
33
|
-
);
|
|
30
|
+
return <div className={cn(badgeVariants({ variant }), className)} {...props} />;
|
|
34
31
|
}
|
|
35
32
|
|
|
36
33
|
export { Badge, badgeVariants };
|
|
@@ -9,14 +9,10 @@ const buttonVariants = cva(
|
|
|
9
9
|
{
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
12
|
-
default:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
outline:
|
|
17
|
-
"border border-input hover:bg-accent hover:text-accent-foreground",
|
|
18
|
-
secondary:
|
|
19
|
-
"bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
12
|
+
default: "bg-primary text-primary-foreground shadow-md hover:bg-primary/90",
|
|
13
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
14
|
+
outline: "border border-input hover:bg-accent hover:text-accent-foreground",
|
|
15
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
20
16
|
ghost: "shadow-none hover:bg-accent hover:text-accent-foreground",
|
|
21
17
|
link: "text-primary underline-offset-4 shadow-none hover:underline",
|
|
22
18
|
},
|
|
@@ -31,7 +27,7 @@ const buttonVariants = cva(
|
|
|
31
27
|
variant: "default",
|
|
32
28
|
size: "default",
|
|
33
29
|
},
|
|
34
|
-
}
|
|
30
|
+
},
|
|
35
31
|
);
|
|
36
32
|
|
|
37
33
|
export interface ButtonProps
|
|
@@ -44,13 +40,9 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
|
|
|
44
40
|
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
45
41
|
const Comp = asChild ? Slot : "button";
|
|
46
42
|
return (
|
|
47
|
-
<Comp
|
|
48
|
-
className={cn(buttonVariants({ variant, size, className }))}
|
|
49
|
-
ref={ref}
|
|
50
|
-
{...props}
|
|
51
|
-
/>
|
|
43
|
+
<Comp className={cn(buttonVariants({ variant, size, className }))} ref={ref} {...props} />
|
|
52
44
|
);
|
|
53
|
-
}
|
|
45
|
+
},
|
|
54
46
|
);
|
|
55
47
|
Button.displayName = "Button";
|
|
56
48
|
|
|
@@ -60,10 +60,7 @@ const CodeBlock: FC<Props> = memo(({ language, value }) => {
|
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
const fileExtension = programmingLanguages[language] || ".file";
|
|
63
|
-
const suggestedFileName = `file-${generateRandomString(
|
|
64
|
-
3,
|
|
65
|
-
true
|
|
66
|
-
)}${fileExtension}`;
|
|
63
|
+
const suggestedFileName = `file-${generateRandomString(3, true)}${fileExtension}`;
|
|
67
64
|
const fileName = window.prompt("Enter file name" || "", suggestedFileName);
|
|
68
65
|
|
|
69
66
|
if (!fileName) {
|
|
@@ -10,11 +10,7 @@ const Dialog = DialogPrimitive.Root;
|
|
|
10
10
|
|
|
11
11
|
const DialogTrigger = DialogPrimitive.Trigger;
|
|
12
12
|
|
|
13
|
-
const DialogPortal = ({
|
|
14
|
-
className,
|
|
15
|
-
children,
|
|
16
|
-
...props
|
|
17
|
-
}: DialogPrimitive.DialogPortalProps) => (
|
|
13
|
+
const DialogPortal = ({ className, children, ...props }: DialogPrimitive.DialogPortalProps) => (
|
|
18
14
|
<DialogPrimitive.Portal className={cn(className)} {...props}>
|
|
19
15
|
<div className="fixed inset-0 z-50 flex items-start justify-center sm:items-center">
|
|
20
16
|
{children}
|
|
@@ -31,7 +27,7 @@ const DialogOverlay = React.forwardRef<
|
|
|
31
27
|
ref={ref}
|
|
32
28
|
className={cn(
|
|
33
29
|
"fixed inset-0 z-50 bg-background/80 backdrop-blur-sm transition-all duration-100 data-[state=closed]:animate-out data-[state=closed]:fade-out data-[state=open]:fade-in",
|
|
34
|
-
className
|
|
30
|
+
className,
|
|
35
31
|
)}
|
|
36
32
|
{...props}
|
|
37
33
|
/>
|
|
@@ -48,7 +44,7 @@ const DialogContent = React.forwardRef<
|
|
|
48
44
|
ref={ref}
|
|
49
45
|
className={cn(
|
|
50
46
|
"fixed z-50 grid w-full gap-4 rounded-b-lg border bg-background p-6 shadow-sm animate-in data-[state=open]:fade-in-90 data-[state=open]:slide-in-from-bottom-10 sm:max-w-lg sm:rounded-lg sm:zoom-in-90 data-[state=open]:sm:slide-in-from-bottom-0",
|
|
51
|
-
className
|
|
47
|
+
className,
|
|
52
48
|
)}
|
|
53
49
|
{...props}
|
|
54
50
|
>
|
|
@@ -62,29 +58,14 @@ const DialogContent = React.forwardRef<
|
|
|
62
58
|
));
|
|
63
59
|
DialogContent.displayName = DialogPrimitive.Content.displayName;
|
|
64
60
|
|
|
65
|
-
const DialogHeader = ({
|
|
66
|
-
className,
|
|
67
|
-
...props
|
|
68
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
69
|
-
<div
|
|
70
|
-
className={cn(
|
|
71
|
-
"flex flex-col space-y-1.5 text-center sm:text-left",
|
|
72
|
-
className
|
|
73
|
-
)}
|
|
74
|
-
{...props}
|
|
75
|
-
/>
|
|
61
|
+
const DialogHeader = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
62
|
+
<div className={cn("flex flex-col space-y-1.5 text-center sm:text-left", className)} {...props} />
|
|
76
63
|
);
|
|
77
64
|
DialogHeader.displayName = "DialogHeader";
|
|
78
65
|
|
|
79
|
-
const DialogFooter = ({
|
|
80
|
-
className,
|
|
81
|
-
...props
|
|
82
|
-
}: React.HTMLAttributes<HTMLDivElement>) => (
|
|
66
|
+
const DialogFooter = ({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) => (
|
|
83
67
|
<div
|
|
84
|
-
className={cn(
|
|
85
|
-
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
|
|
86
|
-
className
|
|
87
|
-
)}
|
|
68
|
+
className={cn("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2", className)}
|
|
88
69
|
{...props}
|
|
89
70
|
/>
|
|
90
71
|
);
|
|
@@ -96,10 +77,7 @@ const DialogTitle = React.forwardRef<
|
|
|
96
77
|
>(({ className, ...props }, ref) => (
|
|
97
78
|
<DialogPrimitive.Title
|
|
98
79
|
ref={ref}
|
|
99
|
-
className={cn(
|
|
100
|
-
"text-lg font-semibold leading-none tracking-tight",
|
|
101
|
-
className
|
|
102
|
-
)}
|
|
80
|
+
className={cn("text-lg font-semibold leading-none tracking-tight", className)}
|
|
103
81
|
{...props}
|
|
104
82
|
/>
|
|
105
83
|
));
|