@copilotkit/react-ui 0.15.0-alpha.0 → 0.15.0-alpha.1
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 +178 -95
- package/CHANGELOG.md +12 -1
- package/dist/chunk-47SYBLI2.mjs +110 -0
- package/dist/chunk-47SYBLI2.mjs.map +1 -0
- package/dist/chunk-6H3Y2XEI.mjs +56 -0
- package/dist/chunk-6H3Y2XEI.mjs.map +1 -0
- package/dist/chunk-7YXG7D47.mjs +191 -0
- package/dist/chunk-7YXG7D47.mjs.map +1 -0
- package/dist/{chunk-NMT7XT2R.mjs → chunk-C34L4AWW.mjs} +2 -2
- package/dist/chunk-C34L4AWW.mjs.map +1 -0
- package/dist/chunk-DN3OI5WF.mjs +72 -0
- package/dist/chunk-DN3OI5WF.mjs.map +1 -0
- package/dist/chunk-DPUPEOGG.mjs +14 -0
- package/dist/chunk-DPUPEOGG.mjs.map +1 -0
- package/dist/chunk-FZRTAML3.mjs +3 -0
- package/dist/chunk-GPEJCUWA.mjs +14 -0
- package/dist/chunk-GPEJCUWA.mjs.map +1 -0
- package/dist/chunk-NXWVWC33.mjs +117 -0
- package/dist/chunk-NXWVWC33.mjs.map +1 -0
- package/dist/chunk-P4GBO6MW.mjs +3 -0
- package/dist/chunk-P4GBO6MW.mjs.map +1 -0
- package/dist/chunk-QFASQEFJ.mjs +51 -0
- package/dist/chunk-QFASQEFJ.mjs.map +1 -0
- package/dist/chunk-UIRFLYXI.mjs +53 -0
- package/dist/chunk-UIRFLYXI.mjs.map +1 -0
- package/dist/chunk-WB3YULQ4.mjs +3 -0
- package/dist/chunk-WB3YULQ4.mjs.map +1 -0
- package/dist/chunk-WM6BS77F.mjs +53 -0
- package/dist/chunk-WM6BS77F.mjs.map +1 -0
- package/dist/chunk-X3Z2EVFV.mjs +26 -0
- package/dist/chunk-X3Z2EVFV.mjs.map +1 -0
- package/dist/chunk-X4T6ZUVM.mjs +14 -0
- package/dist/chunk-X4T6ZUVM.mjs.map +1 -0
- package/dist/{chunk-WLTEQ2FW.mjs → chunk-XGUBRIUV.mjs} +4 -12
- package/dist/chunk-XGUBRIUV.mjs.map +1 -0
- package/dist/chunk-Y2RUG4B3.mjs +21 -0
- package/dist/chunk-Y2RUG4B3.mjs.map +1 -0
- package/dist/chunk-ZVAH2Z2W.mjs +61 -0
- package/dist/chunk-ZVAH2Z2W.mjs.map +1 -0
- package/dist/components/chat/Button.d.ts +7 -0
- package/dist/components/chat/Button.mjs +6 -0
- package/dist/components/chat/Button.mjs.map +1 -0
- package/dist/components/chat/Chat.d.ts +95 -0
- package/dist/components/chat/Chat.mjs +16 -0
- package/dist/components/chat/Chat.mjs.map +1 -0
- package/dist/components/chat/ChatContext.d.ts +105 -0
- package/dist/components/chat/ChatContext.mjs +5 -0
- package/dist/components/chat/ChatContext.mjs.map +1 -0
- package/dist/components/chat/CodeBlock.d.ts +14 -0
- package/dist/components/chat/CodeBlock.mjs +6 -0
- package/dist/components/chat/CodeBlock.mjs.map +1 -0
- package/dist/components/chat/Header.d.ts +7 -0
- package/dist/components/chat/Header.mjs +6 -0
- package/dist/components/chat/Header.mjs.map +1 -0
- package/dist/components/chat/Icons.d.ts +15 -0
- package/dist/components/chat/Icons.mjs +4 -0
- package/dist/components/chat/Icons.mjs.map +1 -0
- package/dist/components/chat/Input.d.ts +7 -0
- package/dist/components/chat/Input.mjs +7 -0
- package/dist/components/chat/Input.mjs.map +1 -0
- package/dist/components/chat/Markdown.d.ts +8 -0
- package/dist/components/chat/Markdown.mjs +7 -0
- package/dist/components/chat/Markdown.mjs.map +1 -0
- package/dist/components/chat/Messages.d.ts +7 -0
- package/dist/components/chat/Messages.mjs +9 -0
- package/dist/components/chat/Messages.mjs.map +1 -0
- package/dist/components/chat/Popup.d.ts +9 -0
- package/dist/components/chat/Popup.mjs +17 -0
- package/dist/components/chat/Popup.mjs.map +1 -0
- package/dist/components/chat/Response.d.ts +7 -0
- package/dist/components/chat/Response.mjs +6 -0
- package/dist/components/chat/Response.mjs.map +1 -0
- package/dist/components/chat/Sidebar.d.ts +12 -0
- package/dist/components/chat/Sidebar.mjs +17 -0
- package/dist/components/chat/Sidebar.mjs.map +1 -0
- package/dist/components/chat/Textarea.d.ts +13 -0
- package/dist/components/chat/Textarea.mjs +4 -0
- package/dist/components/chat/Textarea.mjs.map +1 -0
- package/dist/components/chat/Window.d.ts +6 -0
- package/dist/components/chat/Window.mjs +4 -0
- package/dist/components/chat/Window.mjs.map +1 -0
- package/dist/components/chat/index.d.ts +7 -0
- package/dist/components/chat/index.mjs +20 -0
- package/dist/components/chat/index.mjs.map +1 -0
- package/dist/components/chat/props.d.ts +33 -0
- package/dist/components/chat/props.mjs +3 -0
- package/dist/components/chat/props.mjs.map +1 -0
- package/dist/components/chat-components/copilot-chat.mjs +1 -1
- package/dist/components/chat-components/ui/badge.d.ts +1 -1
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.mjs +20 -4
- package/dist/components/sidebar/copilot-sidebar-ui-provider.d.ts +1 -2
- package/dist/components/sidebar/copilot-sidebar-ui-provider.mjs +3 -3
- package/dist/components/sidebar/copilot-sidebar.d.ts +0 -1
- package/dist/components/sidebar/copilot-sidebar.mjs +2 -2
- package/dist/index.css +452 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.mjs +20 -4
- package/package.json +5 -5
- package/src/components/chat/Button.tsx +24 -0
- package/src/components/chat/Chat.tsx +186 -0
- package/src/components/chat/ChatContext.tsx +176 -0
- package/src/components/chat/CodeBlock.tsx +149 -0
- package/src/components/chat/Header.tsx +16 -0
- package/src/components/chat/Icons.tsx +179 -0
- package/src/components/chat/Input.tsx +51 -0
- package/src/components/chat/Markdown.tsx +62 -0
- package/src/components/chat/Messages.tsx +113 -0
- package/src/components/chat/Popup.tsx +10 -0
- package/src/components/chat/Response.tsx +13 -0
- package/src/components/chat/Sidebar.tsx +28 -0
- package/src/components/chat/Textarea.tsx +61 -0
- package/src/components/chat/Window.tsx +141 -0
- package/src/components/chat/index.tsx +3 -0
- package/src/components/chat/props.ts +36 -0
- package/src/components/index.ts +2 -0
- package/src/components/sidebar/copilot-sidebar-ui-provider.tsx +2 -6
- package/src/components/sidebar/copilot-sidebar.tsx +1 -2
- package/src/css/animations.css +29 -0
- package/src/css/button.css +54 -0
- package/src/css/colors.css +61 -0
- package/src/css/header.css +43 -0
- package/src/css/input.css +79 -0
- package/src/css/messages.css +57 -0
- package/src/css/popup.css +22 -0
- package/src/css/response.css +29 -0
- package/src/css/sidebar.css +34 -0
- package/src/css/window.css +58 -0
- package/src/styles.css +11 -0
- package/dist/chunk-NMT7XT2R.mjs.map +0 -1
- package/dist/chunk-U6NJWGTV.mjs +0 -3
- package/dist/chunk-WLTEQ2FW.mjs.map +0 -1
- /package/dist/{chunk-U6NJWGTV.mjs.map → chunk-FZRTAML3.mjs.map} +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { forwardRef, useRef, useState, useImperativeHandle, useEffect } from 'react';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// src/components/chat/Textarea.tsx
|
|
5
|
+
var AutoResizingTextarea = forwardRef(
|
|
6
|
+
({ maxRows = 1, placeholder, value, onChange, onKeyDown, autoFocus }, ref) => {
|
|
7
|
+
const internalTextareaRef = useRef(null);
|
|
8
|
+
const [maxHeight, setMaxHeight] = useState(0);
|
|
9
|
+
useImperativeHandle(ref, () => internalTextareaRef.current);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const calculateMaxHeight = () => {
|
|
12
|
+
const textarea = internalTextareaRef.current;
|
|
13
|
+
if (textarea) {
|
|
14
|
+
textarea.style.height = "auto";
|
|
15
|
+
const singleRowHeight = textarea.scrollHeight;
|
|
16
|
+
setMaxHeight(singleRowHeight * maxRows);
|
|
17
|
+
if (autoFocus) {
|
|
18
|
+
textarea.focus();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
calculateMaxHeight();
|
|
23
|
+
}, [maxRows]);
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
const textarea = internalTextareaRef.current;
|
|
26
|
+
if (textarea) {
|
|
27
|
+
textarea.style.height = "auto";
|
|
28
|
+
textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;
|
|
29
|
+
}
|
|
30
|
+
}, [value, maxHeight]);
|
|
31
|
+
return /* @__PURE__ */ jsx(
|
|
32
|
+
"textarea",
|
|
33
|
+
{
|
|
34
|
+
ref: internalTextareaRef,
|
|
35
|
+
value,
|
|
36
|
+
onChange,
|
|
37
|
+
onKeyDown,
|
|
38
|
+
placeholder,
|
|
39
|
+
style: {
|
|
40
|
+
overflow: "hidden",
|
|
41
|
+
resize: "none",
|
|
42
|
+
maxHeight: `${maxHeight}px`
|
|
43
|
+
},
|
|
44
|
+
rows: 1
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
var Textarea_default = AutoResizingTextarea;
|
|
50
|
+
|
|
51
|
+
export { Textarea_default };
|
|
52
|
+
//# sourceMappingURL=out.js.map
|
|
53
|
+
//# sourceMappingURL=chunk-WM6BS77F.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Textarea.tsx"],"names":[],"mappings":";AAAA,SAAgB,UAAU,QAAQ,WAAW,YAAY,2BAA2B;AA2C9E;AAhCN,IAAM,uBAAuB;AAAA,EAC3B,CAAC,EAAE,UAAU,GAAG,aAAa,OAAO,UAAU,WAAW,UAAU,GAAG,QAAQ;AAC5E,UAAM,sBAAsB,OAA4B,IAAI;AAC5D,UAAM,CAAC,WAAW,YAAY,IAAI,SAAiB,CAAC;AAEpD,wBAAoB,KAAK,MAAM,oBAAoB,OAA8B;AAEjF,cAAU,MAAM;AACd,YAAM,qBAAqB,MAAM;AAC/B,cAAM,WAAW,oBAAoB;AACrC,YAAI,UAAU;AACZ,mBAAS,MAAM,SAAS;AACxB,gBAAM,kBAAkB,SAAS;AACjC,uBAAa,kBAAkB,OAAO;AACtC,cAAI,WAAW;AACb,qBAAS,MAAM;AAAA,UACjB;AAAA,QACF;AAAA,MACF;AAEA,yBAAmB;AAAA,IACrB,GAAG,CAAC,OAAO,CAAC;AAEZ,cAAU,MAAM;AACd,YAAM,WAAW,oBAAoB;AACrC,UAAI,UAAU;AACZ,iBAAS,MAAM,SAAS;AACxB,iBAAS,MAAM,SAAS,GAAG,KAAK,IAAI,SAAS,cAAc,SAAS;AAAA,MACtE;AAAA,IACF,GAAG,CAAC,OAAO,SAAS,CAAC;AAErB,WACE;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO;AAAA,UACL,UAAU;AAAA,UACV,QAAQ;AAAA,UACR,WAAW,GAAG;AAAA,QAChB;AAAA,QACA,MAAM;AAAA;AAAA,IACR;AAAA,EAEJ;AACF;AAEA,IAAO,mBAAQ","sourcesContent":["import React, { useState, useRef, useEffect, forwardRef, useImperativeHandle } from \"react\";\n\ninterface AutoResizingTextareaProps {\n maxRows?: number;\n placeholder?: string;\n value: string;\n onChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;\n onKeyDown?: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;\n autoFocus?: boolean;\n}\n\nconst AutoResizingTextarea = forwardRef<HTMLTextAreaElement, AutoResizingTextareaProps>(\n ({ maxRows = 1, placeholder, value, onChange, onKeyDown, autoFocus }, ref) => {\n const internalTextareaRef = useRef<HTMLTextAreaElement>(null);\n const [maxHeight, setMaxHeight] = useState<number>(0);\n\n useImperativeHandle(ref, () => internalTextareaRef.current as HTMLTextAreaElement);\n\n useEffect(() => {\n const calculateMaxHeight = () => {\n const textarea = internalTextareaRef.current;\n if (textarea) {\n textarea.style.height = \"auto\";\n const singleRowHeight = textarea.scrollHeight;\n setMaxHeight(singleRowHeight * maxRows);\n if (autoFocus) {\n textarea.focus();\n }\n }\n };\n\n calculateMaxHeight();\n }, [maxRows]);\n\n useEffect(() => {\n const textarea = internalTextareaRef.current;\n if (textarea) {\n textarea.style.height = \"auto\";\n textarea.style.height = `${Math.min(textarea.scrollHeight, maxHeight)}px`;\n }\n }, [value, maxHeight]);\n\n return (\n <textarea\n ref={internalTextareaRef}\n value={value}\n onChange={onChange}\n onKeyDown={onKeyDown}\n placeholder={placeholder}\n style={{\n overflow: \"hidden\",\n resize: \"none\",\n maxHeight: `${maxHeight}px`,\n }}\n rows={1}\n />\n );\n },\n);\n\nexport default AutoResizingTextarea;\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CopilotKitChat } from './chunk-DN3OI5WF.mjs';
|
|
2
|
+
import { __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var CopilotKitSidebar = (props) => {
|
|
7
|
+
props = __spreadProps(__spreadValues({}, props), {
|
|
8
|
+
className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
|
|
9
|
+
});
|
|
10
|
+
const [expandedClassName, setExpandedClassName] = useState(
|
|
11
|
+
props.defaultOpen ? "sidebarExpanded" : ""
|
|
12
|
+
);
|
|
13
|
+
const onSetOpen = (open) => {
|
|
14
|
+
var _a;
|
|
15
|
+
(_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
|
|
16
|
+
setExpandedClassName(open ? "sidebarExpanded" : "");
|
|
17
|
+
};
|
|
18
|
+
return /* @__PURE__ */ jsxs("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: [
|
|
19
|
+
props.children,
|
|
20
|
+
/* @__PURE__ */ jsx(CopilotKitChat, __spreadValues(__spreadValues({}, props), { onSetOpen }))
|
|
21
|
+
] });
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { CopilotKitSidebar };
|
|
25
|
+
//# sourceMappingURL=out.js.map
|
|
26
|
+
//# sourceMappingURL=chunk-X3Z2EVFV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Sidebar.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,SAAgB,gBAAgB;AAsB5B,SAEE,KAFF;AAfG,IAAM,oBAAsD,CAAC,UAAU;AAC5E,UAAQ,iCACH,QADG;AAAA,IAEN,WAAW,MAAM,YAAY,MAAM,YAAY,uBAAuB;AAAA,EACxE;AACA,QAAM,CAAC,mBAAmB,oBAAoB,IAAI;AAAA,IAChD,MAAM,cAAc,oBAAoB;AAAA,EAC1C;AAEA,QAAM,YAAY,CAAC,SAAkB;AAhBvC;AAiBI,gBAAM,cAAN,+BAAkB;AAClB,yBAAqB,OAAO,oBAAoB,EAAE;AAAA,EACpD;AAEA,SACE,qBAAC,SAAI,WAAW,mCAAmC,qBAChD;AAAA,UAAM;AAAA,IACP,oBAAC,kDAAmB,QAAW,EAAE,UAAU,EAAG;AAAA,KAChD;AAEJ","sourcesContent":["import React, { useState } from \"react\";\nimport { CopilotKitChat, CopilotKitChatProps } from \"./Chat\";\n\ninterface CopilotKitSidebarProps extends CopilotKitChatProps {\n children?: React.ReactNode;\n}\n\nexport const CopilotKitSidebar: React.FC<CopilotKitSidebarProps> = (props) => {\n props = {\n ...props,\n className: props.className ? props.className + \" copilotKitSidebar\" : \"copilotKitSidebar\",\n };\n const [expandedClassName, setExpandedClassName] = useState(\n props.defaultOpen ? \"sidebarExpanded\" : \"\",\n );\n\n const onSetOpen = (open: boolean) => {\n props.onSetOpen?.(open);\n setExpandedClassName(open ? \"sidebarExpanded\" : \"\");\n };\n\n return (\n <div className={`copilotKitSidebarContentWrapper ${expandedClassName}`}>\n {props.children}\n <CopilotKitChat {...props} {...{ onSetOpen }} />\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CopilotKitChat } from './chunk-DN3OI5WF.mjs';
|
|
2
|
+
import { __spreadProps, __spreadValues } from './chunk-MRXNTQOX.mjs';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
var CopilotKitPopup = (props) => {
|
|
6
|
+
props = __spreadProps(__spreadValues({}, props), {
|
|
7
|
+
className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup"
|
|
8
|
+
});
|
|
9
|
+
return /* @__PURE__ */ jsx(CopilotKitChat, __spreadValues({}, props));
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { CopilotKitPopup };
|
|
13
|
+
//# sourceMappingURL=out.js.map
|
|
14
|
+
//# sourceMappingURL=chunk-X4T6ZUVM.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Popup.tsx"],"names":[],"mappings":";;;;;;;;;AAQS;AALF,IAAM,kBAAiD,CAAC,UAAU;AACvE,UAAQ,iCACH,QADG;AAAA,IAEN,WAAW,MAAM,YAAY,MAAM,YAAY,qBAAqB;AAAA,EACtE;AACA,SAAO,oBAAC,mCAAmB,MAAO;AACpC","sourcesContent":["import React from \"react\";\nimport { CopilotKitChat, CopilotKitChatProps } from \"./Chat\";\n\nexport const CopilotKitPopup: React.FC<CopilotKitChatProps> = (props) => {\n props = {\n ...props,\n className: props.className ? props.className + \" copilotKitPopup\" : \"copilotKitPopup\",\n };\n return <CopilotKitChat {...props} />;\n};\n"]}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { CopilotSidebar } from './chunk-
|
|
1
|
+
import { CopilotSidebar } from './chunk-C34L4AWW.mjs';
|
|
2
2
|
import { CopilotSidebarContext } from './chunk-MC6KTH4X.mjs';
|
|
3
3
|
import { TooltipProvider } from './chunk-VGX2W5ZB.mjs';
|
|
4
|
-
import { __objRest } from './chunk-MRXNTQOX.mjs';
|
|
5
4
|
import { useState, useCallback } from 'react';
|
|
6
5
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
7
6
|
|
|
8
|
-
function CopilotSidebarUIProvider(
|
|
9
|
-
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
7
|
+
function CopilotSidebarUIProvider({ children }) {
|
|
10
8
|
const [sidebarOpen, setSidebarOpen] = useState(true);
|
|
11
9
|
const toggleSidebar = useCallback(() => {
|
|
12
10
|
setSidebarOpen((prev) => !prev);
|
|
@@ -46,13 +44,7 @@ function CopilotSidebarUIProvider(_a) {
|
|
|
46
44
|
right: sidebarOpen ? "0" : "-450px",
|
|
47
45
|
transition: "right 0.5s ease-in-out"
|
|
48
46
|
},
|
|
49
|
-
children: /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(
|
|
50
|
-
CopilotSidebar,
|
|
51
|
-
{
|
|
52
|
-
setSidebarOpen,
|
|
53
|
-
makeSystemMessage: props.makeSystemMessage
|
|
54
|
-
}
|
|
55
|
-
) })
|
|
47
|
+
children: /* @__PURE__ */ jsx(TooltipProvider, { children: /* @__PURE__ */ jsx(CopilotSidebar, { setSidebarOpen }) })
|
|
56
48
|
}
|
|
57
49
|
),
|
|
58
50
|
!sidebarOpen && /* @__PURE__ */ jsx(
|
|
@@ -77,4 +69,4 @@ function CopilotSidebarUIProvider(_a) {
|
|
|
77
69
|
|
|
78
70
|
export { CopilotSidebarUIProvider };
|
|
79
71
|
//# sourceMappingURL=out.js.map
|
|
80
|
-
//# sourceMappingURL=chunk-
|
|
72
|
+
//# sourceMappingURL=chunk-XGUBRIUV.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;AAkBnB,mBAkBM,KAjBJ,YADF;AATC,SAAS,yBAAyB,EAAE,SAAS,GAAkC;AACpF,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,EAA+B,OAAO,EAAE,eAAe,aAAa,cAAc,GACjF,0CACE;AAAA,IAAC;AAAA;AAAA,MACC,OAAO;AAAA,QACL,QAAQ;AAAA,QACR,OAAO;AAAA,QACP,UAAU;AAAA,MACZ;AAAA,MAEA;AAAA;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,WAAW;AAAA,cACX,WAAW;AAAA,cACX,QAAQ;AAAA,cACR,OAAO,cAAc,uBAAuB;AAAA,cAC5C,UAAU;AAAA,cACV,YAAY;AAAA;AAAA,YACd;AAAA,YAEA,8BAAC,UAAM,UAAS;AAAA;AAAA,QAClB;AAAA,QACA;AAAA,UAAC;AAAA;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,mBACC,8BAAC,kBAAe,gBAAgC,GAClD;AAAA;AAAA,QACF;AAAA,QACC,CAAC,eACA;AAAA,UAAC;AAAA;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;AAAA,QAED;AAAA;AAAA;AAAA,EAEJ,GACF,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({ children }: CopilotSidebarUIProviderProps) {\n const [sidebarOpen, setSidebarOpen] = useState(true);\n\n const toggleSidebar = useCallback(() => {\n setSidebarOpen((prev) => !prev);\n }, []);\n\n return (\n <CopilotSidebarContext.Provider value={{ isSidebarOpen: sidebarOpen, toggleSidebar }}>\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,21 @@
|
|
|
1
|
+
import { useChatContext } from './chunk-6H3Y2XEI.mjs';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
var Button = ({ open, setOpen }) => {
|
|
5
|
+
const context = useChatContext();
|
|
6
|
+
return /* @__PURE__ */ jsx("div", { onClick: () => setOpen(!open), children: /* @__PURE__ */ jsxs(
|
|
7
|
+
"button",
|
|
8
|
+
{
|
|
9
|
+
className: `copilotKitButton ${open ? "open" : ""}`,
|
|
10
|
+
"aria-label": open ? "Close Chat" : "Open Chat",
|
|
11
|
+
children: [
|
|
12
|
+
/* @__PURE__ */ jsx("div", { className: "copilotKitButtonIcon copilotKitButtonIconOpen", children: context.icons.openIcon }),
|
|
13
|
+
/* @__PURE__ */ jsx("div", { className: "copilotKitButtonIcon copilotKitButtonIconClose", children: context.icons.closeIcon })
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
) });
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { Button };
|
|
20
|
+
//# sourceMappingURL=out.js.map
|
|
21
|
+
//# sourceMappingURL=chunk-Y2RUG4B3.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Button.tsx"],"names":[],"mappings":";;;;;AAUM,SAIE,KAJF;AANC,IAAM,SAAgC,CAAC,EAAE,MAAM,QAAQ,MAAM;AAClE,QAAM,UAAU,eAAe;AAG/B,SACE,oBAAC,SAAI,SAAS,MAAM,QAAQ,CAAC,IAAI,GAC/B;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,oBAAoB,OAAO,SAAS;AAAA,MAC/C,cAAY,OAAO,eAAe;AAAA,MAElC;AAAA,4BAAC,SAAI,WAAU,iDACZ,kBAAQ,MAAM,UACjB;AAAA,QACA,oBAAC,SAAI,WAAU,kDACZ,kBAAQ,MAAM,WACjB;AAAA;AAAA;AAAA,EACF,GACF;AAEJ","sourcesContent":["import React from \"react\";\nimport { ButtonProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Button: React.FC<ButtonProps> = ({ open, setOpen }) => {\n const context = useChatContext();\n // To ensure that the mouse handler fires even when the button is scaled down\n // we wrap the button in a div and attach the handler to the div\n return (\n <div onClick={() => setOpen(!open)}>\n <button\n className={`copilotKitButton ${open ? \"open\" : \"\"}`}\n aria-label={open ? \"Close Chat\" : \"Open Chat\"}\n >\n <div className=\"copilotKitButtonIcon copilotKitButtonIconOpen\">\n {context.icons.openIcon}\n </div>\n <div className=\"copilotKitButtonIcon copilotKitButtonIconClose\">\n {context.icons.closeIcon}\n </div>\n </button>\n </div>\n );\n};\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Markdown } from './chunk-UIRFLYXI.mjs';
|
|
2
|
+
import { useChatContext } from './chunk-6H3Y2XEI.mjs';
|
|
3
|
+
import React, { useMemo, useEffect } from 'react';
|
|
4
|
+
import { nanoid } from 'nanoid';
|
|
5
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
6
|
+
|
|
7
|
+
var Messages = ({ messages, inProgress }) => {
|
|
8
|
+
const context = useChatContext();
|
|
9
|
+
const initialMessages = useMemo(
|
|
10
|
+
() => makeInitialMessages(context.labels.initial),
|
|
11
|
+
[context.labels.initial]
|
|
12
|
+
);
|
|
13
|
+
messages = [...initialMessages, ...messages];
|
|
14
|
+
const messagesEndRef = React.useRef(null);
|
|
15
|
+
const scrollToBottom = () => {
|
|
16
|
+
if (messagesEndRef.current) {
|
|
17
|
+
messagesEndRef.current.scrollIntoView({
|
|
18
|
+
behavior: "auto"
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
scrollToBottom();
|
|
24
|
+
}, [messages]);
|
|
25
|
+
return /* @__PURE__ */ jsxs("div", { className: "copilotKitMessages", children: [
|
|
26
|
+
messages.map((message, index) => {
|
|
27
|
+
const isCurrentMessage = index === messages.length - 1;
|
|
28
|
+
if (message.role === "user") {
|
|
29
|
+
return /* @__PURE__ */ jsx("div", { className: "copilotKitMessage copilotKitUserMessage", children: message.content }, index);
|
|
30
|
+
} else if (message.role == "assistant") {
|
|
31
|
+
if (isCurrentMessage && inProgress && !message.content) {
|
|
32
|
+
return /* @__PURE__ */ jsx("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: context.icons.spinnerIcon }, index);
|
|
33
|
+
} else if ((!inProgress || index != messages.length - 1) && !message.content && message.function_call) {
|
|
34
|
+
return /* @__PURE__ */ jsx("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: context.labels.done }, index);
|
|
35
|
+
} else {
|
|
36
|
+
return /* @__PURE__ */ jsx("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: /* @__PURE__ */ jsx(Markdown, { content: message.content }) }, index);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
40
|
+
/* @__PURE__ */ jsx("div", { ref: messagesEndRef })
|
|
41
|
+
] });
|
|
42
|
+
};
|
|
43
|
+
function makeInitialMessages(initial) {
|
|
44
|
+
let initialArray = [];
|
|
45
|
+
if (initial) {
|
|
46
|
+
if (Array.isArray(initial)) {
|
|
47
|
+
initialArray.push(...initial);
|
|
48
|
+
} else {
|
|
49
|
+
initialArray.push(initial);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return initialArray.map((message) => ({
|
|
53
|
+
id: nanoid(),
|
|
54
|
+
role: "assistant",
|
|
55
|
+
content: message
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { Messages };
|
|
60
|
+
//# sourceMappingURL=out.js.map
|
|
61
|
+
//# sourceMappingURL=chunk-ZVAH2Z2W.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Messages.tsx"],"names":[],"mappings":";;;;;;;;AAAA,OAAO,SAAS,WAAW,eAAe;AAG1C,SAAS,cAAc;AA2BnB,SAMQ,KANR;AAvBG,IAAM,WAAoC,CAAC,EAAE,UAAU,WAAW,MAAM;AAC7E,QAAM,UAAU,eAAe;AAC/B,QAAM,kBAAkB;AAAA,IACtB,MAAM,oBAAoB,QAAQ,OAAO,OAAO;AAAA,IAChD,CAAC,QAAQ,OAAO,OAAO;AAAA,EACzB;AACA,aAAW,CAAC,GAAG,iBAAiB,GAAG,QAAQ;AAE3C,QAAM,iBAAiB,MAAM,OAAuB,IAAI;AAExD,QAAM,iBAAiB,MAAM;AAC3B,QAAI,eAAe,SAAS;AAC1B,qBAAe,QAAQ,eAAe;AAAA,QACpC,UAAU;AAAA,MACZ,CAAC;AAAA,IACH;AAAA,EACF;AAEA,YAAU,MAAM;AACd,mBAAe;AAAA,EACjB,GAAG,CAAC,QAAQ,CAAC;AAEb,SACE,qBAAC,SAAI,WAAU,sBACZ;AAAA,aAAS,IAAI,CAAC,SAAS,UAAU;AAChC,YAAM,mBAAmB,UAAU,SAAS,SAAS;AAErD,UAAI,QAAQ,SAAS,QAAQ;AAC3B,eACE,oBAAC,SAAgB,WAAU,2CACxB,kBAAQ,WADD,KAEV;AAAA,MAEJ,WAAW,QAAQ,QAAQ,aAAa;AACtC,YAAI,oBAAoB,cAAc,CAAC,QAAQ,SAAS;AACtD,iBACE,oBAAC,SAAgB,WAAW,gDACzB,kBAAQ,MAAM,eADP,KAEV;AAAA,QAEJ,YACG,CAAC,cAAc,SAAS,SAAS,SAAS,MAC3C,CAAC,QAAQ,WACT,QAAQ,eACR;AACA,iBACE,oBAAC,SAAgB,WAAW,gDACzB,kBAAQ,OAAO,QADR,KAEV;AAAA,QAEJ,OAWK;AACH,iBACE,oBAAC,SAAgB,WAAW,gDAC1B,8BAAC,YAAS,SAAS,QAAQ,SAAS,KAD5B,KAEV;AAAA,QAEJ;AAAA,MACF;AAAA,IAgBF,CAAC;AAAA,IACD,oBAAC,SAAI,KAAK,gBAAgB;AAAA,KAC5B;AAEJ;AAEA,SAAS,oBAAoB,SAAwC;AACnE,MAAI,eAAyB,CAAC;AAC9B,MAAI,SAAS;AACX,QAAI,MAAM,QAAQ,OAAO,GAAG;AAC1B,mBAAa,KAAK,GAAG,OAAO;AAAA,IAC9B,OAAO;AACL,mBAAa,KAAK,OAAO;AAAA,IAC3B;AAAA,EACF;AAEA,SAAO,aAAa,IAAI,CAAC,aAAa;AAAA,IACpC,IAAI,OAAO;AAAA,IACX,MAAM;AAAA,IACN,SAAS;AAAA,EACX,EAAE;AACJ","sourcesContent":["import React, { useEffect, useMemo } from \"react\";\nimport { MessagesProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\nimport { nanoid } from \"nanoid\";\nimport { Message } from \"@copilotkit/react-core\";\nimport { Markdown } from \"./Markdown\";\n\nexport const Messages: React.FC<MessagesProps> = ({ messages, inProgress }) => {\n const context = useChatContext();\n const initialMessages = useMemo(\n () => makeInitialMessages(context.labels.initial),\n [context.labels.initial],\n );\n messages = [...initialMessages, ...messages];\n\n const messagesEndRef = React.useRef<HTMLDivElement>(null);\n\n const scrollToBottom = () => {\n if (messagesEndRef.current) {\n messagesEndRef.current.scrollIntoView({\n behavior: \"auto\",\n });\n }\n };\n\n useEffect(() => {\n scrollToBottom();\n }, [messages]);\n\n return (\n <div className=\"copilotKitMessages\">\n {messages.map((message, index) => {\n const isCurrentMessage = index === messages.length - 1;\n\n if (message.role === \"user\") {\n return (\n <div key={index} className=\"copilotKitMessage copilotKitUserMessage\">\n {message.content}\n </div>\n );\n } else if (message.role == \"assistant\") {\n if (isCurrentMessage && inProgress && !message.content) {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {context.icons.spinnerIcon}\n </div>\n );\n } else if (\n (!inProgress || index != messages.length - 1) &&\n !message.content &&\n message.function_call\n ) {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {context.labels.done}\n </div>\n );\n }\n // TODO: Add back partial message\n // This shows up when the assistant is executing a function\n //\n // else if (message.status === \"partial\") {\n // return (\n // <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n // {context.labels.thinking} {context.icons.spinnerIcon}\n // </div>\n // );\n // }\n else {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n <Markdown content={message.content} />\n </div>\n );\n }\n }\n // TODO: Add back function and error messages\n //\n // else if (message.role === \"function\" && message.status === \"success\") {\n // return (\n // <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n // {context.labels.done}\n // </div>\n // );\n // } else if (message.status === \"error\") {\n // return (\n // <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n // {context.labels.error}\n // </div>\n // );\n // }\n })}\n <div ref={messagesEndRef} />\n </div>\n );\n};\n\nfunction makeInitialMessages(initial?: string | string[]): Message[] {\n let initialArray: string[] = [];\n if (initial) {\n if (Array.isArray(initial)) {\n initialArray.push(...initial);\n } else {\n initialArray.push(initial);\n }\n }\n\n return initialArray.map((message) => ({\n id: nanoid(),\n role: \"assistant\",\n content: message,\n }));\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import { CopilotKitChatIcons, CopilotKitChatLabels } from './ChatContext.js';
|
|
3
|
+
import { SystemMessageFunction } from '@copilotkit/react-core';
|
|
4
|
+
import { WindowProps, ButtonProps, HeaderProps, MessagesProps, InputProps, ResponseButtonProps } from './props.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Props for CopilotKitChat component.
|
|
8
|
+
*/
|
|
9
|
+
interface CopilotKitChatProps {
|
|
10
|
+
/**
|
|
11
|
+
* Custom instructions to be added to the system message. Use this property to
|
|
12
|
+
* provide additional context or guidance to the language model, influencing
|
|
13
|
+
* its responses. These instructions can include specific directions,
|
|
14
|
+
* preferences, or criteria that the model should consider when generating
|
|
15
|
+
* its output, thereby tailoring the conversation more precisely to the
|
|
16
|
+
* user's needs or the application's requirements.
|
|
17
|
+
*/
|
|
18
|
+
instructions?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Whether the chat window should be open by default.
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
defaultOpen?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* If the chat window should close when the user clicks outside of it.
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
clickOutsideToClose?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* If the chat window should close when the user hits the Escape key.
|
|
31
|
+
* @default true
|
|
32
|
+
*/
|
|
33
|
+
hitEscapeToClose?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* A callback that gets called when the chat window opens or closes.
|
|
36
|
+
*/
|
|
37
|
+
onSetOpen?: (open: boolean) => void;
|
|
38
|
+
/**
|
|
39
|
+
* The hotkey to open the chat window.
|
|
40
|
+
* Uses Command-<hotkey> on a Mac and Ctrl-<hotkey> on Windows.
|
|
41
|
+
* @default "e"
|
|
42
|
+
*/
|
|
43
|
+
hotkey?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Icons can be used to set custom icons for the chat window.
|
|
46
|
+
*/
|
|
47
|
+
icons?: CopilotKitChatIcons;
|
|
48
|
+
/**
|
|
49
|
+
* Labels can be used to set custom labels for the chat window.
|
|
50
|
+
*/
|
|
51
|
+
labels?: CopilotKitChatLabels;
|
|
52
|
+
/**
|
|
53
|
+
* A function that takes in context string and instructions and returns
|
|
54
|
+
* the system message to include in the chat request.
|
|
55
|
+
* Use this to completely override the system message, when providing
|
|
56
|
+
* instructions is not enough.
|
|
57
|
+
*/
|
|
58
|
+
makeSystemMessage?: SystemMessageFunction;
|
|
59
|
+
/**
|
|
60
|
+
* Whether to show the response button.
|
|
61
|
+
* @default true
|
|
62
|
+
*/
|
|
63
|
+
showResponseButton?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* A custom Window component to use instead of the default.
|
|
66
|
+
*/
|
|
67
|
+
Window?: React__default.ComponentType<WindowProps>;
|
|
68
|
+
/**
|
|
69
|
+
* A custom Button component to use instead of the default.
|
|
70
|
+
*/
|
|
71
|
+
Button?: React__default.ComponentType<ButtonProps>;
|
|
72
|
+
/**
|
|
73
|
+
* A custom Header component to use instead of the default.
|
|
74
|
+
*/
|
|
75
|
+
Header?: React__default.ComponentType<HeaderProps>;
|
|
76
|
+
/**
|
|
77
|
+
* A custom Messages component to use instead of the default.
|
|
78
|
+
*/
|
|
79
|
+
Messages?: React__default.ComponentType<MessagesProps>;
|
|
80
|
+
/**
|
|
81
|
+
* A custom Input component to use instead of the default.
|
|
82
|
+
*/
|
|
83
|
+
Input?: React__default.ComponentType<InputProps>;
|
|
84
|
+
/**
|
|
85
|
+
* A custom ResponseButton component to use instead of the default.
|
|
86
|
+
*/
|
|
87
|
+
ResponseButton?: React__default.ComponentType<ResponseButtonProps>;
|
|
88
|
+
/**
|
|
89
|
+
* A class name to apply to the root element.
|
|
90
|
+
*/
|
|
91
|
+
className?: string;
|
|
92
|
+
}
|
|
93
|
+
declare const CopilotKitChat: React__default.FC<CopilotKitChatProps>;
|
|
94
|
+
|
|
95
|
+
export { CopilotKitChat, CopilotKitChatProps };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { CopilotKitChat } from '../../chunk-DN3OI5WF.mjs';
|
|
2
|
+
import '../../chunk-47SYBLI2.mjs';
|
|
3
|
+
import '../../chunk-QFASQEFJ.mjs';
|
|
4
|
+
import '../../chunk-ZVAH2Z2W.mjs';
|
|
5
|
+
import '../../chunk-UIRFLYXI.mjs';
|
|
6
|
+
import '../../chunk-GPEJCUWA.mjs';
|
|
7
|
+
import '../../chunk-WM6BS77F.mjs';
|
|
8
|
+
import '../../chunk-Y2RUG4B3.mjs';
|
|
9
|
+
import '../../chunk-NXWVWC33.mjs';
|
|
10
|
+
import '../../chunk-DPUPEOGG.mjs';
|
|
11
|
+
import '../../chunk-6H3Y2XEI.mjs';
|
|
12
|
+
import '../../chunk-7YXG7D47.mjs';
|
|
13
|
+
import '../../chunk-POVINPXX.mjs';
|
|
14
|
+
import '../../chunk-MRXNTQOX.mjs';
|
|
15
|
+
//# sourceMappingURL=out.js.map
|
|
16
|
+
//# sourceMappingURL=Chat.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Icons for CopilotKitChat component.
|
|
5
|
+
*/
|
|
6
|
+
interface CopilotKitChatIcons {
|
|
7
|
+
/**
|
|
8
|
+
* The icon to use for the open chat button.
|
|
9
|
+
* @default <OpenIcon />
|
|
10
|
+
*/
|
|
11
|
+
openIcon?: React__default.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* The icon to use for the close chat button.
|
|
14
|
+
* @default <CloseIcon />
|
|
15
|
+
*/
|
|
16
|
+
closeIcon?: React__default.ReactNode;
|
|
17
|
+
/**
|
|
18
|
+
* The icon to use for the close chat button in the header.
|
|
19
|
+
* @default <HeaderCloseIcon />
|
|
20
|
+
*/
|
|
21
|
+
headerCloseIcon?: React__default.ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* The icon to use for the send button.
|
|
24
|
+
* @default <SendIcon />
|
|
25
|
+
*/
|
|
26
|
+
sendIcon?: React__default.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* The icon to use for the activity indicator.
|
|
29
|
+
* @default <ActivityIcon />
|
|
30
|
+
*/
|
|
31
|
+
activityIcon?: React__default.ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* The icon to use for the spinner.
|
|
34
|
+
* @default <SpinnerIcon />
|
|
35
|
+
*/
|
|
36
|
+
spinnerIcon?: React__default.ReactNode;
|
|
37
|
+
/**
|
|
38
|
+
* The icon to use for the stop button.
|
|
39
|
+
* @default <StopIcon />
|
|
40
|
+
*/
|
|
41
|
+
stopIcon?: React__default.ReactNode;
|
|
42
|
+
/**
|
|
43
|
+
* The icon to use for the regenerate button.
|
|
44
|
+
* @default <RegenerateIcon />
|
|
45
|
+
*/
|
|
46
|
+
regenerateIcon?: React__default.ReactNode;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Labels for CopilotKitChat component.
|
|
50
|
+
*/
|
|
51
|
+
interface CopilotKitChatLabels {
|
|
52
|
+
/**
|
|
53
|
+
* The initial message(s) to display in the chat window.
|
|
54
|
+
*/
|
|
55
|
+
initial?: string | string[];
|
|
56
|
+
/**
|
|
57
|
+
* The title to display in the header.
|
|
58
|
+
* @default "CopilotKit"
|
|
59
|
+
*/
|
|
60
|
+
title?: string;
|
|
61
|
+
/**
|
|
62
|
+
* The placeholder to display in the input.
|
|
63
|
+
* @default "Type a message..."
|
|
64
|
+
*/
|
|
65
|
+
placeholder?: string;
|
|
66
|
+
/**
|
|
67
|
+
* The message to display while the chat GPT is "thinking".
|
|
68
|
+
* @default "Thinking..."
|
|
69
|
+
*/
|
|
70
|
+
thinking?: string;
|
|
71
|
+
/**
|
|
72
|
+
* The message to display when the chat is done executing a function.
|
|
73
|
+
* @default "✅ Done"
|
|
74
|
+
*/
|
|
75
|
+
done?: string;
|
|
76
|
+
/**
|
|
77
|
+
* The message to display when an error occurs.
|
|
78
|
+
* @default "❌ An error occurred. Please try again."
|
|
79
|
+
*/
|
|
80
|
+
error?: string;
|
|
81
|
+
/**
|
|
82
|
+
* The label to display on the stop button.
|
|
83
|
+
* @default "Stop generating"
|
|
84
|
+
*/
|
|
85
|
+
stopGenerating?: string;
|
|
86
|
+
/**
|
|
87
|
+
* The label to display on the regenerate button.
|
|
88
|
+
* @default "Regenerate response"
|
|
89
|
+
*/
|
|
90
|
+
regenerateResponse?: string;
|
|
91
|
+
}
|
|
92
|
+
interface ChatContext {
|
|
93
|
+
labels: Required<CopilotKitChatLabels>;
|
|
94
|
+
icons: Required<CopilotKitChatIcons>;
|
|
95
|
+
}
|
|
96
|
+
declare const ChatContext: React__default.Context<ChatContext | undefined>;
|
|
97
|
+
declare function useChatContext(): ChatContext;
|
|
98
|
+
interface ChatContextProps {
|
|
99
|
+
labels?: CopilotKitChatLabels;
|
|
100
|
+
icons?: CopilotKitChatIcons;
|
|
101
|
+
children?: React__default.ReactNode;
|
|
102
|
+
}
|
|
103
|
+
declare const ChatContextProvider: React__default.FC<ChatContextProps>;
|
|
104
|
+
|
|
105
|
+
export { ChatContext, ChatContextProvider, CopilotKitChatIcons, CopilotKitChatLabels, useChatContext };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FC } from 'react';
|
|
2
|
+
|
|
3
|
+
interface Props {
|
|
4
|
+
language: string;
|
|
5
|
+
value: string;
|
|
6
|
+
}
|
|
7
|
+
interface languageMap {
|
|
8
|
+
[key: string]: string | undefined;
|
|
9
|
+
}
|
|
10
|
+
declare const programmingLanguages: languageMap;
|
|
11
|
+
declare const generateRandomString: (length: number, lowercase?: boolean) => string;
|
|
12
|
+
declare const CodeBlock: FC<Props>;
|
|
13
|
+
|
|
14
|
+
export { CodeBlock, generateRandomString, programmingLanguages };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { CodeBlock, generateRandomString, programmingLanguages } from '../../chunk-NXWVWC33.mjs';
|
|
2
|
+
import '../../chunk-7YXG7D47.mjs';
|
|
3
|
+
import '../../chunk-POVINPXX.mjs';
|
|
4
|
+
import '../../chunk-MRXNTQOX.mjs';
|
|
5
|
+
//# sourceMappingURL=out.js.map
|
|
6
|
+
//# sourceMappingURL=CodeBlock.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
declare const OpenIcon: JSX.Element;
|
|
4
|
+
declare const CloseIcon: JSX.Element;
|
|
5
|
+
declare const HeaderCloseIcon: JSX.Element;
|
|
6
|
+
declare const SendIcon: JSX.Element;
|
|
7
|
+
declare const SpinnerIcon: JSX.Element;
|
|
8
|
+
declare const ActivityIcon: JSX.Element;
|
|
9
|
+
declare function CheckIcon({ className, ...props }: React__default.ComponentProps<"svg">): JSX.Element;
|
|
10
|
+
declare function DownloadIcon({ className, ...props }: React__default.ComponentProps<"svg">): JSX.Element;
|
|
11
|
+
declare function CopyIcon({ className, ...props }: React__default.ComponentProps<"svg">): JSX.Element;
|
|
12
|
+
declare const StopIcon: JSX.Element;
|
|
13
|
+
declare const RegenerateIcon: JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { ActivityIcon, CheckIcon, CloseIcon, CopyIcon, DownloadIcon, HeaderCloseIcon, OpenIcon, RegenerateIcon, SendIcon, SpinnerIcon, StopIcon };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { ActivityIcon, CheckIcon, CloseIcon, CopyIcon, DownloadIcon, HeaderCloseIcon, OpenIcon, RegenerateIcon, SendIcon, SpinnerIcon, StopIcon } from '../../chunk-7YXG7D47.mjs';
|
|
2
|
+
import '../../chunk-MRXNTQOX.mjs';
|
|
3
|
+
//# sourceMappingURL=out.js.map
|
|
4
|
+
//# sourceMappingURL=Icons.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Input } from '../../chunk-QFASQEFJ.mjs';
|
|
2
|
+
import '../../chunk-WM6BS77F.mjs';
|
|
3
|
+
import '../../chunk-6H3Y2XEI.mjs';
|
|
4
|
+
import '../../chunk-7YXG7D47.mjs';
|
|
5
|
+
import '../../chunk-MRXNTQOX.mjs';
|
|
6
|
+
//# sourceMappingURL=out.js.map
|
|
7
|
+
//# sourceMappingURL=Input.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { Markdown } from '../../chunk-UIRFLYXI.mjs';
|
|
2
|
+
import '../../chunk-NXWVWC33.mjs';
|
|
3
|
+
import '../../chunk-7YXG7D47.mjs';
|
|
4
|
+
import '../../chunk-POVINPXX.mjs';
|
|
5
|
+
import '../../chunk-MRXNTQOX.mjs';
|
|
6
|
+
//# sourceMappingURL=out.js.map
|
|
7
|
+
//# sourceMappingURL=Markdown.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|