@copilotkit/react-ui 0.2.0 → 0.4.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 +193 -16
- package/CHANGELOG.md +24 -0
- package/LICENSE +21 -0
- package/dist/chunk-46XC7ODX.mjs +72 -0
- package/dist/chunk-46XC7ODX.mjs.map +1 -0
- package/dist/chunk-4HK6C362.mjs +106 -0
- package/dist/chunk-4HK6C362.mjs.map +1 -0
- package/dist/chunk-6LAC5RA2.mjs +28 -0
- package/dist/chunk-6LAC5RA2.mjs.map +1 -0
- package/dist/chunk-6LRNF2VU.mjs +12 -0
- package/dist/chunk-6LRNF2VU.mjs.map +1 -0
- package/dist/chunk-7NSRDJ5C.mjs +3 -0
- package/dist/chunk-7NSRDJ5C.mjs.map +1 -0
- package/dist/chunk-BB6IP63P.mjs +29 -0
- package/dist/chunk-BB6IP63P.mjs.map +1 -0
- package/dist/chunk-BIPCPNHG.mjs +18 -0
- package/dist/chunk-BIPCPNHG.mjs.map +1 -0
- package/dist/chunk-BS6RR2DJ.mjs +25 -0
- package/dist/chunk-BS6RR2DJ.mjs.map +1 -0
- package/dist/chunk-DOMJCSI6.mjs +26 -0
- package/dist/chunk-DOMJCSI6.mjs.map +1 -0
- package/dist/chunk-E2YBQYWM.mjs +69 -0
- package/dist/chunk-E2YBQYWM.mjs.map +1 -0
- package/dist/chunk-E5BOIXYO.mjs +45 -0
- package/dist/chunk-E5BOIXYO.mjs.map +1 -0
- package/dist/chunk-H4VKQGVU.mjs +3 -0
- package/dist/chunk-H4VKQGVU.mjs.map +1 -0
- package/dist/chunk-I2AB5FK4.mjs +123 -0
- package/dist/chunk-I2AB5FK4.mjs.map +1 -0
- package/dist/chunk-IU3WTXLQ.mjs +3 -0
- package/dist/chunk-IU3WTXLQ.mjs.map +1 -0
- package/dist/chunk-KR7MH7XO.mjs +481 -0
- package/dist/chunk-KR7MH7XO.mjs.map +1 -0
- package/dist/chunk-KXJV37FS.mjs +33 -0
- package/dist/chunk-KXJV37FS.mjs.map +1 -0
- package/dist/chunk-MC6KTH4X.mjs +12 -0
- package/dist/chunk-MC6KTH4X.mjs.map +1 -0
- package/dist/chunk-MRXNTQOX.mjs +55 -0
- package/dist/chunk-MRXNTQOX.mjs.map +1 -0
- package/dist/chunk-N7KB3Z57.mjs +23 -0
- package/dist/chunk-N7KB3Z57.mjs.map +1 -0
- package/dist/chunk-QEXWZWJL.mjs +75 -0
- package/dist/chunk-QEXWZWJL.mjs.map +1 -0
- package/dist/chunk-RSONJDLO.mjs +28 -0
- package/dist/chunk-RSONJDLO.mjs.map +1 -0
- package/dist/chunk-SF56HSZW.mjs +48 -0
- package/dist/chunk-SF56HSZW.mjs.map +1 -0
- package/dist/chunk-TVTG3V4F.mjs +40 -0
- package/dist/chunk-TVTG3V4F.mjs.map +1 -0
- package/dist/chunk-U6NJWGTV.mjs +3 -0
- package/dist/chunk-U6NJWGTV.mjs.map +1 -0
- package/dist/chunk-V6QYUEJR.mjs +47 -0
- package/dist/chunk-V6QYUEJR.mjs.map +1 -0
- package/dist/chunk-VQNV2DHJ.mjs +142 -0
- package/dist/chunk-VQNV2DHJ.mjs.map +1 -0
- package/dist/chunk-VSNDSL6W.mjs +74 -0
- package/dist/chunk-VSNDSL6W.mjs.map +1 -0
- package/dist/chunk-XZFO2YEG.mjs +53 -0
- package/dist/chunk-XZFO2YEG.mjs.map +1 -0
- package/dist/components/chat-components/chat-list.d.ts +8 -0
- package/dist/components/chat-components/chat-list.mjs +13 -0
- package/dist/components/chat-components/chat-list.mjs.map +1 -0
- package/dist/components/chat-components/chat-message-actions.d.ts +8 -0
- package/dist/components/chat-components/chat-message-actions.mjs +8 -0
- package/dist/components/chat-components/chat-message-actions.mjs.map +1 -0
- package/dist/components/chat-components/chat-message.d.ts +8 -0
- package/dist/components/chat-components/chat-message.mjs +11 -0
- package/dist/components/chat-components/chat-message.mjs.map +1 -0
- package/dist/components/chat-components/chat-panel.d.ts +8 -0
- package/dist/components/chat-components/chat-panel.mjs +10 -0
- package/dist/components/chat-components/chat-panel.mjs.map +1 -0
- package/dist/components/chat-components/chat-scroll-anchor.d.ts +6 -0
- package/dist/components/chat-components/chat-scroll-anchor.mjs +5 -0
- package/dist/components/chat-components/chat-scroll-anchor.mjs.map +1 -0
- package/dist/components/chat-components/clear-history.d.ts +9 -0
- package/dist/components/chat-components/clear-history.mjs +81 -0
- package/dist/components/chat-components/clear-history.mjs.map +1 -0
- package/dist/components/chat-components/copilot-chat.d.ts +12 -0
- package/dist/components/chat-components/copilot-chat.mjs +22 -0
- package/dist/components/chat-components/copilot-chat.mjs.map +1 -0
- package/dist/components/chat-components/default-empty-screen.d.ts +8 -0
- package/dist/components/chat-components/default-empty-screen.mjs +8 -0
- package/dist/components/chat-components/default-empty-screen.mjs.map +1 -0
- package/dist/components/chat-components/external-link.d.ts +6 -0
- package/dist/components/chat-components/external-link.mjs +4 -0
- package/dist/components/chat-components/external-link.mjs.map +1 -0
- package/dist/components/chat-components/markdown.d.ts +6 -0
- package/dist/components/chat-components/markdown.mjs +4 -0
- package/dist/components/chat-components/markdown.mjs.map +1 -0
- package/dist/components/chat-components/prompt-form.d.ts +9 -0
- package/dist/components/chat-components/prompt-form.mjs +9 -0
- package/dist/components/chat-components/prompt-form.mjs.map +1 -0
- package/dist/components/chat-components/theme-toggle.d.ts +3 -0
- package/dist/components/chat-components/theme-toggle.mjs +36 -0
- package/dist/components/chat-components/theme-toggle.mjs.map +1 -0
- package/dist/components/chat-components/toaster.d.ts +1 -0
- package/dist/components/chat-components/toaster.mjs +4 -0
- package/dist/components/chat-components/toaster.mjs.map +1 -0
- package/dist/components/chat-components/ui/alert-dialog.d.ts +20 -0
- package/dist/components/chat-components/ui/alert-dialog.mjs +6 -0
- package/dist/components/chat-components/ui/alert-dialog.mjs.map +1 -0
- package/dist/components/chat-components/ui/badge.d.ts +12 -0
- package/dist/components/chat-components/ui/badge.mjs +31 -0
- package/dist/components/chat-components/ui/badge.mjs.map +1 -0
- package/dist/components/chat-components/ui/button.d.ts +14 -0
- package/dist/components/chat-components/ui/button.mjs +5 -0
- package/dist/components/chat-components/ui/button.mjs.map +1 -0
- package/dist/components/chat-components/ui/codeblock.d.ts +14 -0
- package/dist/components/chat-components/ui/codeblock.mjs +8 -0
- package/dist/components/chat-components/ui/codeblock.mjs.map +1 -0
- package/dist/components/chat-components/ui/dialog.d.ts +18 -0
- package/dist/components/chat-components/ui/dialog.mjs +119 -0
- package/dist/components/chat-components/ui/dialog.mjs.map +1 -0
- package/dist/components/chat-components/ui/dropdown-menu.d.ts +24 -0
- package/dist/components/chat-components/ui/dropdown-menu.mjs +84 -0
- package/dist/components/chat-components/ui/dropdown-menu.mjs.map +1 -0
- package/dist/components/chat-components/ui/icons.d.ts +33 -0
- package/dist/components/chat-components/ui/icons.mjs +5 -0
- package/dist/components/chat-components/ui/icons.mjs.map +1 -0
- package/dist/components/chat-components/ui/input.d.ts +7 -0
- package/dist/components/chat-components/ui/input.mjs +23 -0
- package/dist/components/chat-components/ui/input.mjs.map +1 -0
- package/dist/components/chat-components/ui/label.d.ts +8 -0
- package/dist/components/chat-components/ui/label.mjs +22 -0
- package/dist/components/chat-components/ui/label.mjs.map +1 -0
- package/dist/components/chat-components/ui/select.d.ts +13 -0
- package/dist/components/chat-components/ui/select.mjs +99 -0
- package/dist/components/chat-components/ui/select.mjs.map +1 -0
- package/dist/components/chat-components/ui/separator.d.ts +6 -0
- package/dist/components/chat-components/ui/separator.mjs +5 -0
- package/dist/components/chat-components/ui/separator.mjs.map +1 -0
- package/dist/components/chat-components/ui/sheet.d.ts +19 -0
- package/dist/components/chat-components/ui/sheet.mjs +109 -0
- package/dist/components/chat-components/ui/sheet.mjs.map +1 -0
- package/dist/components/chat-components/ui/switch.d.ts +6 -0
- package/dist/components/chat-components/ui/switch.mjs +27 -0
- package/dist/components/chat-components/ui/switch.mjs.map +1 -0
- package/dist/components/chat-components/ui/textarea.d.ts +7 -0
- package/dist/components/chat-components/ui/textarea.mjs +22 -0
- package/dist/components/chat-components/ui/textarea.mjs.map +1 -0
- package/dist/components/chat-components/ui/tooltip.d.ts +9 -0
- package/dist/components/chat-components/ui/tooltip.mjs +5 -0
- package/dist/components/chat-components/ui/tooltip.mjs.map +1 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.mjs +26 -0
- package/dist/components/index.mjs.map +1 -0
- package/dist/components/sidebar/copilot-sidebar-ui-provider.d.ts +8 -0
- package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs +25 -0
- package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs.map +1 -0
- package/dist/components/sidebar/copilot-sidebar.d.ts +6 -0
- package/dist/components/sidebar/copilot-sidebar.mjs +23 -0
- package/dist/components/sidebar/copilot-sidebar.mjs.map +1 -0
- package/dist/components/sidebar/sidebar-context.d.ts +9 -0
- package/dist/components/sidebar/sidebar-context.mjs +4 -0
- package/dist/components/sidebar/sidebar-context.mjs.map +1 -0
- package/dist/context/index.d.ts +1 -0
- package/dist/context/index.mjs +3 -0
- package/dist/context/index.mjs.map +1 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.mjs +3 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/hooks/use-at-bottom.d.ts +3 -0
- package/dist/hooks/use-at-bottom.mjs +4 -0
- package/dist/hooks/use-at-bottom.mjs.map +1 -0
- package/dist/hooks/use-copy-to-clipboard.d.ts +9 -0
- package/dist/hooks/use-copy-to-clipboard.mjs +4 -0
- package/dist/hooks/use-copy-to-clipboard.mjs.map +1 -0
- package/dist/hooks/use-enter-submit.d.ts +8 -0
- package/dist/hooks/use-enter-submit.mjs +4 -0
- package/dist/hooks/use-enter-submit.mjs.map +1 -0
- package/dist/index.css +1249 -1
- package/dist/index.css.map +1 -0
- package/dist/index.d.ts +9 -2
- package/dist/index.mjs +29 -0
- package/dist/index.mjs.map +1 -0
- package/dist/lib/utils.d.ts +8 -0
- package/dist/lib/utils.mjs +4 -0
- package/dist/lib/utils.mjs.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.mjs +3 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/types.d.ts +16 -0
- package/dist/types/types.mjs +3 -0
- package/dist/types/types.mjs.map +1 -0
- package/package.json +39 -8
- package/src/components/chat-components/chat-list.tsx +32 -0
- package/src/components/chat-components/chat-message-actions.tsx +40 -0
- package/src/components/chat-components/chat-message.tsx +74 -0
- package/src/components/chat-components/chat-panel.tsx +77 -0
- package/src/components/chat-components/chat-scroll-anchor.tsx +29 -0
- package/src/components/chat-components/clear-history.tsx +73 -0
- package/src/components/chat-components/copilot-chat.tsx +56 -0
- package/src/components/chat-components/default-empty-screen.tsx +64 -0
- package/src/components/chat-components/external-link.tsx +29 -0
- package/src/components/chat-components/markdown.tsx +9 -0
- package/src/components/chat-components/prompt-form.tsx +91 -0
- package/src/components/chat-components/theme-toggle.tsx +31 -0
- package/src/components/chat-components/toaster.tsx +3 -0
- package/src/components/chat-components/ui/alert-dialog.tsx +150 -0
- package/src/components/chat-components/ui/badge.tsx +36 -0
- package/src/components/chat-components/ui/button.tsx +57 -0
- package/src/components/chat-components/ui/codeblock.tsx +142 -0
- package/src/components/chat-components/ui/dialog.tsx +128 -0
- package/src/components/chat-components/ui/dropdown-menu.tsx +128 -0
- package/src/components/chat-components/ui/icons.tsx +507 -0
- package/src/components/chat-components/ui/input.tsx +25 -0
- package/src/components/chat-components/ui/label.tsx +26 -0
- package/src/components/chat-components/ui/select.tsx +119 -0
- package/src/components/chat-components/ui/separator.tsx +31 -0
- package/src/components/chat-components/ui/sheet.tsx +122 -0
- package/src/components/chat-components/ui/switch.tsx +29 -0
- package/src/components/chat-components/ui/textarea.tsx +24 -0
- package/src/components/chat-components/ui/tooltip.tsx +30 -0
- package/src/components/index.ts +7 -0
- package/src/components/sidebar/copilot-sidebar-ui-provider.tsx +77 -0
- package/src/components/sidebar/copilot-sidebar.tsx +40 -0
- package/src/components/sidebar/sidebar-context.tsx +11 -0
- package/src/context/index.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-at-bottom.tsx +23 -0
- package/src/hooks/use-copy-to-clipboard.tsx +33 -0
- package/src/hooks/use-enter-submit.tsx +23 -0
- package/src/index.tsx +4 -3
- package/src/lib/utils.ts +43 -0
- package/src/types/index.ts +1 -0
- package/src/types/types.ts +18 -0
- package/tailwind.config.js +1 -1
- package/tsconfig.json +1 -1
- package/tsup.config.ts +3 -4
- package/dist/Button.d.ts +0 -3
- package/dist/Button.js +0 -10
- package/dist/Card.d.ts +0 -7
- package/dist/Card.js +0 -10
- package/dist/chunk-6OZR7L23.js +0 -7
- package/dist/chunk-FGO3LSHH.js +0 -7
- package/dist/index.js +0 -15
- package/src/Button.tsx +0 -16
- package/src/Card.tsx +0 -27
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
var __async = (__this, __arguments, generator) => {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
var fulfilled = (value) => {
|
|
35
|
+
try {
|
|
36
|
+
step(generator.next(value));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var rejected = (value) => {
|
|
42
|
+
try {
|
|
43
|
+
step(generator.throw(value));
|
|
44
|
+
} catch (e) {
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export { __async, __objRest, __spreadProps, __spreadValues };
|
|
54
|
+
//# sourceMappingURL=out.js.map
|
|
55
|
+
//# sourceMappingURL=chunk-MRXNTQOX.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
// src/hooks/use-at-bottom.tsx
|
|
4
|
+
function useAtBottom(offset = 0) {
|
|
5
|
+
const [isAtBottom, setIsAtBottom] = React.useState(false);
|
|
6
|
+
React.useEffect(() => {
|
|
7
|
+
const handleScroll = () => {
|
|
8
|
+
setIsAtBottom(
|
|
9
|
+
window.innerHeight + window.scrollY >= document.body.offsetHeight - offset
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
window.addEventListener("scroll", handleScroll, { passive: true });
|
|
13
|
+
handleScroll();
|
|
14
|
+
return () => {
|
|
15
|
+
window.removeEventListener("scroll", handleScroll);
|
|
16
|
+
};
|
|
17
|
+
}, [offset]);
|
|
18
|
+
return isAtBottom;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { useAtBottom };
|
|
22
|
+
//# sourceMappingURL=out.js.map
|
|
23
|
+
//# sourceMappingURL=chunk-N7KB3Z57.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/hooks/use-at-bottom.tsx"],"names":[],"mappings":";AAAA,YAAY,WAAW;AAEhB,SAAS,YAAY,SAAS,GAAG;AACtC,QAAM,CAAC,YAAY,aAAa,IAAU,eAAS,KAAK;AAExD,EAAM,gBAAU,MAAM;AACpB,UAAM,eAAe,MAAM;AACzB;AAAA,QACE,OAAO,cAAc,OAAO,WAC1B,SAAS,KAAK,eAAe;AAAA,MACjC;AAAA,IACF;AAEA,WAAO,iBAAiB,UAAU,cAAc,EAAE,SAAS,KAAK,CAAC;AACjE,iBAAa;AAEb,WAAO,MAAM;AACX,aAAO,oBAAoB,UAAU,YAAY;AAAA,IACnD;AAAA,EACF,GAAG,CAAC,MAAM,CAAC;AAEX,SAAO;AACT","sourcesContent":["import * as React from \"react\";\n\nexport function useAtBottom(offset = 0) {\n const [isAtBottom, setIsAtBottom] = React.useState(false);\n\n React.useEffect(() => {\n const handleScroll = () => {\n setIsAtBottom(\n window.innerHeight + window.scrollY >=\n document.body.offsetHeight - offset\n );\n };\n\n window.addEventListener(\"scroll\", handleScroll, { passive: true });\n handleScroll();\n\n return () => {\n window.removeEventListener(\"scroll\", handleScroll);\n };\n }, [offset]);\n\n return isAtBottom;\n}\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { CodeBlock } from './chunk-VQNV2DHJ.mjs';
|
|
2
|
+
import { MemoizedReactMarkdown } from './chunk-6LRNF2VU.mjs';
|
|
3
|
+
import { ChatMessageActions } from './chunk-E5BOIXYO.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-QEXWZWJL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { useAtBottom } from './chunk-N7KB3Z57.mjs';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useInView } from 'react-intersection-observer';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
function ChatScrollAnchor({ trackVisibility }) {
|
|
7
|
+
const isAtBottom = useAtBottom();
|
|
8
|
+
const { ref, entry, inView } = useInView({
|
|
9
|
+
trackVisibility,
|
|
10
|
+
delay: 100,
|
|
11
|
+
rootMargin: "0px 0px -150px 0px"
|
|
12
|
+
});
|
|
13
|
+
React.useEffect(() => {
|
|
14
|
+
if (isAtBottom && trackVisibility && !inView) {
|
|
15
|
+
entry == null ? void 0 : entry.target.scrollIntoView({
|
|
16
|
+
block: "start"
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}, [inView, entry, isAtBottom, trackVisibility]);
|
|
20
|
+
return /* @__PURE__ */ jsx("div", {
|
|
21
|
+
ref,
|
|
22
|
+
className: "h-px w-full"
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { ChatScrollAnchor };
|
|
27
|
+
//# sourceMappingURL=out.js.map
|
|
28
|
+
//# sourceMappingURL=chunk-RSONJDLO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat-components/chat-scroll-anchor.tsx"],"names":[],"mappings":";;;;;AAEA,YAAY,WAAW;AACvB,SAAS,iBAAiB;AAwBjB;AA3BT;AAWO,SAAS,iBAAiB,EAAE,gBAAgB,GAA0B;AAC3E,QAAM,aAAa,YAAY;AAC/B,QAAM,EAAE,KAAK,OAAO,OAAO,IAAI,UAAU;AAAA,IACvC;AAAA,IACA,OAAO;AAAA,IACP,YAAY;AAAA,EACd,CAAC;AAED,EAAM,gBAAU,MAAM;AACpB,QAAI,cAAc,mBAAmB,CAAC,QAAQ;AAC5C,qCAAO,OAAO,eAAe;AAAA,QAC3B,OAAO;AAAA,MACT;AAAA,IACF;AAAA,EACF,GAAG,CAAC,QAAQ,OAAO,YAAY,eAAe,CAAC;AAE/C,SAAO,oBAAC;AAAA,IAAI;AAAA,IAAU,WAAU;AAAA,GAAc;AAChD","sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { useInView } from \"react-intersection-observer\";\n\nimport { useAtBottom } from \"../../hooks/use-at-bottom\";\n\ninterface ChatScrollAnchorProps {\n trackVisibility?: boolean;\n}\n\nexport function ChatScrollAnchor({ trackVisibility }: ChatScrollAnchorProps) {\n const isAtBottom = useAtBottom();\n const { ref, entry, inView } = useInView({\n trackVisibility,\n delay: 100,\n rootMargin: \"0px 0px -150px 0px\",\n });\n\n React.useEffect(() => {\n if (isAtBottom && trackVisibility && !inView) {\n entry?.target.scrollIntoView({\n block: \"start\",\n });\n }\n }, [inView, entry, isAtBottom, trackVisibility]);\n\n return <div ref={ref} className=\"h-px w-full\" />;\n}\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { CopilotChat } from './chunk-XZFO2YEG.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-SF56HSZW.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { __async } from './chunk-MRXNTQOX.mjs';
|
|
2
|
+
import { clsx } from 'clsx';
|
|
3
|
+
import { customAlphabet } from 'nanoid';
|
|
4
|
+
import { twMerge } from 'tailwind-merge';
|
|
5
|
+
|
|
6
|
+
function cn(...inputs) {
|
|
7
|
+
return twMerge(clsx(inputs));
|
|
8
|
+
}
|
|
9
|
+
var nanoid = customAlphabet(
|
|
10
|
+
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
11
|
+
7
|
|
12
|
+
);
|
|
13
|
+
function fetcher(input, init) {
|
|
14
|
+
return __async(this, null, function* () {
|
|
15
|
+
const res = yield fetch(input, init);
|
|
16
|
+
if (!res.ok) {
|
|
17
|
+
const json = yield res.json();
|
|
18
|
+
if (json.error) {
|
|
19
|
+
const error = new Error(json.error);
|
|
20
|
+
error.status = res.status;
|
|
21
|
+
throw error;
|
|
22
|
+
} else {
|
|
23
|
+
throw new Error("An unexpected error occurred");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return res.json();
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function formatDate(input) {
|
|
30
|
+
const date = new Date(input);
|
|
31
|
+
return date.toLocaleDateString("en-US", {
|
|
32
|
+
month: "long",
|
|
33
|
+
day: "numeric",
|
|
34
|
+
year: "numeric"
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { cn, fetcher, formatDate, nanoid };
|
|
39
|
+
//# sourceMappingURL=out.js.map
|
|
40
|
+
//# sourceMappingURL=chunk-TVTG3V4F.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/lib/utils.ts"],"names":[],"mappings":";;;;;AAAA,SAAS,YAA6B;AACtC,SAAS,sBAAsB;AAC/B,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;AAEO,IAAM,SAAS;AAAA,EACpB;AAAA,EACA;AACF;AAEA,SAAsB,QACpB,OACA,MACe;AAAA;AACf,UAAM,MAAM,MAAM,MAAM,OAAO,IAAI;AAEnC,QAAI,CAAC,IAAI,IAAI;AACX,YAAM,OAAO,MAAM,IAAI,KAAK;AAC5B,UAAI,KAAK,OAAO;AACd,cAAM,QAAQ,IAAI,MAAM,KAAK,KAAK;AAGlC,cAAM,SAAS,IAAI;AACnB,cAAM;AAAA,MACR,OAAO;AACL,cAAM,IAAI,MAAM,8BAA8B;AAAA,MAChD;AAAA,IACF;AAEA,WAAO,IAAI,KAAK;AAAA,EAClB;AAAA;AAEO,SAAS,WAAW,OAAuC;AAChE,QAAM,OAAO,IAAI,KAAK,KAAK;AAC3B,SAAO,KAAK,mBAAmB,SAAS;AAAA,IACtC,OAAO;AAAA,IACP,KAAK;AAAA,IACL,MAAM;AAAA,EACR,CAAC;AACH","sourcesContent":["import { clsx, type ClassValue } from \"clsx\";\nimport { customAlphabet } from \"nanoid\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const nanoid = customAlphabet(\n \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\",\n 7\n); // 7-character random string\n\nexport async function fetcher<JSON = any>(\n input: RequestInfo,\n init?: RequestInit\n): Promise<JSON> {\n const res = await fetch(input, init);\n\n if (!res.ok) {\n const json = await res.json();\n if (json.error) {\n const error = new Error(json.error) as Error & {\n status: number;\n };\n error.status = res.status;\n throw error;\n } else {\n throw new Error(\"An unexpected error occurred\");\n }\n }\n\n return res.json();\n}\n\nexport function formatDate(input: string | number | Date): string {\n const date = new Date(input);\n return date.toLocaleDateString(\"en-US\", {\n month: \"long\",\n day: \"numeric\",\n year: \"numeric\",\n });\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { cn } from './chunk-TVTG3V4F.mjs';
|
|
2
|
+
import { __objRest, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
5
|
+
import { cva } from 'class-variance-authority';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var buttonVariants = cva(
|
|
9
|
+
"inline-flex items-center justify-center rounded-md text-sm font-medium shadow ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default: "bg-primary text-primary-foreground shadow-md hover:bg-primary/90",
|
|
14
|
+
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
15
|
+
outline: "border border-input hover:bg-accent hover:text-accent-foreground",
|
|
16
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
17
|
+
ghost: "shadow-none hover:bg-accent hover:text-accent-foreground",
|
|
18
|
+
link: "text-primary underline-offset-4 shadow-none hover:underline"
|
|
19
|
+
},
|
|
20
|
+
size: {
|
|
21
|
+
default: "h-8 px-4 py-2",
|
|
22
|
+
sm: "h-8 rounded-md px-3",
|
|
23
|
+
lg: "h-11 rounded-md px-8",
|
|
24
|
+
icon: "h-8 w-8 p-0"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
defaultVariants: {
|
|
28
|
+
variant: "default",
|
|
29
|
+
size: "default"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
var Button = React.forwardRef(
|
|
34
|
+
(_a, ref) => {
|
|
35
|
+
var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
|
|
36
|
+
const Comp = asChild ? Slot : "button";
|
|
37
|
+
return /* @__PURE__ */ jsx(Comp, __spreadValues({
|
|
38
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
39
|
+
ref
|
|
40
|
+
}, props));
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
Button.displayName = "Button";
|
|
44
|
+
|
|
45
|
+
export { Button, buttonVariants };
|
|
46
|
+
//# sourceMappingURL=out.js.map
|
|
47
|
+
//# sourceMappingURL=chunk-V6QYUEJR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat-components/ui/button.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,YAAY,WAAW;AACvB,SAAS,YAAY;AACrB,SAAS,WAA8B;AA4CjC;AAxCN,IAAM,iBAAiB;AAAA,EACrB;AAAA,EACA;AAAA,IACE,UAAU;AAAA,MACR,SAAS;AAAA,QACP,SACE;AAAA,QACF,aACE;AAAA,QACF,SACE;AAAA,QACF,WACE;AAAA,QACF,OAAO;AAAA,QACP,MAAM;AAAA,MACR;AAAA,MACA,MAAM;AAAA,QACJ,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,MAAM;AAAA,MACR;AAAA,IACF;AAAA,IACA,iBAAiB;AAAA,MACf,SAAS;AAAA,MACT,MAAM;AAAA,IACR;AAAA,EACF;AACF;AAQA,IAAM,SAAe;AAAA,EACnB,CAAC,IAAyD,QAAQ;AAAjE,iBAAE,aAAW,SAAS,MAAM,UAAU,MA3CzC,IA2CG,IAAgD,kBAAhD,IAAgD,CAA9C,aAAW,WAAS,QAAM;AAC3B,UAAM,OAAO,UAAU,OAAO;AAC9B,WACE,oBAAC;AAAA,MACC,WAAW,GAAG,eAAe,EAAE,SAAS,MAAM,UAAU,CAAC,CAAC;AAAA,MAC1D;AAAA,OACI,MACN;AAAA,EAEJ;AACF;AACA,OAAO,cAAc","sourcesContent":["import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../../lib/utils\";\n\nconst buttonVariants = cva(\n \"inline-flex items-center justify-center rounded-md text-sm font-medium shadow ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50\",\n {\n variants: {\n variant: {\n default:\n \"bg-primary text-primary-foreground shadow-md hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline:\n \"border border-input hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"shadow-none hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 shadow-none hover:underline\",\n },\n size: {\n default: \"h-8 px-4 py-2\",\n sm: \"h-8 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"h-8 w-8 p-0\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n }\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n"]}
|
|
@@ -0,0 +1,142 @@
|
|
|
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 { coldarkDark } from 'react-syntax-highlighter/dist/cjs/styles/prism';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var programmingLanguages = {
|
|
10
|
+
javascript: ".js",
|
|
11
|
+
python: ".py",
|
|
12
|
+
java: ".java",
|
|
13
|
+
c: ".c",
|
|
14
|
+
cpp: ".cpp",
|
|
15
|
+
"c++": ".cpp",
|
|
16
|
+
"c#": ".cs",
|
|
17
|
+
ruby: ".rb",
|
|
18
|
+
php: ".php",
|
|
19
|
+
swift: ".swift",
|
|
20
|
+
"objective-c": ".m",
|
|
21
|
+
kotlin: ".kt",
|
|
22
|
+
typescript: ".ts",
|
|
23
|
+
go: ".go",
|
|
24
|
+
perl: ".pl",
|
|
25
|
+
rust: ".rs",
|
|
26
|
+
scala: ".scala",
|
|
27
|
+
haskell: ".hs",
|
|
28
|
+
lua: ".lua",
|
|
29
|
+
shell: ".sh",
|
|
30
|
+
sql: ".sql",
|
|
31
|
+
html: ".html",
|
|
32
|
+
css: ".css"
|
|
33
|
+
};
|
|
34
|
+
var generateRandomString = (length, lowercase = false) => {
|
|
35
|
+
const chars = "ABCDEFGHJKLMNPQRSTUVWXY3456789";
|
|
36
|
+
let result = "";
|
|
37
|
+
for (let i = 0; i < length; i++) {
|
|
38
|
+
result += chars.charAt(Math.floor(Math.random() * chars.length));
|
|
39
|
+
}
|
|
40
|
+
return lowercase ? result.toLowerCase() : result;
|
|
41
|
+
};
|
|
42
|
+
var CodeBlock = memo(({ language, value }) => {
|
|
43
|
+
const { isCopied, copyToClipboard } = useCopyToClipboard({ timeout: 2e3 });
|
|
44
|
+
const downloadAsFile = () => {
|
|
45
|
+
if (typeof window === "undefined") {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const fileExtension = programmingLanguages[language] || ".file";
|
|
49
|
+
const suggestedFileName = `file-${generateRandomString(
|
|
50
|
+
3,
|
|
51
|
+
true
|
|
52
|
+
)}${fileExtension}`;
|
|
53
|
+
const fileName = window.prompt("Enter file name", suggestedFileName);
|
|
54
|
+
if (!fileName) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const blob = new Blob([value], { type: "text/plain" });
|
|
58
|
+
const url = URL.createObjectURL(blob);
|
|
59
|
+
const link = document.createElement("a");
|
|
60
|
+
link.download = fileName;
|
|
61
|
+
link.href = url;
|
|
62
|
+
link.style.display = "none";
|
|
63
|
+
document.body.appendChild(link);
|
|
64
|
+
link.click();
|
|
65
|
+
document.body.removeChild(link);
|
|
66
|
+
URL.revokeObjectURL(url);
|
|
67
|
+
};
|
|
68
|
+
const onCopy = () => {
|
|
69
|
+
if (isCopied)
|
|
70
|
+
return;
|
|
71
|
+
copyToClipboard(value);
|
|
72
|
+
};
|
|
73
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
74
|
+
className: "codeblock relative w-full bg-zinc-950 font-sans",
|
|
75
|
+
children: [
|
|
76
|
+
/* @__PURE__ */ jsxs("div", {
|
|
77
|
+
className: "flex w-full items-center justify-between bg-zinc-800 px-6 py-2 pr-4 text-zinc-100",
|
|
78
|
+
children: [
|
|
79
|
+
/* @__PURE__ */ jsx("span", {
|
|
80
|
+
className: "text-xs lowercase",
|
|
81
|
+
children: language
|
|
82
|
+
}),
|
|
83
|
+
/* @__PURE__ */ jsxs("div", {
|
|
84
|
+
className: "flex items-center space-x-1",
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
87
|
+
variant: "ghost",
|
|
88
|
+
className: "hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",
|
|
89
|
+
onClick: downloadAsFile,
|
|
90
|
+
size: "icon",
|
|
91
|
+
children: [
|
|
92
|
+
/* @__PURE__ */ jsx(IconDownload, {}),
|
|
93
|
+
/* @__PURE__ */ jsx("span", {
|
|
94
|
+
className: "sr-only",
|
|
95
|
+
children: "Download"
|
|
96
|
+
})
|
|
97
|
+
]
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ jsxs(Button, {
|
|
100
|
+
variant: "ghost",
|
|
101
|
+
size: "icon",
|
|
102
|
+
className: "text-xs hover:bg-zinc-800 focus-visible:ring-1 focus-visible:ring-slate-700 focus-visible:ring-offset-0",
|
|
103
|
+
onClick: onCopy,
|
|
104
|
+
children: [
|
|
105
|
+
isCopied ? /* @__PURE__ */ jsx(IconCheck, {}) : /* @__PURE__ */ jsx(IconCopy, {}),
|
|
106
|
+
/* @__PURE__ */ jsx("span", {
|
|
107
|
+
className: "sr-only",
|
|
108
|
+
children: "Copy code"
|
|
109
|
+
})
|
|
110
|
+
]
|
|
111
|
+
})
|
|
112
|
+
]
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}),
|
|
116
|
+
/* @__PURE__ */ jsx(Prism, {
|
|
117
|
+
language,
|
|
118
|
+
style: coldarkDark,
|
|
119
|
+
PreTag: "div",
|
|
120
|
+
showLineNumbers: true,
|
|
121
|
+
customStyle: {
|
|
122
|
+
margin: 0,
|
|
123
|
+
width: "100%",
|
|
124
|
+
background: "transparent",
|
|
125
|
+
padding: "1.5rem 1rem"
|
|
126
|
+
},
|
|
127
|
+
codeTagProps: {
|
|
128
|
+
style: {
|
|
129
|
+
fontSize: "0.9rem",
|
|
130
|
+
fontFamily: "var(--font-mono)"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
children: value
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
CodeBlock.displayName = "CodeBlock";
|
|
139
|
+
|
|
140
|
+
export { CodeBlock, generateRandomString, programmingLanguages };
|
|
141
|
+
//# sourceMappingURL=out.js.map
|
|
142
|
+
//# sourceMappingURL=chunk-VQNV2DHJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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\";\nimport { coldarkDark } from \"react-syntax-highlighter/dist/cjs/styles/prism\";\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 style={coldarkDark}\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"]}
|
|
@@ -0,0 +1,74 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|