@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
|
@@ -5,10 +5,7 @@ export function useAtBottom(offset = 0) {
|
|
|
5
5
|
|
|
6
6
|
React.useEffect(() => {
|
|
7
7
|
const handleScroll = () => {
|
|
8
|
-
setIsAtBottom(
|
|
9
|
-
window.innerHeight + window.scrollY >=
|
|
10
|
-
document.body.offsetHeight - offset
|
|
11
|
-
);
|
|
8
|
+
setIsAtBottom(window.innerHeight + window.scrollY >= document.body.offsetHeight - offset);
|
|
12
9
|
};
|
|
13
10
|
|
|
14
11
|
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
@@ -6,9 +6,7 @@ export interface useCopyToClipboardProps {
|
|
|
6
6
|
timeout?: number;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export function useCopyToClipboard({
|
|
10
|
-
timeout = 2000,
|
|
11
|
-
}: useCopyToClipboardProps) {
|
|
9
|
+
export function useCopyToClipboard({ timeout = 2000 }: useCopyToClipboardProps) {
|
|
12
10
|
const [isCopied, setIsCopied] = React.useState<Boolean>(false);
|
|
13
11
|
|
|
14
12
|
const copyToClipboard = (value: string) => {
|
|
@@ -6,14 +6,8 @@ export function useEnterSubmit(): {
|
|
|
6
6
|
} {
|
|
7
7
|
const formRef = useRef<HTMLFormElement>(null);
|
|
8
8
|
|
|
9
|
-
const handleKeyDown = (
|
|
10
|
-
event
|
|
11
|
-
): void => {
|
|
12
|
-
if (
|
|
13
|
-
event.key === "Enter" &&
|
|
14
|
-
!event.shiftKey &&
|
|
15
|
-
!event.nativeEvent.isComposing
|
|
16
|
-
) {
|
|
9
|
+
const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>): void => {
|
|
10
|
+
if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
|
|
17
11
|
formRef.current?.requestSubmit();
|
|
18
12
|
event.preventDefault();
|
|
19
13
|
}
|
package/src/lib/utils.ts
CHANGED
|
@@ -8,13 +8,10 @@ export function cn(...inputs: ClassValue[]) {
|
|
|
8
8
|
|
|
9
9
|
export const nanoid = customAlphabet(
|
|
10
10
|
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
11
|
-
7
|
|
11
|
+
7,
|
|
12
12
|
); // 7-character random string
|
|
13
13
|
|
|
14
|
-
export async function fetcher<JSON = any>(
|
|
15
|
-
input: RequestInfo,
|
|
16
|
-
init?: RequestInit
|
|
17
|
-
): Promise<JSON> {
|
|
14
|
+
export async function fetcher<JSON = any>(input: RequestInfo, init?: RequestInit): Promise<JSON> {
|
|
18
15
|
const res = await fetch(input, init);
|
|
19
16
|
|
|
20
17
|
if (!res.ok) {
|
package/dist/chunk-2NO6SF5H.mjs
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { DefaultEmptyScreen } from './chunk-VSNDSL6W.mjs';
|
|
2
|
-
import { ChatList } from './chunk-LMCFSE4V.mjs';
|
|
3
|
-
import { ChatPanel } from './chunk-APH6ZQHG.mjs';
|
|
4
|
-
import { ChatScrollAnchor } from './chunk-RSONJDLO.mjs';
|
|
5
|
-
import { useCopilotChat } from '@copilotkit/react-core';
|
|
6
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
function CopilotChat({
|
|
9
|
-
id,
|
|
10
|
-
initialMessages,
|
|
11
|
-
makeSystemMessage,
|
|
12
|
-
EmptyScreen = DefaultEmptyScreen
|
|
13
|
-
}) {
|
|
14
|
-
const { visibleMessages, append, reload, stop, isLoading, input, setInput } = useCopilotChat({ id, initialMessages, makeSystemMessage });
|
|
15
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
16
|
-
className: "w-full h-full flex flex-col overflow-hidden box-border items-start",
|
|
17
|
-
children: [
|
|
18
|
-
/* @__PURE__ */ jsx("div", {
|
|
19
|
-
className: "pt-5 px-5 overflow-y-auto overflow-x-hidden w-full flex-grow",
|
|
20
|
-
children: visibleMessages.length ? /* @__PURE__ */ jsxs("div", {
|
|
21
|
-
className: "pl-0 pr-6",
|
|
22
|
-
children: [
|
|
23
|
-
/* @__PURE__ */ jsx(ChatList, {
|
|
24
|
-
messages: visibleMessages
|
|
25
|
-
}),
|
|
26
|
-
/* @__PURE__ */ jsx(ChatScrollAnchor, {
|
|
27
|
-
trackVisibility: isLoading
|
|
28
|
-
})
|
|
29
|
-
]
|
|
30
|
-
}) : /* @__PURE__ */ jsx(EmptyScreen, {
|
|
31
|
-
setInput
|
|
32
|
-
})
|
|
33
|
-
}),
|
|
34
|
-
/* @__PURE__ */ jsx("div", {
|
|
35
|
-
className: "flex-shrink-0 w-full",
|
|
36
|
-
children: /* @__PURE__ */ jsx(ChatPanel, {
|
|
37
|
-
id,
|
|
38
|
-
isLoading,
|
|
39
|
-
stop,
|
|
40
|
-
append,
|
|
41
|
-
reload,
|
|
42
|
-
messages: visibleMessages,
|
|
43
|
-
input,
|
|
44
|
-
setInput
|
|
45
|
-
})
|
|
46
|
-
})
|
|
47
|
-
]
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { CopilotChat };
|
|
52
|
-
//# sourceMappingURL=out.js.map
|
|
53
|
-
//# sourceMappingURL=chunk-2NO6SF5H.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/chat-components/copilot-chat.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AASA,SAAS,sBAAsB;AAuBrB,SACE,KADF;AAhCV;AAmBO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAAqB;AACnB,QAAM,EAAE,iBAAiB,QAAQ,QAAQ,MAAM,WAAW,OAAO,SAAS,IACxE,eAAe,EAAE,IAAI,iBAAiB,kBAAkB,CAAC;AAE3D,SACE,qBAAC;AAAA,IAAI,WAAU;AAAA,IACb;AAAA,0BAAC;AAAA,QAAI,WAAU;AAAA,QACZ,0BAAgB,SACf,qBAAC;AAAA,UAAI,WAAU;AAAA,UACb;AAAA,gCAAC;AAAA,cAAS,UAAU;AAAA,aAAiB;AAAA,YACrC,oBAAC;AAAA,cAAiB,iBAAiB;AAAA,aAAW;AAAA;AAAA,SAChD,IAEA,oBAAC;AAAA,UAAY;AAAA,SAAoB;AAAA,OAErC;AAAA,MAEA,oBAAC;AAAA,QAAI,WAAU;AAAA,QACb,8BAAC;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,UAAU;AAAA,UACV;AAAA,UACA;AAAA,SACF;AAAA,OACF;AAAA;AAAA,GACF;AAEJ","sourcesContent":["\"use client\";\n\nimport React from \"react\";\n\nimport { ChatList } from \"./chat-list\";\nimport { ChatPanel } from \"./chat-panel\";\nimport { DefaultEmptyScreen, EmptyScreenProps } from \"./default-empty-screen\";\nimport { ChatScrollAnchor } from \"./chat-scroll-anchor\";\nimport { UseCopilotChatOptions } from \"@copilotkit/react-core\";\nimport { useCopilotChat } from \"@copilotkit/react-core\";\n\ninterface ChatComponentInjectionsProps {\n EmptyScreen?: React.FC<EmptyScreenProps>;\n}\n\ninterface CopilotChatProps\n extends UseCopilotChatOptions,\n ChatComponentInjectionsProps {}\n\nexport function CopilotChat({\n id,\n initialMessages,\n makeSystemMessage,\n EmptyScreen = DefaultEmptyScreen,\n}: CopilotChatProps) {\n const { visibleMessages, append, reload, stop, isLoading, input, setInput } =\n useCopilotChat({ id, initialMessages, makeSystemMessage });\n\n return (\n <div className=\"w-full h-full flex flex-col overflow-hidden box-border items-start\">\n <div className=\"pt-5 px-5 overflow-y-auto overflow-x-hidden w-full flex-grow\">\n {visibleMessages.length ? (\n <div className=\"pl-0 pr-6\">\n <ChatList messages={visibleMessages} />\n <ChatScrollAnchor trackVisibility={isLoading} />\n </div>\n ) : (\n <EmptyScreen setInput={setInput} />\n )}\n </div>\n\n <div className=\"flex-shrink-0 w-full\">\n <ChatPanel\n id={id}\n isLoading={isLoading}\n stop={stop}\n append={append}\n reload={reload}\n messages={visibleMessages}\n input={input}\n setInput={setInput}\n />\n </div>\n </div>\n );\n}\n"]}
|
package/dist/chunk-6LAC5RA2.mjs
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
// src/hooks/use-copy-to-clipboard.tsx
|
|
4
|
-
function useCopyToClipboard({
|
|
5
|
-
timeout = 2e3
|
|
6
|
-
}) {
|
|
7
|
-
const [isCopied, setIsCopied] = React.useState(false);
|
|
8
|
-
const copyToClipboard = (value) => {
|
|
9
|
-
var _a;
|
|
10
|
-
if (typeof window === "undefined" || !((_a = navigator.clipboard) == null ? void 0 : _a.writeText)) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
if (!value) {
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
navigator.clipboard.writeText(value).then(() => {
|
|
17
|
-
setIsCopied(true);
|
|
18
|
-
setTimeout(() => {
|
|
19
|
-
setIsCopied(false);
|
|
20
|
-
}, timeout);
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
return { isCopied, copyToClipboard };
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { useCopyToClipboard };
|
|
27
|
-
//# sourceMappingURL=out.js.map
|
|
28
|
-
//# sourceMappingURL=chunk-6LAC5RA2.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/use-copy-to-clipboard.tsx"],"names":[],"mappings":";AAEA,YAAY,WAAW;AAFvB;AAQO,SAAS,mBAAmB;AAAA,EACjC,UAAU;AACZ,GAA4B;AAC1B,QAAM,CAAC,UAAU,WAAW,IAAU,eAAkB,KAAK;AAE7D,QAAM,kBAAkB,CAAC,UAAkB;AAb7C;AAcI,QAAI,OAAO,WAAW,eAAe,GAAC,eAAU,cAAV,mBAAqB,YAAW;AACpE;AAAA,IACF;AAEA,QAAI,CAAC,OAAO;AACV;AAAA,IACF;AAEA,cAAU,UAAU,UAAU,KAAK,EAAE,KAAK,MAAM;AAC9C,kBAAY,IAAI;AAEhB,iBAAW,MAAM;AACf,oBAAY,KAAK;AAAA,MACnB,GAAG,OAAO;AAAA,IACZ,CAAC;AAAA,EACH;AAEA,SAAO,EAAE,UAAU,gBAAgB;AACrC","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\n\nexport interface useCopyToClipboardProps {\n timeout?: number;\n}\n\nexport function useCopyToClipboard({\n timeout = 2000,\n}: useCopyToClipboardProps) {\n const [isCopied, setIsCopied] = React.useState<Boolean>(false);\n\n const copyToClipboard = (value: string) => {\n if (typeof window === \"undefined\" || !navigator.clipboard?.writeText) {\n return;\n }\n\n if (!value) {\n return;\n }\n\n navigator.clipboard.writeText(value).then(() => {\n setIsCopied(true);\n\n setTimeout(() => {\n setIsCopied(false);\n }, timeout);\n });\n };\n\n return { isCopied, copyToClipboard };\n}\n"]}
|
package/dist/chunk-6LRNF2VU.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { memo } from 'react';
|
|
2
|
-
import ReactMarkdown from 'react-markdown';
|
|
3
|
-
|
|
4
|
-
// src/components/chat-components/markdown.tsx
|
|
5
|
-
var MemoizedReactMarkdown = memo(
|
|
6
|
-
ReactMarkdown,
|
|
7
|
-
(prevProps, nextProps) => prevProps.children === nextProps.children && prevProps.className === nextProps.className
|
|
8
|
-
);
|
|
9
|
-
|
|
10
|
-
export { MemoizedReactMarkdown };
|
|
11
|
-
//# sourceMappingURL=out.js.map
|
|
12
|
-
//# sourceMappingURL=chunk-6LRNF2VU.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/chat-components/markdown.tsx"],"names":[],"mappings":";AAAA,SAAa,YAAY;AACzB,OAAO,mBAAgC;AAEhC,IAAM,wBAAqC;AAAA,EAChD;AAAA,EACA,CAAC,WAAW,cACV,UAAU,aAAa,UAAU,YACjC,UAAU,cAAc,UAAU;AACtC","sourcesContent":["import { FC, memo } from \"react\";\nimport ReactMarkdown, { Options } from \"react-markdown\";\n\nexport const MemoizedReactMarkdown: FC<Options> = memo(\n ReactMarkdown,\n (prevProps, nextProps) =>\n prevProps.children === nextProps.children &&\n prevProps.className === nextProps.className\n);\n"]}
|
package/dist/chunk-6UJWRTL6.mjs
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { Button } from './chunk-V6QYUEJR.mjs';
|
|
2
|
-
import { IconCheck, IconCopy } from './chunk-KR7MH7XO.mjs';
|
|
3
|
-
import { cn } from './chunk-TVTG3V4F.mjs';
|
|
4
|
-
import { useCopyToClipboard } from './chunk-6LAC5RA2.mjs';
|
|
5
|
-
import { __objRest, __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
6
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
function ChatMessageActions(_a) {
|
|
9
|
-
var _b = _a, {
|
|
10
|
-
message,
|
|
11
|
-
className
|
|
12
|
-
} = _b, props = __objRest(_b, [
|
|
13
|
-
"message",
|
|
14
|
-
"className"
|
|
15
|
-
]);
|
|
16
|
-
const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
|
|
17
|
-
const onCopy = () => {
|
|
18
|
-
if (isCopied)
|
|
19
|
-
return;
|
|
20
|
-
copyToClipboard(message.content);
|
|
21
|
-
};
|
|
22
|
-
return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({
|
|
23
|
-
className: cn(
|
|
24
|
-
"flex items-center justify-end transition-opacity group-hover:opacity-100 md:absolute md:-right-10 md:-top-2 md:opacity-0",
|
|
25
|
-
className
|
|
26
|
-
)
|
|
27
|
-
}, props), {
|
|
28
|
-
children: /* @__PURE__ */ jsxs(Button, {
|
|
29
|
-
variant: "ghost",
|
|
30
|
-
size: "icon",
|
|
31
|
-
onClick: onCopy,
|
|
32
|
-
children: [
|
|
33
|
-
isCopied ? /* @__PURE__ */ jsx(IconCheck, {}) : /* @__PURE__ */ jsx(IconCopy, {}),
|
|
34
|
-
/* @__PURE__ */ jsx("span", {
|
|
35
|
-
className: "sr-only",
|
|
36
|
-
children: "Copy message"
|
|
37
|
-
})
|
|
38
|
-
]
|
|
39
|
-
})
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export { ChatMessageActions };
|
|
44
|
-
//# sourceMappingURL=out.js.map
|
|
45
|
-
//# sourceMappingURL=chunk-6UJWRTL6.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/chat-components/chat-message-actions.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAiCM,SACc,KADd;AAjCN;AAaO,SAAS,mBAAmB,IAIP;AAJO,eACjC;AAAA;AAAA,IACA;AAAA,EAfF,IAamC,IAG9B,kBAH8B,IAG9B;AAAA,IAFH;AAAA,IACA;AAAA;AAGA,QAAM,EAAE,UAAU,gBAAgB,IAAI,mBAAmB,EAAE,SAAS,IAAK,CAAC;AAE1E,QAAM,SAAS,MAAM;AACnB,QAAI;AAAU;AACd,oBAAgB,QAAQ,OAAO;AAAA,EACjC;AAEA,SACE,oBAAC;AAAA,IACC,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,KACI,QALL;AAAA,IAOC,+BAAC;AAAA,MAAO,SAAQ;AAAA,MAAQ,MAAK;AAAA,MAAO,SAAS;AAAA,MAC1C;AAAA,mBAAW,oBAAC,aAAU,IAAK,oBAAC,YAAS;AAAA,QACtC,oBAAC;AAAA,UAAK,WAAU;AAAA,UAAU;AAAA,SAAY;AAAA;AAAA,KACxC;AAAA,IACF;AAEJ","sourcesContent":["\"use client\";\n\nimport { type Message } from \"ai\";\n\nimport { Button } from \"./ui/button\";\nimport { IconCheck, IconCopy } from \"./ui/icons\";\nimport { useCopyToClipboard } from \"../../hooks/use-copy-to-clipboard\";\nimport { cn } from \"../../lib/utils\";\n\ninterface ChatMessageActionsProps extends React.ComponentProps<\"div\"> {\n message: Message;\n}\n\nexport function ChatMessageActions({\n message,\n className,\n ...props\n}: ChatMessageActionsProps) {\n const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 });\n\n const onCopy = () => {\n if (isCopied) return;\n copyToClipboard(message.content);\n };\n\n return (\n <div\n className={cn(\n \"flex items-center justify-end transition-opacity group-hover:opacity-100 md:absolute md:-right-10 md:-top-2 md:opacity-0\",\n className\n )}\n {...props}\n >\n <Button variant=\"ghost\" size=\"icon\" onClick={onCopy}>\n {isCopied ? <IconCheck /> : <IconCopy />}\n <span className=\"sr-only\">Copy message</span>\n </Button>\n </div>\n );\n}\n"]}
|
package/dist/chunk-7KPMJBGH.mjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { CopilotChat } from './chunk-2NO6SF5H.mjs';
|
|
2
|
-
import { __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
3
|
-
import { XMarkIcon } from '@heroicons/react/24/outline';
|
|
4
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
function CopilotSidebar(props) {
|
|
7
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
8
|
-
className: "shadow-lg bg-gray-50 flex flex-col border-l-2",
|
|
9
|
-
style: { width: "100%", height: "100%" },
|
|
10
|
-
children: [
|
|
11
|
-
/* @__PURE__ */ jsx(TopBar, __spreadValues({}, props)),
|
|
12
|
-
/* @__PURE__ */ jsx(CopilotChat, {})
|
|
13
|
-
]
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
function TopBar(props) {
|
|
17
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
18
|
-
className: "py-6 flex bg-gray-50 items-center justify-between px-4",
|
|
19
|
-
children: [
|
|
20
|
-
/* @__PURE__ */ jsx("h1", {
|
|
21
|
-
className: "text-base font-semibold leading-6 text-gray-900",
|
|
22
|
-
children: "Copilot Chat"
|
|
23
|
-
}),
|
|
24
|
-
/* @__PURE__ */ jsx("div", {
|
|
25
|
-
className: "ml-3 flex h-7 items-center",
|
|
26
|
-
children: /* @__PURE__ */ jsxs("button", {
|
|
27
|
-
type: "button",
|
|
28
|
-
className: "rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2",
|
|
29
|
-
onClick: () => props.setSidebarOpen(false),
|
|
30
|
-
children: [
|
|
31
|
-
/* @__PURE__ */ jsx("span", {
|
|
32
|
-
className: "sr-only",
|
|
33
|
-
children: "Close panel"
|
|
34
|
-
}),
|
|
35
|
-
/* @__PURE__ */ jsx(XMarkIcon, {
|
|
36
|
-
className: "h-6 w-6",
|
|
37
|
-
"aria-hidden": "true"
|
|
38
|
-
})
|
|
39
|
-
]
|
|
40
|
-
})
|
|
41
|
-
})
|
|
42
|
-
]
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { CopilotSidebar };
|
|
47
|
-
//# sourceMappingURL=out.js.map
|
|
48
|
-
//# sourceMappingURL=chunk-7KPMJBGH.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/sidebar/copilot-sidebar.tsx"],"names":[],"mappings":";;;;;;;;AAmBA,SAAS,iBAAiB;AAVtB,SAIE,KAJF;AAFG,SAAS,eAAe,OAAkC;AAC/D,SACE,qBAAC;AAAA,IACC,WAAU;AAAA,IACV,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAO;AAAA,IAEvC;AAAA,0BAAC,2BAAW,MAAO;AAAA,MACnB,oBAAC,eAAY;AAAA;AAAA,GACf;AAEJ;AAIA,SAAS,OAAO,OAAkC;AAChD,SACE,qBAAC;AAAA,IAAI,WAAU;AAAA,IACb;AAAA,0BAAC;AAAA,QAAG,WAAU;AAAA,QAAkD;AAAA,OAEhE;AAAA,MACA,oBAAC;AAAA,QAAI,WAAU;AAAA,QACb,+BAAC;AAAA,UACC,MAAK;AAAA,UACL,WAAU;AAAA,UACV,SAAS,MAAM,MAAM,eAAe,KAAK;AAAA,UAEzC;AAAA,gCAAC;AAAA,cAAK,WAAU;AAAA,cAAU;AAAA,aAAW;AAAA,YACrC,oBAAC;AAAA,cAAU,WAAU;AAAA,cAAU,eAAY;AAAA,aAAO;AAAA;AAAA,SACpD;AAAA,OACF;AAAA;AAAA,GACF;AAEJ","sourcesContent":["import React from \"react\";\nimport { CopilotChat } from \"../chat-components/copilot-chat\";\n\nexport interface SidebarProps {\n setSidebarOpen: (open: boolean) => void;\n}\n\nexport function CopilotSidebar(props: SidebarProps): JSX.Element {\n return (\n <div\n className=\"shadow-lg bg-gray-50 flex flex-col border-l-2\"\n style={{ width: \"100%\", height: \"100%\" }}\n >\n <TopBar {...props} />\n <CopilotChat />\n </div>\n );\n}\n\nimport { XMarkIcon } from \"@heroicons/react/24/outline\";\n\nfunction TopBar(props: SidebarProps): JSX.Element {\n return (\n <div className=\"py-6 flex bg-gray-50 items-center justify-between px-4\">\n <h1 className=\"text-base font-semibold leading-6 text-gray-900\">\n Copilot Chat\n </h1>\n <div className=\"ml-3 flex h-7 items-center\">\n <button\n type=\"button\"\n className=\"rounded-md bg-white text-gray-400 hover:text-gray-500 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:ring-offset-2\"\n onClick={() => props.setSidebarOpen(false)}\n >\n <span className=\"sr-only\">Close panel</span>\n <XMarkIcon className=\"h-6 w-6\" aria-hidden=\"true\" />\n </button>\n </div>\n </div>\n );\n}\n"]}
|
package/dist/chunk-7NSRDJ5C.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/chunk-APH6ZQHG.mjs
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { PromptForm } from './chunk-UKKJ6H2K.mjs';
|
|
2
|
-
import { Button } from './chunk-V6QYUEJR.mjs';
|
|
3
|
-
import { IconStop, IconRefresh } from './chunk-KR7MH7XO.mjs';
|
|
4
|
-
import { __async } from './chunk-MRXNTQOX.mjs';
|
|
5
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
function ChatPanel({
|
|
8
|
-
id,
|
|
9
|
-
isLoading,
|
|
10
|
-
stop,
|
|
11
|
-
append,
|
|
12
|
-
reload,
|
|
13
|
-
input,
|
|
14
|
-
setInput,
|
|
15
|
-
messages
|
|
16
|
-
}) {
|
|
17
|
-
return /* @__PURE__ */ jsx("div", {
|
|
18
|
-
className: "inset-x-0 bottom-0 bg-gradient-to-b from-muted/10 from-10% to-muted/30 to-50% mt-4 mb-8",
|
|
19
|
-
style: { width: "100%", overflow: "hidden", boxSizing: "border-box" },
|
|
20
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
21
|
-
className: "mx-auto sm:max-w-2xl sm:px-4",
|
|
22
|
-
children: [
|
|
23
|
-
/* @__PURE__ */ jsx("div", {
|
|
24
|
-
className: "flex h-10 items-center justify-center mb-4",
|
|
25
|
-
children: isLoading ? /* @__PURE__ */ jsxs(Button, {
|
|
26
|
-
variant: "outline",
|
|
27
|
-
onClick: () => stop(),
|
|
28
|
-
className: "bg-background",
|
|
29
|
-
children: [
|
|
30
|
-
/* @__PURE__ */ jsx(IconStop, {
|
|
31
|
-
className: "mr-2"
|
|
32
|
-
}),
|
|
33
|
-
"Stop generating"
|
|
34
|
-
]
|
|
35
|
-
}) : (messages == null ? void 0 : messages.length) > 0 && /* @__PURE__ */ jsxs(Button, {
|
|
36
|
-
variant: "outline",
|
|
37
|
-
onClick: () => reload(),
|
|
38
|
-
className: "bg-background",
|
|
39
|
-
children: [
|
|
40
|
-
/* @__PURE__ */ jsx(IconRefresh, {
|
|
41
|
-
className: "mr-2"
|
|
42
|
-
}),
|
|
43
|
-
"Regenerate response"
|
|
44
|
-
]
|
|
45
|
-
})
|
|
46
|
-
}),
|
|
47
|
-
/* @__PURE__ */ jsx("div", {
|
|
48
|
-
className: "space-y-4 border-2 bg-background px-4 py-2 shadow-lg sm:rounded-xl md:py-4",
|
|
49
|
-
children: /* @__PURE__ */ jsx(PromptForm, {
|
|
50
|
-
onSubmit: (value) => __async(this, null, function* () {
|
|
51
|
-
yield append({
|
|
52
|
-
id,
|
|
53
|
-
content: value,
|
|
54
|
-
role: "user"
|
|
55
|
-
});
|
|
56
|
-
}),
|
|
57
|
-
input,
|
|
58
|
-
setInput,
|
|
59
|
-
isLoading
|
|
60
|
-
})
|
|
61
|
-
})
|
|
62
|
-
]
|
|
63
|
-
})
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export { ChatPanel };
|
|
68
|
-
//# sourceMappingURL=out.js.map
|
|
69
|
-
//# sourceMappingURL=chunk-APH6ZQHG.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/chat-components/chat-panel.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAsCY,SAKE,KALF;AAlBL,SAAS,UAAU;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAmB;AACjB,SACE,oBAAC;AAAA,IACC,WAAU;AAAA,IACV,OAAO,EAAE,OAAO,QAAQ,UAAU,UAAU,WAAW,aAAa;AAAA,IAEpE,+BAAC;AAAA,MAAI,WAAU;AAAA,MACb;AAAA,4BAAC;AAAA,UAAI,WAAU;AAAA,UACZ,sBACC,qBAAC;AAAA,YACC,SAAQ;AAAA,YACR,SAAS,MAAM,KAAK;AAAA,YACpB,WAAU;AAAA,YAEV;AAAA,kCAAC;AAAA,gBAAS,WAAU;AAAA,eAAO;AAAA,cAAE;AAAA;AAAA,WAE/B,KAEA,qCAAU,UAAS,KACjB,qBAAC;AAAA,YACC,SAAQ;AAAA,YACR,SAAS,MAAM,OAAO;AAAA,YACtB,WAAU;AAAA,YAEV;AAAA,kCAAC;AAAA,gBAAY,WAAU;AAAA,eAAO;AAAA,cAAE;AAAA;AAAA,WAElC;AAAA,SAGN;AAAA,QACA,oBAAC;AAAA,UAAI,WAAU;AAAA,UACb,8BAAC;AAAA,YACC,UAAU,CAAO,UAAU;AACzB,oBAAM,OAAO;AAAA,gBACX;AAAA,gBACA,SAAS;AAAA,gBACT,MAAM;AAAA,cACR,CAAC;AAAA,YACH;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,WACF;AAAA,SACF;AAAA;AAAA,KACF;AAAA,GACF;AAEJ","sourcesContent":["import { type UseChatHelpers } from \"ai/react\";\n\nimport { Button } from \"./ui/button\";\nimport { PromptForm } from \"./prompt-form\";\nimport { IconRefresh, IconStop } from \"./ui/icons\";\n\nexport interface ChatPanelProps\n extends Pick<\n UseChatHelpers,\n | \"append\"\n | \"isLoading\"\n | \"reload\"\n | \"messages\"\n | \"stop\"\n | \"input\"\n | \"setInput\"\n > {\n id?: string;\n}\n\nexport function ChatPanel({\n id,\n isLoading,\n stop,\n append,\n reload,\n input,\n setInput,\n messages,\n}: ChatPanelProps) {\n return (\n <div\n className=\"inset-x-0 bottom-0 bg-gradient-to-b from-muted/10 from-10% to-muted/30 to-50% mt-4 mb-8\"\n style={{ width: \"100%\", overflow: \"hidden\", boxSizing: \"border-box\" }}\n >\n <div className=\"mx-auto sm:max-w-2xl sm:px-4\">\n <div className=\"flex h-10 items-center justify-center mb-4\">\n {isLoading ? (\n <Button\n variant=\"outline\"\n onClick={() => stop()}\n className=\"bg-background\"\n >\n <IconStop className=\"mr-2\" />\n Stop generating\n </Button>\n ) : (\n messages?.length > 0 && (\n <Button\n variant=\"outline\"\n onClick={() => reload()}\n className=\"bg-background\"\n >\n <IconRefresh className=\"mr-2\" />\n Regenerate response\n </Button>\n )\n )}\n </div>\n <div className=\"space-y-4 border-2 bg-background px-4 py-2 shadow-lg sm:rounded-xl md:py-4\">\n <PromptForm\n onSubmit={async (value) => {\n await append({\n id,\n content: value,\n role: \"user\",\n });\n }}\n input={input}\n setInput={setInput}\n isLoading={isLoading}\n />\n </div>\n </div>\n </div>\n );\n}\n"]}
|
package/dist/chunk-BIPCPNHG.mjs
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useRef } from 'react';
|
|
2
|
-
|
|
3
|
-
// src/hooks/use-enter-submit.tsx
|
|
4
|
-
function useEnterSubmit() {
|
|
5
|
-
const formRef = useRef(null);
|
|
6
|
-
const handleKeyDown = (event) => {
|
|
7
|
-
var _a;
|
|
8
|
-
if (event.key === "Enter" && !event.shiftKey && !event.nativeEvent.isComposing) {
|
|
9
|
-
(_a = formRef.current) == null ? void 0 : _a.requestSubmit();
|
|
10
|
-
event.preventDefault();
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
return { formRef, onKeyDown: handleKeyDown };
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { useEnterSubmit };
|
|
17
|
-
//# sourceMappingURL=out.js.map
|
|
18
|
-
//# sourceMappingURL=chunk-BIPCPNHG.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/hooks/use-enter-submit.tsx"],"names":[],"mappings":";AAAA,SAAS,cAA8B;AAEhC,SAAS,iBAGd;AACA,QAAM,UAAU,OAAwB,IAAI;AAE5C,QAAM,gBAAgB,CACpB,UACS;AAVb;AAWI,QACE,MAAM,QAAQ,WACd,CAAC,MAAM,YACP,CAAC,MAAM,YAAY,aACnB;AACA,oBAAQ,YAAR,mBAAiB;AACjB,YAAM,eAAe;AAAA,IACvB;AAAA,EACF;AAEA,SAAO,EAAE,SAAS,WAAW,cAAc;AAC7C","sourcesContent":["import { useRef, type RefObject } from \"react\";\n\nexport function useEnterSubmit(): {\n formRef: RefObject<HTMLFormElement>;\n onKeyDown: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;\n} {\n const formRef = useRef<HTMLFormElement>(null);\n\n const handleKeyDown = (\n event: React.KeyboardEvent<HTMLTextAreaElement>\n ): void => {\n if (\n event.key === \"Enter\" &&\n !event.shiftKey &&\n !event.nativeEvent.isComposing\n ) {\n formRef.current?.requestSubmit();\n event.preventDefault();\n }\n };\n\n return { formRef, onKeyDown: handleKeyDown };\n}\n"]}
|
package/dist/chunk-BS6RR2DJ.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { cn } from './chunk-TVTG3V4F.mjs';
|
|
2
|
-
import { __objRest, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
var TooltipProvider = TooltipPrimitive.Provider;
|
|
8
|
-
var Tooltip = TooltipPrimitive.Root;
|
|
9
|
-
var TooltipTrigger = TooltipPrimitive.Trigger;
|
|
10
|
-
var TooltipContent = React.forwardRef((_a, ref) => {
|
|
11
|
-
var _b = _a, { className, sideOffset = 4 } = _b, props = __objRest(_b, ["className", "sideOffset"]);
|
|
12
|
-
return /* @__PURE__ */ jsx(TooltipPrimitive.Content, __spreadValues({
|
|
13
|
-
ref,
|
|
14
|
-
sideOffset,
|
|
15
|
-
className: cn(
|
|
16
|
-
"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-xs font-medium text-popover-foreground shadow-md animate-in fade-in-50 data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1",
|
|
17
|
-
className
|
|
18
|
-
)
|
|
19
|
-
}, props));
|
|
20
|
-
});
|
|
21
|
-
TooltipContent.displayName = TooltipPrimitive.Content.displayName;
|
|
22
|
-
|
|
23
|
-
export { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };
|
|
24
|
-
//# sourceMappingURL=out.js.map
|
|
25
|
-
//# sourceMappingURL=chunk-BS6RR2DJ.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/chat-components/ui/tooltip.tsx"],"names":[],"mappings":";;;;;;;;;AAEA,YAAY,WAAW;AACvB,YAAY,sBAAsB;AAchC;AAjBF;AAOA,IAAM,kBAAmC;AAEzC,IAAM,UAA2B;AAEjC,IAAM,iBAAkC;AAExC,IAAM,iBAAuB,iBAG3B,CAAC,IAAyC,QAAK;AAA9C,eAAE,aAAW,aAAa,EAhB7B,IAgBG,IAAgC,kBAAhC,IAAgC,CAA9B,aAAW;AACd,6BAAkB,0BAAjB;AAAA,IACC;AAAA,IACA;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,KACI,MACN;AAAA,CACD;AACD,eAAe,cAA+B,yBAAQ","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nimport { cn } from \"../../../lib/utils\";\n\nconst TooltipProvider = TooltipPrimitive.Provider;\n\nconst Tooltip = TooltipPrimitive.Root;\n\nconst TooltipTrigger = TooltipPrimitive.Trigger;\n\nconst TooltipContent = React.forwardRef<\n React.ElementRef<typeof TooltipPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Content>\n>(({ className, sideOffset = 4, ...props }, ref) => (\n <TooltipPrimitive.Content\n ref={ref}\n sideOffset={sideOffset}\n className={cn(\n \"z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-xs font-medium text-popover-foreground shadow-md animate-in fade-in-50 data-[side=bottom]:slide-in-from-top-1 data-[side=left]:slide-in-from-right-1 data-[side=right]:slide-in-from-left-1 data-[side=top]:slide-in-from-bottom-1\",\n className\n )}\n {...props}\n />\n));\nTooltipContent.displayName = TooltipPrimitive.Content.displayName;\n\nexport { Tooltip, TooltipTrigger, TooltipContent, TooltipProvider };\n"]}
|
package/dist/chunk-DOMJCSI6.mjs
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { cn } from './chunk-TVTG3V4F.mjs';
|
|
2
|
-
import { __objRest, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import * as SeparatorPrimitive from '@radix-ui/react-separator';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
var Separator = React.forwardRef(
|
|
8
|
-
(_a, ref) => {
|
|
9
|
-
var _b = _a, { className, orientation = "horizontal", decorative = true } = _b, props = __objRest(_b, ["className", "orientation", "decorative"]);
|
|
10
|
-
return /* @__PURE__ */ jsx(SeparatorPrimitive.Root, __spreadValues({
|
|
11
|
-
ref,
|
|
12
|
-
decorative,
|
|
13
|
-
orientation,
|
|
14
|
-
className: cn(
|
|
15
|
-
"shrink-0 bg-border",
|
|
16
|
-
orientation === "horizontal" ? "h-[1px] w-full" : "h-full w-[1px]",
|
|
17
|
-
className
|
|
18
|
-
)
|
|
19
|
-
}, props));
|
|
20
|
-
}
|
|
21
|
-
);
|
|
22
|
-
Separator.displayName = SeparatorPrimitive.Root.displayName;
|
|
23
|
-
|
|
24
|
-
export { Separator };
|
|
25
|
-
//# sourceMappingURL=out.js.map
|
|
26
|
-
//# sourceMappingURL=chunk-DOMJCSI6.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/chat-components/ui/separator.tsx"],"names":[],"mappings":";;;;;;;;;AAEA,YAAY,WAAW;AACvB,YAAY,wBAAwB;AAYhC;AAfJ;AAOA,IAAM,YAAkB;AAAA,EAItB,CACE,IACA,QACA;AAFA,iBAAE,aAAW,cAAc,cAAc,aAAa,KAZ1D,IAYI,IAA+D,kBAA/D,IAA+D,CAA7D,aAAW,eAA4B;AAGzC,+BAAoB,yBAAnB;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA,gBAAgB,eAAe,mBAAmB;AAAA,QAClD;AAAA,MACF;AAAA,OACI,MACN;AAAA;AAEJ;AACA,UAAU,cAAiC,wBAAK","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as SeparatorPrimitive from \"@radix-ui/react-separator\";\n\nimport { cn } from \"../../../lib/utils\";\n\nconst Separator = React.forwardRef<\n React.ElementRef<typeof SeparatorPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof SeparatorPrimitive.Root>\n>(\n (\n { className, orientation = \"horizontal\", decorative = true, ...props },\n ref\n ) => (\n <SeparatorPrimitive.Root\n ref={ref}\n decorative={decorative}\n orientation={orientation}\n className={cn(\n \"shrink-0 bg-border\",\n orientation === \"horizontal\" ? \"h-[1px] w-full\" : \"h-full w-[1px]\",\n className\n )}\n {...props}\n />\n )\n);\nSeparator.displayName = SeparatorPrimitive.Root.displayName;\n\nexport { Separator };\n"]}
|
package/dist/chunk-H4VKQGVU.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":""}
|
package/dist/chunk-HKSY5T7Y.mjs
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { Button } from './chunk-V6QYUEJR.mjs';
|
|
2
|
-
import { IconDownload, IconCheck, IconCopy } from './chunk-KR7MH7XO.mjs';
|
|
3
|
-
import { useCopyToClipboard } from './chunk-6LAC5RA2.mjs';
|
|
4
|
-
import { memo } from 'react';
|
|
5
|
-
import { Prism } from 'react-syntax-highlighter';
|
|
6
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
var programmingLanguages = {
|
|
9
|
-
javascript: ".js",
|
|
10
|
-
python: ".py",
|
|
11
|
-
java: ".java",
|
|
12
|
-
c: ".c",
|
|
13
|
-
cpp: ".cpp",
|
|
14
|
-
"c++": ".cpp",
|
|
15
|
-
"c#": ".cs",
|
|
16
|
-
ruby: ".rb",
|
|
17
|
-
php: ".php",
|
|
18
|
-
swift: ".swift",
|
|
19
|
-
"objective-c": ".m",
|
|
20
|
-
kotlin: ".kt",
|
|
21
|
-
typescript: ".ts",
|
|
22
|
-
go: ".go",
|
|
23
|
-
perl: ".pl",
|
|
24
|
-
rust: ".rs",
|
|
25
|
-
scala: ".scala",
|
|
26
|
-
haskell: ".hs",
|
|
27
|
-
lua: ".lua",
|
|
28
|
-
shell: ".sh",
|
|
29
|
-
sql: ".sql",
|
|
30
|
-
html: ".html",
|
|
31
|
-
css: ".css"
|
|
32
|
-
};
|
|
33
|
-
var generateRandomString = (length, lowercase = false) => {
|
|
34
|
-
const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789";
|
|
35
|
-
let result = "";
|
|
36
|
-
for (let i = 0; i < length; i++) {
|
|
37
|
-
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
38
|
-
}
|
|
39
|
-
return lowercase ? result.toLowerCase() : result;
|
|
40
|
-
};
|
|
41
|
-
var CodeBlock = memo(({ language, value }) => {
|
|
42
|
-
const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
|
|
43
|
-
const downloadAsFile = () => {
|
|
44
|
-
if (typeof window === "undefined") {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const fileExtension = programmingLanguages[language] || ".file";
|
|
48
|
-
const suggestedFileName = `file-${generateRandomString(
|
|
49
|
-
3,
|
|
50
|
-
true
|
|
51
|
-
)}${fileExtension}`;
|
|
52
|
-
const fileName = window.prompt("Enter file name", suggestedFileName);
|
|
53
|
-
if (!fileName) {
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
const blob = new Blob([value], { type: "text/plain" });
|
|
57
|
-
const url = URL.createObjectURL(blob);
|
|
58
|
-
const link = document.createElement("a");
|
|
59
|
-
link.download = fileName;
|
|
60
|
-
link.href = url;
|
|
61
|
-
link.style.display = "none";
|
|
62
|
-
document.body.appendChild(link);
|
|
63
|
-
link.click();
|
|
64
|
-
document.body.removeChild(link);
|
|
65
|
-
URL.revokeObjectURL(url);
|
|
66
|
-
};
|
|
67
|
-
const onCopy = () => {
|
|
68
|
-
if (isCopied)
|
|
69
|
-
return;
|
|
70
|
-
copyToClipboard(value);
|
|
71
|
-
};
|
|
72
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
73
|
-
className: "codeblock relative w-full bg-zinc-950 font-sans",
|
|
74
|
-
children: [
|
|
75
|
-
/* @__PURE__ */ jsxs("div", {
|
|
76
|
-
className: "flex w-full items-center justify-between bg-zinc-800 px-6 py-2 pr-4 text-zinc-100",
|
|
77
|
-
children: [
|
|
78
|
-
/* @__PURE__ */ jsx("span", {
|
|
79
|
-
className: "text-xs lowercase",
|
|
80
|
-
children: language
|
|
81
|
-
}),
|
|
82
|
-
/* @__PURE__ */ jsxs("div", {
|
|
83
|
-
className: "flex items-center space-x-1",
|
|
84
|
-
children: [
|
|
85
|
-
/* @__PURE__ */ jsxs(Button, {
|
|
86
|
-
variant: "ghost",
|
|
87
|
-
className: "hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",
|
|
88
|
-
onClick: downloadAsFile,
|
|
89
|
-
size: "icon",
|
|
90
|
-
children: [
|
|
91
|
-
/* @__PURE__ */ jsx(IconDownload, {}),
|
|
92
|
-
/* @__PURE__ */ jsx("span", {
|
|
93
|
-
className: "sr-only",
|
|
94
|
-
children: "Download"
|
|
95
|
-
})
|
|
96
|
-
]
|
|
97
|
-
}),
|
|
98
|
-
/* @__PURE__ */ jsxs(Button, {
|
|
99
|
-
variant: "ghost",
|
|
100
|
-
size: "icon",
|
|
101
|
-
className: "text-xs hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",
|
|
102
|
-
onClick: onCopy,
|
|
103
|
-
children: [
|
|
104
|
-
isCopied ? /* @__PURE__ */ jsx(IconCheck, {}) : /* @__PURE__ */ jsx(IconCopy, {}),
|
|
105
|
-
/* @__PURE__ */ jsx("span", {
|
|
106
|
-
className: "sr-only",
|
|
107
|
-
children: "Copy code"
|
|
108
|
-
})
|
|
109
|
-
]
|
|
110
|
-
})
|
|
111
|
-
]
|
|
112
|
-
})
|
|
113
|
-
]
|
|
114
|
-
}),
|
|
115
|
-
/* @__PURE__ */ jsx(Prism, {
|
|
116
|
-
language,
|
|
117
|
-
PreTag: "div",
|
|
118
|
-
showLineNumbers: true,
|
|
119
|
-
customStyle: {
|
|
120
|
-
margin: 0,
|
|
121
|
-
width: "100%",
|
|
122
|
-
background: "transparent",
|
|
123
|
-
padding: "1.5rem 1rem"
|
|
124
|
-
},
|
|
125
|
-
codeTagProps: {
|
|
126
|
-
style: {
|
|
127
|
-
fontSize: "0.9rem",
|
|
128
|
-
fontFamily: "var(--font-mono)"
|
|
129
|
-
}
|
|
130
|
-
},
|
|
131
|
-
children: value
|
|
132
|
-
})
|
|
133
|
-
]
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
CodeBlock.displayName = "CodeBlock";
|
|
137
|
-
|
|
138
|
-
export { CodeBlock, generateRandomString, programmingLanguages };
|
|
139
|
-
//# sourceMappingURL=out.js.map
|
|
140
|
-
//# sourceMappingURL=chunk-HKSY5T7Y.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/chat-components/ui/codeblock.tsx"],"names":[],"mappings":"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","sourcesContent":["\"use client\";\n\nimport { FC, memo } from \"react\";\nimport { Prism as SyntaxHighlighter } from \"react-syntax-highlighter\";\n\nimport { useCopyToClipboard } from \"../../../hooks/use-copy-to-clipboard\";\nimport { IconCheck, IconCopy, IconDownload } from \"./icons\";\nimport { Button } from \"./button\";\n\ninterface Props {\n language: string;\n value: string;\n}\n\ninterface languageMap {\n [key: string]: string | undefined;\n}\n\nexport const programmingLanguages: languageMap = {\n javascript: \".js\",\n python: \".py\",\n java: \".java\",\n c: \".c\",\n cpp: \".cpp\",\n \"c++\": \".cpp\",\n \"c#\": \".cs\",\n ruby: \".rb\",\n php: \".php\",\n swift: \".swift\",\n \"objective-c\": \".m\",\n kotlin: \".kt\",\n typescript: \".ts\",\n go: \".go\",\n perl: \".pl\",\n rust: \".rs\",\n scala: \".scala\",\n haskell: \".hs\",\n lua: \".lua\",\n shell: \".sh\",\n sql: \".sql\",\n html: \".html\",\n css: \".css\",\n // add more file extensions here, make sure the key is same as language prop in CodeBlock.tsx component\n};\n\nexport const generateRandomString = (length: number, lowercase = false) => {\n const chars = \"ABCDEFGHJKLMNPQRSTUVWXY3456789\"; // excluding similar looking characters like Z, 2, I, 1, O, 0\n let result = \"\";\n for (let i = 0; i < length; i++) {\n result += chars.charAt(Math.floor(Math.random() * chars.length));\n }\n return lowercase ? result.toLowerCase() : result;\n};\n\nconst CodeBlock: FC<Props> = memo(({ language, value }) => {\n const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2000 });\n\n const downloadAsFile = () => {\n if (typeof window === \"undefined\") {\n return;\n }\n const fileExtension = programmingLanguages[language] || \".file\";\n const suggestedFileName = `file-${generateRandomString(\n 3,\n true\n )}${fileExtension}`;\n const fileName = window.prompt(\"Enter file name\" || \"\", suggestedFileName);\n\n if (!fileName) {\n // User pressed cancel on prompt.\n return;\n }\n\n const blob = new Blob([value], { type: \"text/plain\" });\n const url = URL.createObjectURL(blob);\n const link = document.createElement(\"a\");\n link.download = fileName;\n link.href = url;\n link.style.display = \"none\";\n document.body.appendChild(link);\n link.click();\n document.body.removeChild(link);\n URL.revokeObjectURL(url);\n };\n\n const onCopy = () => {\n if (isCopied) return;\n copyToClipboard(value);\n };\n\n return (\n <div className=\"codeblock relative w-full bg-zinc-950 font-sans\">\n <div className=\"flex w-full items-center justify-between bg-zinc-800 px-6 py-2 pr-4 text-zinc-100\">\n <span className=\"text-xs lowercase\">{language}</span>\n <div className=\"flex items-center space-x-1\">\n <Button\n variant=\"ghost\"\n className=\"hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0\"\n onClick={downloadAsFile}\n size=\"icon\"\n >\n <IconDownload />\n <span className=\"sr-only\">Download</span>\n </Button>\n <Button\n variant=\"ghost\"\n size=\"icon\"\n className=\"text-xs hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0\"\n onClick={onCopy}\n >\n {isCopied ? <IconCheck /> : <IconCopy />}\n <span className=\"sr-only\">Copy code</span>\n </Button>\n </div>\n </div>\n <SyntaxHighlighter\n language={language}\n PreTag=\"div\"\n showLineNumbers\n customStyle={{\n margin: 0,\n width: \"100%\",\n background: \"transparent\",\n padding: \"1.5rem 1rem\",\n }}\n codeTagProps={{\n style: {\n fontSize: \"0.9rem\",\n fontFamily: \"var(--font-mono)\",\n },\n }}\n >\n {value}\n </SyntaxHighlighter>\n </div>\n );\n});\nCodeBlock.displayName = \"CodeBlock\";\n\nexport { CodeBlock };\n"]}
|