@copilotkit/react-ui 1.3.7 → 1.3.8
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/CHANGELOG.md +10 -0
- package/dist/{chunk-7YQICPBC.mjs → chunk-3KBQXU44.mjs} +9 -9
- package/dist/{chunk-XSUSSWDS.mjs → chunk-3XAXY2Z3.mjs} +2 -2
- package/dist/{chunk-6VYMULPK.mjs → chunk-47OPG5FM.mjs} +9 -9
- package/dist/{chunk-RWT7WRG2.mjs → chunk-6BL5C56L.mjs} +2 -2
- package/dist/{chunk-DP5YVGNX.mjs → chunk-6INMITFA.mjs} +2 -2
- package/dist/{chunk-BJPGMY3I.mjs → chunk-CBBFRI3Q.mjs} +19 -8
- package/dist/{chunk-BJPGMY3I.mjs.map → chunk-CBBFRI3Q.mjs.map} +1 -1
- package/dist/{chunk-SHTMRY45.mjs → chunk-CPMIEVKK.mjs} +2 -2
- package/dist/{chunk-BNCTYKEP.mjs → chunk-JTINVYPK.mjs} +2 -2
- package/dist/{chunk-TYYJR3LE.mjs → chunk-KCAVDFB6.mjs} +2 -2
- package/dist/{chunk-YOH25I6N.mjs → chunk-RQNJNK2W.mjs} +2 -2
- package/dist/{chunk-JQOSF44H.mjs → chunk-SWADR6EH.mjs} +2 -2
- package/dist/{chunk-FLV3J3VX.mjs → chunk-VEC45H6Q.mjs} +2 -2
- package/dist/{chunk-WHSD7DBC.mjs → chunk-WYMTXCQU.mjs} +2 -2
- package/dist/{chunk-FO7Z5LAL.mjs → chunk-YAGE7RCE.mjs} +2 -2
- package/dist/{chunk-AAY3WWWC.mjs → chunk-ZABXREBH.mjs} +2 -2
- package/dist/components/chat/Button.js.map +1 -1
- package/dist/components/chat/Button.mjs +2 -2
- package/dist/components/chat/Chat.js +17 -6
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +9 -9
- package/dist/components/chat/ChatContext.js +17 -6
- package/dist/components/chat/ChatContext.js.map +1 -1
- package/dist/components/chat/ChatContext.mjs +1 -1
- package/dist/components/chat/Header.js.map +1 -1
- package/dist/components/chat/Header.mjs +2 -2
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +2 -2
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +2 -2
- package/dist/components/chat/Modal.js +17 -6
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +13 -13
- package/dist/components/chat/Popup.js +17 -6
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +14 -14
- package/dist/components/chat/Response.js.map +1 -1
- package/dist/components/chat/Response.mjs +2 -2
- package/dist/components/chat/Sidebar.js +17 -6
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +14 -14
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +2 -2
- package/dist/components/chat/index.js +17 -6
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +15 -15
- package/dist/components/chat/messages/RenderActionExecutionMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +2 -2
- package/dist/components/chat/messages/RenderAgentStateMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderAgentStateMessage.mjs +2 -2
- package/dist/components/chat/messages/RenderResultMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderResultMessage.mjs +2 -2
- package/dist/components/chat/messages/RenderTextMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderTextMessage.mjs +2 -2
- package/dist/components/index.js +17 -6
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +15 -15
- package/dist/index.js +17 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -15
- package/package.json +7 -7
- package/src/components/chat/ChatContext.tsx +21 -8
- /package/dist/{chunk-7YQICPBC.mjs.map → chunk-3KBQXU44.mjs.map} +0 -0
- /package/dist/{chunk-XSUSSWDS.mjs.map → chunk-3XAXY2Z3.mjs.map} +0 -0
- /package/dist/{chunk-6VYMULPK.mjs.map → chunk-47OPG5FM.mjs.map} +0 -0
- /package/dist/{chunk-RWT7WRG2.mjs.map → chunk-6BL5C56L.mjs.map} +0 -0
- /package/dist/{chunk-DP5YVGNX.mjs.map → chunk-6INMITFA.mjs.map} +0 -0
- /package/dist/{chunk-SHTMRY45.mjs.map → chunk-CPMIEVKK.mjs.map} +0 -0
- /package/dist/{chunk-BNCTYKEP.mjs.map → chunk-JTINVYPK.mjs.map} +0 -0
- /package/dist/{chunk-TYYJR3LE.mjs.map → chunk-KCAVDFB6.mjs.map} +0 -0
- /package/dist/{chunk-YOH25I6N.mjs.map → chunk-RQNJNK2W.mjs.map} +0 -0
- /package/dist/{chunk-JQOSF44H.mjs.map → chunk-SWADR6EH.mjs.map} +0 -0
- /package/dist/{chunk-FLV3J3VX.mjs.map → chunk-VEC45H6Q.mjs.map} +0 -0
- /package/dist/{chunk-WHSD7DBC.mjs.map → chunk-WYMTXCQU.mjs.map} +0 -0
- /package/dist/{chunk-FO7Z5LAL.mjs.map → chunk-YAGE7RCE.mjs.map} +0 -0
- /package/dist/{chunk-AAY3WWWC.mjs.map → chunk-ZABXREBH.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# ui
|
|
2
2
|
|
|
3
|
+
## 1.3.8
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix textarea on multiple llm providers and memoize react ui context
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @copilotkit/react-core@1.3.8
|
|
10
|
+
- @copilotkit/runtime-client-gql@1.3.8
|
|
11
|
+
- @copilotkit/shared@1.3.8
|
|
12
|
+
|
|
3
13
|
## 1.3.7
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RenderActionExecutionMessage
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6BL5C56L.mjs";
|
|
4
4
|
import {
|
|
5
5
|
RenderAgentStateMessage
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-ZABXREBH.mjs";
|
|
7
7
|
import {
|
|
8
8
|
RenderResultMessage
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-6INMITFA.mjs";
|
|
10
10
|
import {
|
|
11
11
|
RenderTextMessage
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-WYMTXCQU.mjs";
|
|
13
13
|
import {
|
|
14
14
|
Suggestion,
|
|
15
15
|
reloadSuggestions
|
|
@@ -19,17 +19,17 @@ import {
|
|
|
19
19
|
} from "./chunk-RS6UPR5N.mjs";
|
|
20
20
|
import {
|
|
21
21
|
Input
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-JTINVYPK.mjs";
|
|
23
23
|
import {
|
|
24
24
|
Messages
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-CPMIEVKK.mjs";
|
|
26
26
|
import {
|
|
27
27
|
ResponseButton
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-3XAXY2Z3.mjs";
|
|
29
29
|
import {
|
|
30
30
|
ChatContext,
|
|
31
31
|
ChatContextProvider
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-CBBFRI3Q.mjs";
|
|
33
33
|
import {
|
|
34
34
|
__async,
|
|
35
35
|
__spreadValues
|
|
@@ -198,4 +198,4 @@ export {
|
|
|
198
198
|
WrappedCopilotChat,
|
|
199
199
|
useCopilotChatLogic
|
|
200
200
|
};
|
|
201
|
-
//# sourceMappingURL=chunk-
|
|
201
|
+
//# sourceMappingURL=chunk-3KBQXU44.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useChatContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CBBFRI3Q.mjs";
|
|
4
4
|
|
|
5
5
|
// src/components/chat/Response.tsx
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -15,4 +15,4 @@ var ResponseButton = ({ onClick, inProgress }) => {
|
|
|
15
15
|
export {
|
|
16
16
|
ResponseButton
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-3XAXY2Z3.mjs.map
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Window
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YAGE7RCE.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Header
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-VEC45H6Q.mjs";
|
|
7
7
|
import {
|
|
8
8
|
Button
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RQNJNK2W.mjs";
|
|
10
10
|
import {
|
|
11
11
|
CopilotChat
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-3KBQXU44.mjs";
|
|
13
13
|
import {
|
|
14
14
|
Input
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-JTINVYPK.mjs";
|
|
16
16
|
import {
|
|
17
17
|
Messages
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-CPMIEVKK.mjs";
|
|
19
19
|
import {
|
|
20
20
|
ResponseButton
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-3XAXY2Z3.mjs";
|
|
22
22
|
import {
|
|
23
23
|
ChatContextProvider
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-CBBFRI3Q.mjs";
|
|
25
25
|
|
|
26
26
|
// src/components/chat/Modal.tsx
|
|
27
27
|
import React from "react";
|
|
@@ -88,4 +88,4 @@ var CopilotModal = ({
|
|
|
88
88
|
export {
|
|
89
89
|
CopilotModal
|
|
90
90
|
};
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
91
|
+
//# sourceMappingURL=chunk-47OPG5FM.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useChatContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CBBFRI3Q.mjs";
|
|
4
4
|
|
|
5
5
|
// src/components/chat/messages/RenderActionExecutionMessage.tsx
|
|
6
6
|
import { MessageStatusCode } from "@copilotkit/runtime-client-gql";
|
|
@@ -73,4 +73,4 @@ function RenderActionExecutionMessage(props) {
|
|
|
73
73
|
export {
|
|
74
74
|
RenderActionExecutionMessage
|
|
75
75
|
};
|
|
76
|
-
//# sourceMappingURL=chunk-
|
|
76
|
+
//# sourceMappingURL=chunk-6BL5C56L.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useChatContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CBBFRI3Q.mjs";
|
|
4
4
|
|
|
5
5
|
// src/components/chat/messages/RenderResultMessage.tsx
|
|
6
6
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -15,4 +15,4 @@ function RenderResultMessage(props) {
|
|
|
15
15
|
export {
|
|
16
16
|
RenderResultMessage
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-6INMITFA.mjs.map
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from "./chunk-MRXNTQOX.mjs";
|
|
15
15
|
|
|
16
16
|
// src/components/chat/ChatContext.tsx
|
|
17
|
-
import React from "react";
|
|
17
|
+
import React, { useMemo } from "react";
|
|
18
18
|
import { jsx } from "react/jsx-runtime";
|
|
19
19
|
var ChatContext = React.createContext(void 0);
|
|
20
20
|
function useChatContext() {
|
|
@@ -36,8 +36,8 @@ var ChatContextProvider = ({
|
|
|
36
36
|
open,
|
|
37
37
|
setOpen
|
|
38
38
|
}) => {
|
|
39
|
-
const
|
|
40
|
-
|
|
39
|
+
const memoizedLabels = useMemo(
|
|
40
|
+
() => __spreadValues(__spreadValues({}, {
|
|
41
41
|
initial: "",
|
|
42
42
|
title: "CopilotKit",
|
|
43
43
|
placeholder: "Type a message...",
|
|
@@ -45,7 +45,10 @@ var ChatContextProvider = ({
|
|
|
45
45
|
stopGenerating: "Stop generating",
|
|
46
46
|
regenerateResponse: "Regenerate response"
|
|
47
47
|
}), labels),
|
|
48
|
-
|
|
48
|
+
[labels]
|
|
49
|
+
);
|
|
50
|
+
const memoizedIcons = useMemo(
|
|
51
|
+
() => __spreadValues(__spreadValues({}, {
|
|
49
52
|
openIcon: OpenIcon,
|
|
50
53
|
closeIcon: CloseIcon,
|
|
51
54
|
headerCloseIcon: HeaderCloseIcon,
|
|
@@ -56,9 +59,17 @@ var ChatContextProvider = ({
|
|
|
56
59
|
regenerateIcon: RegenerateIcon,
|
|
57
60
|
pushToTalkIcon: PushToTalkIcon
|
|
58
61
|
}), icons),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
+
[icons]
|
|
63
|
+
);
|
|
64
|
+
const context = useMemo(
|
|
65
|
+
() => ({
|
|
66
|
+
labels: memoizedLabels,
|
|
67
|
+
icons: memoizedIcons,
|
|
68
|
+
open,
|
|
69
|
+
setOpen
|
|
70
|
+
}),
|
|
71
|
+
[memoizedLabels, memoizedIcons, open, setOpen]
|
|
72
|
+
);
|
|
62
73
|
return /* @__PURE__ */ jsx(ChatContext.Provider, { value: context, children });
|
|
63
74
|
};
|
|
64
75
|
|
|
@@ -67,4 +78,4 @@ export {
|
|
|
67
78
|
useChatContext,
|
|
68
79
|
ChatContextProvider
|
|
69
80
|
};
|
|
70
|
-
//# sourceMappingURL=chunk-
|
|
81
|
+
//# sourceMappingURL=chunk-CBBFRI3Q.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/chat/ChatContext.tsx"],"sourcesContent":["import React, { useMemo, useState } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n\n /**\n * The icons to use for push to talk.\n * @default <PushToTalkIcon />\n */\n\n pushToTalkIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n open,\n setOpen,\n}: ChatContextProps) => {\n const
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/ChatContext.tsx"],"sourcesContent":["import React, { useMemo, useState } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n\n /**\n * The icons to use for push to talk.\n * @default <PushToTalkIcon />\n */\n\n pushToTalkIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n open,\n setOpen,\n}: ChatContextProps) => {\n const memoizedLabels = useMemo(\n () => ({\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n },\n ...labels,\n }),\n [labels],\n );\n\n const memoizedIcons = useMemo(\n () => ({\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n pushToTalkIcon: DefaultIcons.PushToTalkIcon,\n },\n ...icons,\n }),\n [icons],\n );\n\n const context = useMemo(\n () => ({\n labels: memoizedLabels,\n icons: memoizedIcons,\n open,\n setOpen,\n }),\n [memoizedLabels, memoizedIcons, open, setOpen],\n );\n\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAO,SAAS,eAAyB;AA0LhC;AA5EF,IAAM,cAAc,MAAM,cAAuC,MAAS;AAE1E,SAAS,iBAA8B;AAC5C,QAAM,UAAU,MAAM,WAAW,WAAW;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAaO,IAAM,sBAAsB,CAAC;AAAA;AAAA;AAAA;AAAA,EAIlC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAwB;AACtB,QAAM,iBAAiB;AAAA,IACrB,MAAO,kCACF;AAAA,MACD,SAAS;AAAA,MACT,OAAO;AAAA,MACP,aAAa;AAAA,MACb,OAAO;AAAA,MACP,gBAAgB;AAAA,MAChB,oBAAoB;AAAA,IACtB,IACG;AAAA,IAEL,CAAC,MAAM;AAAA,EACT;AAEA,QAAM,gBAAgB;AAAA,IACpB,MAAO,kCACF;AAAA,MACD,UAAuB;AAAA,MACvB,WAAwB;AAAA,MACxB,iBAA8B;AAAA,MAC9B,UAAuB;AAAA,MACvB,cAA2B;AAAA,MAC3B,aAA0B;AAAA,MAC1B,UAAuB;AAAA,MACvB,gBAA6B;AAAA,MAC7B,gBAA6B;AAAA,IAC/B,IACG;AAAA,IAEL,CAAC,KAAK;AAAA,EACR;AAEA,QAAM,UAAU;AAAA,IACd,OAAO;AAAA,MACL,QAAQ;AAAA,MACR,OAAO;AAAA,MACP;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,gBAAgB,eAAe,MAAM,OAAO;AAAA,EAC/C;AAEA,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAO,SAAU,UAAS;AACzD;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useChatContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CBBFRI3Q.mjs";
|
|
4
4
|
|
|
5
5
|
// src/components/chat/Messages.tsx
|
|
6
6
|
import React, { useEffect, useMemo } from "react";
|
|
@@ -121,4 +121,4 @@ function makeInitialMessages(initial) {
|
|
|
121
121
|
export {
|
|
122
122
|
Messages
|
|
123
123
|
};
|
|
124
|
-
//# sourceMappingURL=chunk-
|
|
124
|
+
//# sourceMappingURL=chunk-CPMIEVKK.mjs.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-YQFVRDNC.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useChatContext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CBBFRI3Q.mjs";
|
|
7
7
|
import {
|
|
8
8
|
usePushToTalk
|
|
9
9
|
} from "./chunk-S5MBUNGN.mjs";
|
|
@@ -80,4 +80,4 @@ var Input = ({ inProgress, onSend, isVisible = false }) => {
|
|
|
80
80
|
export {
|
|
81
81
|
Input
|
|
82
82
|
};
|
|
83
|
-
//# sourceMappingURL=chunk-
|
|
83
|
+
//# sourceMappingURL=chunk-JTINVYPK.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-47OPG5FM.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__spreadProps,
|
|
6
6
|
__spreadValues
|
|
@@ -27,4 +27,4 @@ function CopilotSidebar(props) {
|
|
|
27
27
|
export {
|
|
28
28
|
CopilotSidebar
|
|
29
29
|
};
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-KCAVDFB6.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useChatContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CBBFRI3Q.mjs";
|
|
4
4
|
|
|
5
5
|
// src/components/chat/Button.tsx
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -22,4 +22,4 @@ var Button = ({}) => {
|
|
|
22
22
|
export {
|
|
23
23
|
Button
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-RQNJNK2W.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-47OPG5FM.mjs";
|
|
4
4
|
import {
|
|
5
5
|
__spreadProps,
|
|
6
6
|
__spreadValues
|
|
@@ -18,4 +18,4 @@ function CopilotPopup(props) {
|
|
|
18
18
|
export {
|
|
19
19
|
CopilotPopup
|
|
20
20
|
};
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-SWADR6EH.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useChatContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CBBFRI3Q.mjs";
|
|
4
4
|
|
|
5
5
|
// src/components/chat/Header.tsx
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -15,4 +15,4 @@ var Header = ({}) => {
|
|
|
15
15
|
export {
|
|
16
16
|
Header
|
|
17
17
|
};
|
|
18
|
-
//# sourceMappingURL=chunk-
|
|
18
|
+
//# sourceMappingURL=chunk-VEC45H6Q.mjs.map
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-YQ3D5IQV.mjs";
|
|
4
4
|
import {
|
|
5
5
|
useChatContext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CBBFRI3Q.mjs";
|
|
7
7
|
|
|
8
8
|
// src/components/chat/messages/RenderTextMessage.tsx
|
|
9
9
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -22,4 +22,4 @@ function RenderTextMessage(props) {
|
|
|
22
22
|
export {
|
|
23
23
|
RenderTextMessage
|
|
24
24
|
};
|
|
25
|
-
//# sourceMappingURL=chunk-
|
|
25
|
+
//# sourceMappingURL=chunk-WYMTXCQU.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useChatContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CBBFRI3Q.mjs";
|
|
4
4
|
|
|
5
5
|
// src/components/chat/Window.tsx
|
|
6
6
|
import React, { useCallback, useEffect } from "react";
|
|
@@ -115,4 +115,4 @@ function isMacOS() {
|
|
|
115
115
|
export {
|
|
116
116
|
Window
|
|
117
117
|
};
|
|
118
|
-
//# sourceMappingURL=chunk-
|
|
118
|
+
//# sourceMappingURL=chunk-YAGE7RCE.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useChatContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-CBBFRI3Q.mjs";
|
|
4
4
|
|
|
5
5
|
// src/components/chat/messages/RenderAgentStateMessage.tsx
|
|
6
6
|
import { useCopilotContext } from "@copilotkit/react-core";
|
|
@@ -62,4 +62,4 @@ function RenderAgentStateMessage(props) {
|
|
|
62
62
|
export {
|
|
63
63
|
RenderAgentStateMessage
|
|
64
64
|
};
|
|
65
|
-
//# sourceMappingURL=chunk-
|
|
65
|
+
//# sourceMappingURL=chunk-ZABXREBH.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/chat/Button.tsx","../../../src/components/chat/ChatContext.tsx"],"sourcesContent":["import { ButtonProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Button = ({}: ButtonProps) => {\n const { open, setOpen, icons } = useChatContext();\n\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\">{icons.openIcon}</div>\n <div className=\"copilotKitButtonIcon copilotKitButtonIconClose\">{icons.closeIcon}</div>\n </button>\n </div>\n );\n};\n","import React, { useMemo, useState } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n\n /**\n * The icons to use for push to talk.\n * @default <PushToTalkIcon />\n */\n\n pushToTalkIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n open,\n setOpen,\n}: ChatContextProps) => {\n const
|
|
1
|
+
{"version":3,"sources":["../../../src/components/chat/Button.tsx","../../../src/components/chat/ChatContext.tsx"],"sourcesContent":["import { ButtonProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Button = ({}: ButtonProps) => {\n const { open, setOpen, icons } = useChatContext();\n\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\">{icons.openIcon}</div>\n <div className=\"copilotKitButtonIcon copilotKitButtonIconClose\">{icons.closeIcon}</div>\n </button>\n </div>\n );\n};\n","import React, { useMemo, useState } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n\n /**\n * The icons to use for push to talk.\n * @default <PushToTalkIcon />\n */\n\n pushToTalkIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n open,\n setOpen,\n}: ChatContextProps) => {\n const memoizedLabels = useMemo(\n () => ({\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n },\n ...labels,\n }),\n [labels],\n );\n\n const memoizedIcons = useMemo(\n () => ({\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n pushToTalkIcon: DefaultIcons.PushToTalkIcon,\n },\n ...icons,\n }),\n [icons],\n );\n\n const context = useMemo(\n () => ({\n labels: memoizedLabels,\n icons: memoizedIcons,\n open,\n setOpen,\n }),\n [memoizedLabels, memoizedIcons, open, setOpen],\n );\n\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAyC;AA0LhC;AA5EF,IAAM,cAAc,aAAAA,QAAM,cAAuC,MAAS;AAE1E,SAAS,iBAA8B;AAC5C,QAAM,UAAU,aAAAA,QAAM,WAAW,WAAW;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;;;ADhHM,IAAAC,sBAAA;AALC,IAAM,SAAS,CAAC,CAAC,MAAmB;AACzC,QAAM,EAAE,MAAM,SAAS,MAAM,IAAI,eAAe;AAEhD,SACE,6CAAC,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,qDAAC,SAAI,WAAU,iDAAiD,gBAAM,UAAS;AAAA,QAC/E,6CAAC,SAAI,WAAU,kDAAkD,gBAAM,WAAU;AAAA;AAAA;AAAA,EACnF,GACF;AAEJ;","names":["React","import_jsx_runtime"]}
|
|
@@ -350,8 +350,8 @@ var ChatContextProvider = ({
|
|
|
350
350
|
open,
|
|
351
351
|
setOpen
|
|
352
352
|
}) => {
|
|
353
|
-
const
|
|
354
|
-
|
|
353
|
+
const memoizedLabels = (0, import_react.useMemo)(
|
|
354
|
+
() => __spreadValues(__spreadValues({}, {
|
|
355
355
|
initial: "",
|
|
356
356
|
title: "CopilotKit",
|
|
357
357
|
placeholder: "Type a message...",
|
|
@@ -359,7 +359,10 @@ var ChatContextProvider = ({
|
|
|
359
359
|
stopGenerating: "Stop generating",
|
|
360
360
|
regenerateResponse: "Regenerate response"
|
|
361
361
|
}), labels),
|
|
362
|
-
|
|
362
|
+
[labels]
|
|
363
|
+
);
|
|
364
|
+
const memoizedIcons = (0, import_react.useMemo)(
|
|
365
|
+
() => __spreadValues(__spreadValues({}, {
|
|
363
366
|
openIcon: OpenIcon,
|
|
364
367
|
closeIcon: CloseIcon,
|
|
365
368
|
headerCloseIcon: HeaderCloseIcon,
|
|
@@ -370,9 +373,17 @@ var ChatContextProvider = ({
|
|
|
370
373
|
regenerateIcon: RegenerateIcon,
|
|
371
374
|
pushToTalkIcon: PushToTalkIcon
|
|
372
375
|
}), icons),
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
+
[icons]
|
|
377
|
+
);
|
|
378
|
+
const context = (0, import_react.useMemo)(
|
|
379
|
+
() => ({
|
|
380
|
+
labels: memoizedLabels,
|
|
381
|
+
icons: memoizedIcons,
|
|
382
|
+
open,
|
|
383
|
+
setOpen
|
|
384
|
+
}),
|
|
385
|
+
[memoizedLabels, memoizedIcons, open, setOpen]
|
|
386
|
+
);
|
|
376
387
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ChatContext.Provider, { value: context, children });
|
|
377
388
|
};
|
|
378
389
|
|