@copilotkit/react-ui 0.9.0-alpha.6 → 0.9.0-alpha.7
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 +139 -157
- package/CHANGELOG.md +10 -0
- package/dist/chunk-2NO6SF5H.mjs +53 -0
- package/dist/chunk-2NO6SF5H.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-6UJWRTL6.mjs +45 -0
- package/dist/chunk-6UJWRTL6.mjs.map +1 -0
- package/dist/chunk-7KPMJBGH.mjs +48 -0
- package/dist/chunk-7KPMJBGH.mjs.map +1 -0
- package/dist/chunk-7NSRDJ5C.mjs +3 -0
- package/dist/chunk-7NSRDJ5C.mjs.map +1 -0
- package/dist/chunk-APH6ZQHG.mjs +69 -0
- package/dist/chunk-APH6ZQHG.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-H4VKQGVU.mjs +3 -0
- package/dist/chunk-H4VKQGVU.mjs.map +1 -0
- package/dist/chunk-HKSY5T7Y.mjs +140 -0
- package/dist/chunk-HKSY5T7Y.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-LMCFSE4V.mjs +29 -0
- package/dist/chunk-LMCFSE4V.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-RSONJDLO.mjs +28 -0
- package/dist/chunk-RSONJDLO.mjs.map +1 -0
- package/dist/chunk-TUPGAO7T.mjs +72 -0
- package/dist/chunk-TUPGAO7T.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-UKKJ6H2K.mjs +90 -0
- package/dist/chunk-UKKJ6H2K.mjs.map +1 -0
- package/dist/chunk-V6QYUEJR.mjs +47 -0
- package/dist/chunk-V6QYUEJR.mjs.map +1 -0
- package/dist/chunk-VSNDSL6W.mjs +74 -0
- package/dist/chunk-VSNDSL6W.mjs.map +1 -0
- package/dist/chunk-ZB6JHNDT.mjs +75 -0
- package/dist/chunk-ZB6JHNDT.mjs.map +1 -0
- package/dist/components/chat-components/chat-list.mjs +12 -488
- package/dist/components/chat-components/chat-list.mjs.map +1 -1
- package/dist/components/chat-components/chat-message-actions.mjs +7 -184
- package/dist/components/chat-components/chat-message-actions.mjs.map +1 -1
- package/dist/components/chat-components/chat-message.mjs +10 -440
- package/dist/components/chat-components/chat-message.mjs.map +1 -1
- package/dist/components/chat-components/chat-panel.mjs +9 -334
- package/dist/components/chat-components/chat-panel.mjs.map +1 -1
- package/dist/components/chat-components/chat-scroll-anchor.mjs +4 -48
- package/dist/components/chat-components/chat-scroll-anchor.mjs.map +1 -1
- package/dist/components/chat-components/clear-history.mjs +26 -268
- package/dist/components/chat-components/clear-history.mjs.map +1 -1
- package/dist/components/chat-components/copilot-chat.mjs +21 -931
- package/dist/components/chat-components/copilot-chat.mjs.map +1 -1
- package/dist/components/chat-components/default-empty-screen.mjs +7 -206
- package/dist/components/chat-components/default-empty-screen.mjs.map +1 -1
- package/dist/components/chat-components/external-link.mjs +3 -31
- package/dist/components/chat-components/external-link.mjs.map +1 -1
- package/dist/components/chat-components/markdown.mjs +3 -10
- package/dist/components/chat-components/markdown.mjs.map +1 -1
- package/dist/components/chat-components/prompt-form.mjs +8 -246
- package/dist/components/chat-components/prompt-form.mjs.map +1 -1
- package/dist/components/chat-components/theme-toggle.mjs +15 -133
- package/dist/components/chat-components/theme-toggle.mjs.map +1 -1
- package/dist/components/chat-components/toaster.mjs +3 -6
- package/dist/components/chat-components/toaster.mjs.map +1 -1
- package/dist/components/chat-components/ui/alert-dialog.mjs +5 -216
- package/dist/components/chat-components/ui/alert-dialog.mjs.map +1 -1
- package/dist/components/chat-components/ui/badge.mjs +7 -49
- package/dist/components/chat-components/ui/badge.mjs.map +1 -1
- package/dist/components/chat-components/ui/button.mjs +4 -88
- package/dist/components/chat-components/ui/button.mjs.map +1 -1
- package/dist/components/chat-components/ui/codeblock.mjs +7 -298
- package/dist/components/chat-components/ui/codeblock.mjs.map +1 -1
- package/dist/components/chat-components/ui/dialog.mjs +26 -94
- package/dist/components/chat-components/ui/dialog.mjs.map +1 -1
- package/dist/components/chat-components/ui/dropdown-menu.mjs +8 -61
- package/dist/components/chat-components/ui/dropdown-menu.mjs.map +1 -1
- package/dist/components/chat-components/ui/icons.mjs +4 -551
- package/dist/components/chat-components/ui/icons.mjs.map +1 -1
- package/dist/components/chat-components/ui/input.mjs +7 -48
- package/dist/components/chat-components/ui/input.mjs.map +1 -1
- package/dist/components/chat-components/ui/label.mjs +9 -51
- package/dist/components/chat-components/ui/label.mjs.map +1 -1
- package/dist/components/chat-components/ui/select.mjs +27 -113
- package/dist/components/chat-components/ui/select.mjs.map +1 -1
- package/dist/components/chat-components/ui/separator.mjs +4 -67
- package/dist/components/chat-components/ui/separator.mjs.map +1 -1
- package/dist/components/chat-components/ui/sheet.mjs +24 -93
- package/dist/components/chat-components/ui/sheet.mjs.map +1 -1
- package/dist/components/chat-components/ui/switch.mjs +8 -53
- package/dist/components/chat-components/ui/switch.mjs.map +1 -1
- package/dist/components/chat-components/ui/textarea.mjs +7 -48
- package/dist/components/chat-components/ui/textarea.mjs.map +1 -1
- package/dist/components/chat-components/ui/tooltip.mjs +4 -69
- package/dist/components/chat-components/ui/tooltip.mjs.map +1 -1
- package/dist/components/index.mjs +25 -1057
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs +24 -1052
- package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs.map +1 -1
- package/dist/components/sidebar/copilot-sidebar.mjs +22 -974
- package/dist/components/sidebar/copilot-sidebar.mjs.map +1 -1
- package/dist/components/sidebar/sidebar-context.mjs +3 -10
- package/dist/components/sidebar/sidebar-context.mjs.map +1 -1
- package/dist/context/index.mjs +2 -0
- package/dist/context/index.mjs.map +1 -1
- package/dist/hooks/index.mjs +2 -0
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/use-at-bottom.mjs +3 -21
- package/dist/hooks/use-at-bottom.mjs.map +1 -1
- package/dist/hooks/use-copy-to-clipboard.mjs +3 -27
- package/dist/hooks/use-copy-to-clipboard.mjs.map +1 -1
- package/dist/hooks/use-enter-submit.mjs +3 -16
- package/dist/hooks/use-enter-submit.mjs.map +1 -1
- package/dist/index.mjs +28 -1057
- package/dist/index.mjs.map +1 -1
- package/dist/lib/utils.mjs +3 -62
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/lib/utils.test.mjs +1 -0
- package/dist/lib/utils.test.mjs.map +1 -1
- package/dist/types/index.mjs +2 -0
- package/dist/types/index.mjs.map +1 -1
- package/dist/types/types.mjs +2 -0
- package/dist/types/types.mjs.map +1 -1
- package/package.json +2 -2
|
@@ -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,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,72 @@
|
|
|
1
|
+
import { CopilotSidebar } from './chunk-7KPMJBGH.mjs';
|
|
2
|
+
import { CopilotSidebarContext } from './chunk-MC6KTH4X.mjs';
|
|
3
|
+
import { TooltipProvider } from './chunk-BS6RR2DJ.mjs';
|
|
4
|
+
import { useState, useCallback } from 'react';
|
|
5
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
function CopilotSidebarUIProvider({
|
|
8
|
+
children
|
|
9
|
+
}) {
|
|
10
|
+
const [sidebarOpen, setSidebarOpen] = useState(true);
|
|
11
|
+
const toggleSidebar = useCallback(() => {
|
|
12
|
+
setSidebarOpen((prev) => !prev);
|
|
13
|
+
}, []);
|
|
14
|
+
return /* @__PURE__ */ jsx(CopilotSidebarContext.Provider, {
|
|
15
|
+
value: { isSidebarOpen: sidebarOpen, toggleSidebar },
|
|
16
|
+
children: /* @__PURE__ */ jsx(Fragment, {
|
|
17
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
18
|
+
style: {
|
|
19
|
+
height: "100vh",
|
|
20
|
+
width: "100vw",
|
|
21
|
+
position: "relative"
|
|
22
|
+
},
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ jsx("div", {
|
|
25
|
+
style: {
|
|
26
|
+
overflowY: "auto",
|
|
27
|
+
overflowX: "hidden",
|
|
28
|
+
height: "100%",
|
|
29
|
+
width: sidebarOpen ? "calc(100% - 450px)" : "100%",
|
|
30
|
+
position: "absolute",
|
|
31
|
+
transition: "width 0.5s ease-in-out"
|
|
32
|
+
},
|
|
33
|
+
children: /* @__PURE__ */ jsx("main", {
|
|
34
|
+
children
|
|
35
|
+
})
|
|
36
|
+
}),
|
|
37
|
+
/* @__PURE__ */ jsx("div", {
|
|
38
|
+
style: {
|
|
39
|
+
overflowY: "auto",
|
|
40
|
+
height: "100%",
|
|
41
|
+
width: "450px",
|
|
42
|
+
position: "absolute",
|
|
43
|
+
right: sidebarOpen ? "0" : "-450px",
|
|
44
|
+
transition: "right 0.5s ease-in-out"
|
|
45
|
+
},
|
|
46
|
+
children: /* @__PURE__ */ jsx(TooltipProvider, {
|
|
47
|
+
children: /* @__PURE__ */ jsx(CopilotSidebar, {
|
|
48
|
+
setSidebarOpen
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
}),
|
|
52
|
+
!sidebarOpen && /* @__PURE__ */ jsx("button", {
|
|
53
|
+
onClick: toggleSidebar,
|
|
54
|
+
style: {
|
|
55
|
+
position: "absolute",
|
|
56
|
+
top: "5%",
|
|
57
|
+
right: "20px",
|
|
58
|
+
transform: "translateY(-50%)",
|
|
59
|
+
transition: "opacity 0.5s ease-in-out"
|
|
60
|
+
},
|
|
61
|
+
className: "bg-slate-100 ring-2 ring-slate-600 font-semibold text-black p-2 rounded-lg shadow-lg",
|
|
62
|
+
children: "Open Copilot"
|
|
63
|
+
})
|
|
64
|
+
]
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { CopilotSidebarUIProvider };
|
|
71
|
+
//# sourceMappingURL=out.js.map
|
|
72
|
+
//# sourceMappingURL=chunk-TUPGAO7T.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/sidebar/copilot-sidebar-ui-provider.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,SAA2B,mBAAmB;AAC9C,SAAS,gBAAgB;AAsBnB,mBAkBM,KAjBJ,YADF;AAbC,SAAS,yBAAyB;AAAA,EACvC;AACF,GAAkC;AAChC,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,IAAI;AAEnD,QAAM,gBAAgB,YAAY,MAAM;AACtC,mBAAe,CAAC,SAAS,CAAC,IAAI;AAAA,EAChC,GAAG,CAAC,CAAC;AAEL,SACE,oBAAC,sBAAsB,UAAtB;AAAA,IACC,OAAO,EAAE,eAAe,aAAa,cAAc;AAAA,IAEnD;AAAA,MACE,+BAAC;AAAA,QACC,OAAO;AAAA,UACL,QAAQ;AAAA,UACR,OAAO;AAAA,UACP,UAAU;AAAA,QACZ;AAAA,QAEA;AAAA,8BAAC;AAAA,YACC,OAAO;AAAA,cACL,WAAW;AAAA,cACX,WAAW;AAAA,cACX,QAAQ;AAAA,cACR,OAAO,cAAc,uBAAuB;AAAA,cAC5C,UAAU;AAAA,cACV,YAAY;AAAA,YACd;AAAA,YAEA,8BAAC;AAAA,cAAM;AAAA,aAAS;AAAA,WAClB;AAAA,UACA,oBAAC;AAAA,YACC,OAAO;AAAA,cACL,WAAW;AAAA,cACX,QAAQ;AAAA,cACR,OAAO;AAAA,cACP,UAAU;AAAA,cACV,OAAO,cAAc,MAAM;AAAA,cAC3B,YAAY;AAAA,YACd;AAAA,YAEA,8BAAC;AAAA,cACC,8BAAC;AAAA,gBAAe;AAAA,eAAgC;AAAA,aAClD;AAAA,WACF;AAAA,UACC,CAAC,eACA,oBAAC;AAAA,YACC,SAAS;AAAA,YACT,OAAO;AAAA,cACL,UAAU;AAAA,cACV,KAAK;AAAA,cACL,OAAO;AAAA,cACP,WAAW;AAAA,cACX,YAAY;AAAA,YACd;AAAA,YACA,WAAU;AAAA,YACX;AAAA,WAED;AAAA;AAAA,OAEJ;AAAA,KACF;AAAA,GACF;AAEJ","sourcesContent":["import React, { ReactNode, useCallback } from \"react\";\nimport { useState } from \"react\";\nimport { CopilotSidebar } from \"./copilot-sidebar\";\nimport { CopilotSidebarContext } from \"./sidebar-context\";\nimport { TooltipProvider } from \"../chat-components/ui/tooltip\";\n\nexport interface CopilotSidebarUIProviderProps {\n children: ReactNode;\n}\n\nexport function CopilotSidebarUIProvider({\n children,\n}: CopilotSidebarUIProviderProps) {\n const [sidebarOpen, setSidebarOpen] = useState(true);\n\n const toggleSidebar = useCallback(() => {\n setSidebarOpen((prev) => !prev);\n }, []);\n\n return (\n <CopilotSidebarContext.Provider\n value={{ isSidebarOpen: sidebarOpen, toggleSidebar }}\n >\n <>\n <div\n style={{\n height: \"100vh\",\n width: \"100vw\",\n position: \"relative\",\n }}\n >\n <div\n style={{\n overflowY: \"auto\",\n overflowX: \"hidden\",\n height: \"100%\",\n width: sidebarOpen ? \"calc(100% - 450px)\" : \"100%\",\n position: \"absolute\",\n transition: \"width 0.5s ease-in-out\", // New\n }}\n >\n <main>{children}</main>\n </div>\n <div\n style={{\n overflowY: \"auto\",\n height: \"100%\",\n width: \"450px\",\n position: \"absolute\",\n right: sidebarOpen ? \"0\" : \"-450px\",\n transition: \"right 0.5s ease-in-out\",\n }}\n >\n <TooltipProvider>\n <CopilotSidebar setSidebarOpen={setSidebarOpen} />\n </TooltipProvider>\n </div>\n {!sidebarOpen && (\n <button\n onClick={toggleSidebar}\n style={{\n position: \"absolute\",\n top: \"5%\",\n right: \"20px\",\n transform: \"translateY(-50%)\",\n transition: \"opacity 0.5s ease-in-out\",\n }}\n className=\"bg-slate-100 ring-2 ring-slate-600 font-semibold text-black p-2 rounded-lg shadow-lg\"\n >\n Open Copilot\n </button>\n )}\n </div>\n </>\n </CopilotSidebarContext.Provider>\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,90 @@
|
|
|
1
|
+
import { Tooltip, TooltipTrigger, TooltipContent } from './chunk-BS6RR2DJ.mjs';
|
|
2
|
+
import { Button } from './chunk-V6QYUEJR.mjs';
|
|
3
|
+
import { IconArrowElbow } from './chunk-KR7MH7XO.mjs';
|
|
4
|
+
import { useEnterSubmit } from './chunk-BIPCPNHG.mjs';
|
|
5
|
+
import { __async } from './chunk-MRXNTQOX.mjs';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import TextareaAutosize from 'react-textarea-autosize';
|
|
8
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
function PromptForm({
|
|
11
|
+
onSubmit,
|
|
12
|
+
input,
|
|
13
|
+
setInput,
|
|
14
|
+
isLoading
|
|
15
|
+
}) {
|
|
16
|
+
const { formRef, onKeyDown } = useEnterSubmit();
|
|
17
|
+
const inputRef = React.useRef(null);
|
|
18
|
+
React.useEffect(() => {
|
|
19
|
+
if (inputRef.current) {
|
|
20
|
+
inputRef.current.focus();
|
|
21
|
+
}
|
|
22
|
+
}, []);
|
|
23
|
+
return /* @__PURE__ */ jsx("form", {
|
|
24
|
+
onSubmit: (e) => __async(this, null, function* () {
|
|
25
|
+
e.preventDefault();
|
|
26
|
+
if (!(input == null ? void 0 : input.trim())) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
setInput("");
|
|
30
|
+
yield onSubmit(input);
|
|
31
|
+
}),
|
|
32
|
+
ref: formRef,
|
|
33
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
34
|
+
className: "relative flex max-h-60 w-full grow flex-col overflow-hidden bg-background px-8 sm:rounded-md border sm:px-12",
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ jsxs(Tooltip, {
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
39
|
+
asChild: true
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsx(TooltipContent, {
|
|
42
|
+
children: "New Chat"
|
|
43
|
+
})
|
|
44
|
+
]
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ jsx(TextareaAutosize, {
|
|
47
|
+
ref: inputRef,
|
|
48
|
+
tabIndex: 0,
|
|
49
|
+
onKeyDown,
|
|
50
|
+
rows: 1,
|
|
51
|
+
value: input,
|
|
52
|
+
onChange: (e) => setInput(e.target.value),
|
|
53
|
+
placeholder: "Send a message.",
|
|
54
|
+
spellCheck: false,
|
|
55
|
+
className: "min-h-[60px] w-full resize-none bg-transparent px-4 py-[1.3rem] focus-within:outline-none sm:text-sm"
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ jsx("div", {
|
|
58
|
+
className: "absolute right-0 top-4 sm:right-4",
|
|
59
|
+
children: /* @__PURE__ */ jsxs(Tooltip, {
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
62
|
+
asChild: true,
|
|
63
|
+
children: /* @__PURE__ */ jsxs(Button, {
|
|
64
|
+
type: "submit",
|
|
65
|
+
size: "icon",
|
|
66
|
+
disabled: isLoading || input === "",
|
|
67
|
+
className: " bg-slate-300",
|
|
68
|
+
children: [
|
|
69
|
+
/* @__PURE__ */ jsx(IconArrowElbow, {}),
|
|
70
|
+
/* @__PURE__ */ jsx("span", {
|
|
71
|
+
className: "sr-only",
|
|
72
|
+
children: "Send message"
|
|
73
|
+
})
|
|
74
|
+
]
|
|
75
|
+
})
|
|
76
|
+
}),
|
|
77
|
+
/* @__PURE__ */ jsx(TooltipContent, {
|
|
78
|
+
children: "Send message"
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
})
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
})
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export { PromptForm };
|
|
89
|
+
//# sourceMappingURL=out.js.map
|
|
90
|
+
//# sourceMappingURL=chunk-UKKJ6H2K.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat-components/prompt-form.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,YAAY,WAAW;AACvB,OAAO,sBAAsB;AA4CrB,SACE,KADF;AA5BD,SAAS,WAAW;AAAA,EACzB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAgB;AACd,QAAM,EAAE,SAAS,UAAU,IAAI,eAAe;AAC9C,QAAM,WAAiB,aAA4B,IAAI;AAEvD,EAAM,gBAAU,MAAM;AACpB,QAAI,SAAS,SAAS;AACpB,eAAS,QAAQ,MAAM;AAAA,IACzB;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SACE,oBAAC;AAAA,IACC,UAAU,CAAO,MAAM;AACrB,QAAE,eAAe;AACjB,UAAI,EAAC,+BAAO,SAAQ;AAClB;AAAA,MACF;AACA,eAAS,EAAE;AACX,YAAM,SAAS,KAAK;AAAA,IACtB;AAAA,IACA,KAAK;AAAA,IAEL,+BAAC;AAAA,MAAI,WAAU;AAAA,MACb;AAAA,6BAAC;AAAA,UACC;AAAA,gCAAC;AAAA,cAAe,SAAO;AAAA,aAWvB;AAAA,YACA,oBAAC;AAAA,cAAe;AAAA,aAAQ;AAAA;AAAA,SAC1B;AAAA,QACA,oBAAC;AAAA,UACC,KAAK;AAAA,UACL,UAAU;AAAA,UACV;AAAA,UACA,MAAM;AAAA,UACN,OAAO;AAAA,UACP,UAAU,CAAC,MAAM,SAAS,EAAE,OAAO,KAAK;AAAA,UACxC,aAAY;AAAA,UACZ,YAAY;AAAA,UACZ,WAAU;AAAA,SACZ;AAAA,QACA,oBAAC;AAAA,UAAI,WAAU;AAAA,UACb,+BAAC;AAAA,YACC;AAAA,kCAAC;AAAA,gBAAe,SAAO;AAAA,gBACrB,+BAAC;AAAA,kBACC,MAAK;AAAA,kBACL,MAAK;AAAA,kBACL,UAAU,aAAa,UAAU;AAAA,kBACjC,WAAU;AAAA,kBAEV;AAAA,wCAAC,kBAAe;AAAA,oBAChB,oBAAC;AAAA,sBAAK,WAAU;AAAA,sBAAU;AAAA,qBAAY;AAAA;AAAA,iBACxC;AAAA,eACF;AAAA,cACA,oBAAC;AAAA,gBAAe;AAAA,eAAY;AAAA;AAAA,WAC9B;AAAA,SACF;AAAA;AAAA,KACF;AAAA,GACF;AAEJ","sourcesContent":["import * as React from \"react\";\nimport TextareaAutosize from \"react-textarea-autosize\";\nimport { UseChatHelpers } from \"ai/react\";\n\nimport { useEnterSubmit } from \"../../hooks/use-enter-submit\";\nimport { cn } from \"../../lib/utils\";\nimport { Button, buttonVariants } from \"./ui/button\";\nimport { Tooltip, TooltipContent, TooltipTrigger } from \"./ui/tooltip\";\nimport { IconArrowElbow, IconPlus } from \"./ui/icons\";\n// import Link from \"next/link\";\n\nexport interface PromptProps\n extends Pick<UseChatHelpers, \"input\" | \"setInput\"> {\n onSubmit: (value: string) => Promise<void>;\n isLoading: boolean;\n}\n\nexport function PromptForm({\n onSubmit,\n input,\n setInput,\n isLoading,\n}: PromptProps) {\n const { formRef, onKeyDown } = useEnterSubmit();\n const inputRef = React.useRef<HTMLTextAreaElement>(null);\n\n React.useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n }\n }, []);\n\n return (\n <form\n onSubmit={async (e) => {\n e.preventDefault();\n if (!input?.trim()) {\n return;\n }\n setInput(\"\");\n await onSubmit(input);\n }}\n ref={formRef}\n >\n <div className=\"relative flex max-h-60 w-full grow flex-col overflow-hidden bg-background px-8 sm:rounded-md border sm:px-12\">\n <Tooltip>\n <TooltipTrigger asChild>\n {/* <Link\n href=\"/\"\n className={cn(\n buttonVariants({ size: \"sm\", variant: \"outline\" }),\n \"absolute left-0 top-4 h-8 w-8 rounded-full bg-background p-0 sm:left-4\"\n )}\n >\n <IconPlus />\n <span className=\"sr-only\">New Chat</span>\n </Link> */}\n </TooltipTrigger>\n <TooltipContent>New Chat</TooltipContent>\n </Tooltip>\n <TextareaAutosize\n ref={inputRef}\n tabIndex={0}\n onKeyDown={onKeyDown}\n rows={1}\n value={input}\n onChange={(e) => setInput(e.target.value)}\n placeholder=\"Send a message.\"\n spellCheck={false}\n className=\"min-h-[60px] w-full resize-none bg-transparent px-4 py-[1.3rem] focus-within:outline-none sm:text-sm\"\n />\n <div className=\"absolute right-0 top-4 sm:right-4\">\n <Tooltip>\n <TooltipTrigger asChild>\n <Button\n type=\"submit\"\n size=\"icon\"\n disabled={isLoading || input === \"\"}\n className=\" bg-slate-300\"\n >\n <IconArrowElbow />\n <span className=\"sr-only\">Send message</span>\n </Button>\n </TooltipTrigger>\n <TooltipContent>Send message</TooltipContent>\n </Tooltip>\n </div>\n </div>\n </form>\n );\n}\n"]}
|
|
@@ -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,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"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { CodeBlock } from './chunk-HKSY5T7Y.mjs';
|
|
2
|
+
import { MemoizedReactMarkdown } from './chunk-6LRNF2VU.mjs';
|
|
3
|
+
import { ChatMessageActions } from './chunk-6UJWRTL6.mjs';
|
|
4
|
+
import { IconUser, IconOpenAI } from './chunk-KR7MH7XO.mjs';
|
|
5
|
+
import { cn } from './chunk-TVTG3V4F.mjs';
|
|
6
|
+
import { __objRest, __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
7
|
+
import remarkGfm from 'remark-gfm';
|
|
8
|
+
import remarkMath from 'remark-math';
|
|
9
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
10
|
+
|
|
11
|
+
function ChatMessage(_a) {
|
|
12
|
+
var _b = _a, { message } = _b, props = __objRest(_b, ["message"]);
|
|
13
|
+
return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({
|
|
14
|
+
className: cn("group relative mb-4 flex items-start")
|
|
15
|
+
}, props), {
|
|
16
|
+
children: [
|
|
17
|
+
/* @__PURE__ */ jsx("div", {
|
|
18
|
+
className: cn(
|
|
19
|
+
"flex h-8 w-8 shrink-0 select-none items-center justify-center rounded-md border shadow",
|
|
20
|
+
message.role === "user" ? "bg-background" : "bg-primary text-primary-foreground"
|
|
21
|
+
),
|
|
22
|
+
children: message.role === "user" ? /* @__PURE__ */ jsx(IconUser, {}) : /* @__PURE__ */ jsx(IconOpenAI, {})
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ jsxs("div", {
|
|
25
|
+
className: "ml-4 flex-1 space-y-2 overflow-hidden px-1",
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsx(MemoizedReactMarkdown, {
|
|
28
|
+
className: "prose break-words dark:prose-invert prose-p:leading-relaxed prose-pre:p-0 text-sm",
|
|
29
|
+
remarkPlugins: [remarkGfm, remarkMath],
|
|
30
|
+
components: {
|
|
31
|
+
p({ children }) {
|
|
32
|
+
return /* @__PURE__ */ jsx("p", {
|
|
33
|
+
className: "mb-2 last:mb-0",
|
|
34
|
+
children
|
|
35
|
+
});
|
|
36
|
+
},
|
|
37
|
+
code(_a2) {
|
|
38
|
+
var _b2 = _a2, { children, className, inline } = _b2, props2 = __objRest(_b2, ["children", "className", "inline"]);
|
|
39
|
+
if (children.length) {
|
|
40
|
+
if (children[0] == "\u258D") {
|
|
41
|
+
return /* @__PURE__ */ jsx("span", {
|
|
42
|
+
className: "mt-1 animate-pulse cursor-default",
|
|
43
|
+
children: "\u258D"
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
children[0] = children[0].replace("`\u258D`", "\u258D");
|
|
47
|
+
}
|
|
48
|
+
const match = /language-(\w+)/.exec(className || "");
|
|
49
|
+
if (inline) {
|
|
50
|
+
return /* @__PURE__ */ jsx("code", __spreadProps(__spreadValues({
|
|
51
|
+
className
|
|
52
|
+
}, props2), {
|
|
53
|
+
children
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
return /* @__PURE__ */ jsx(CodeBlock, __spreadValues({
|
|
57
|
+
language: match && match[1] || "",
|
|
58
|
+
value: String(children).replace(/\n$/, "")
|
|
59
|
+
}, props2), Math.random());
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
children: message.content
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ jsx(ChatMessageActions, {
|
|
65
|
+
message
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { ChatMessage };
|
|
74
|
+
//# sourceMappingURL=out.js.map
|
|
75
|
+
//# sourceMappingURL=chunk-ZB6JHNDT.mjs.map
|
|
@@ -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"]}
|