@copilotkit/react-ui 1.5.1-next.1 → 1.5.1-next.3
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 +22 -0
- package/dist/{chunk-F2W5FD7L.mjs → chunk-2B57NCBA.mjs} +3 -3
- package/dist/{chunk-PNQVKBPN.mjs → chunk-4FIGRRFS.mjs} +2 -2
- package/dist/{chunk-PNQVKBPN.mjs.map → chunk-4FIGRRFS.mjs.map} +1 -1
- package/dist/{chunk-EMQEEXUB.mjs → chunk-4LUMV4YO.mjs} +3 -8
- package/dist/chunk-4LUMV4YO.mjs.map +1 -0
- package/dist/{chunk-BH6PCAAL.mjs → chunk-4T3TMQNJ.mjs} +2 -38
- package/dist/chunk-4T3TMQNJ.mjs.map +1 -0
- package/dist/{chunk-UWVGLGFQ.mjs → chunk-63ZKP62F.mjs} +4 -8
- package/dist/chunk-63ZKP62F.mjs.map +1 -0
- package/dist/{chunk-DCNCY2PL.mjs → chunk-DHGDU64D.mjs} +11 -114
- package/dist/chunk-DHGDU64D.mjs.map +1 -0
- package/dist/{chunk-3E7HY2UN.mjs → chunk-OMTPWC7T.mjs} +4 -5
- package/dist/chunk-OMTPWC7T.mjs.map +1 -0
- package/dist/{chunk-7II4YL7R.mjs → chunk-RKPANT3F.mjs} +6 -2
- package/dist/chunk-RKPANT3F.mjs.map +1 -0
- package/dist/{chunk-WSMMTZCM.mjs → chunk-TKFQ7VQR.mjs} +2 -2
- package/dist/{chunk-375NVWZM.mjs → chunk-VYKDFXGS.mjs} +2 -2
- package/dist/chunk-WOUWNTAV.mjs +72 -0
- package/dist/chunk-WOUWNTAV.mjs.map +1 -0
- package/dist/components/chat/Chat.d.ts +5 -50
- package/dist/components/chat/Chat.js +41 -249
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +8 -8
- package/dist/components/chat/Input.js +2 -7
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +1 -1
- package/dist/components/chat/Messages.d.ts +3 -3
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +1 -1
- package/dist/components/chat/Modal.d.ts +1 -1
- package/dist/components/chat/Modal.js +41 -253
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +9 -9
- package/dist/components/chat/Popup.js +41 -253
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +10 -10
- package/dist/components/chat/Sidebar.js +41 -253
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +10 -10
- package/dist/components/chat/index.js +41 -253
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +11 -11
- package/dist/components/chat/messages/RenderActionExecutionMessage.js +3 -4
- package/dist/components/chat/messages/RenderActionExecutionMessage.js.map +1 -1
- package/dist/components/chat/messages/RenderActionExecutionMessage.mjs +1 -1
- package/dist/components/dev-console/console.js +28 -128
- package/dist/components/dev-console/console.js.map +1 -1
- package/dist/components/dev-console/console.mjs +4 -4
- package/dist/components/dev-console/index.js +28 -128
- package/dist/components/dev-console/index.js.map +1 -1
- package/dist/components/dev-console/index.mjs +4 -4
- package/dist/components/dev-console/utils.js +1 -1
- package/dist/components/dev-console/utils.js.map +1 -1
- package/dist/components/dev-console/utils.mjs +1 -1
- package/dist/components/help-modal/icons.d.ts +1 -4
- package/dist/components/help-modal/icons.js +2 -39
- package/dist/components/help-modal/icons.js.map +1 -1
- package/dist/components/help-modal/icons.mjs +3 -5
- package/dist/components/help-modal/index.js +27 -147
- package/dist/components/help-modal/index.js.map +1 -1
- package/dist/components/help-modal/index.mjs +2 -2
- package/dist/components/help-modal/modal.js +27 -147
- package/dist/components/help-modal/modal.js.map +1 -1
- package/dist/components/help-modal/modal.mjs +2 -2
- package/dist/components/index.js +41 -253
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +11 -11
- package/dist/index.js +43 -255
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/package.json +4 -4
- package/dist/chunk-3E7HY2UN.mjs.map +0 -1
- package/dist/chunk-7II4YL7R.mjs.map +0 -1
- package/dist/chunk-BH6PCAAL.mjs.map +0 -1
- package/dist/chunk-DCNCY2PL.mjs.map +0 -1
- package/dist/chunk-EMQEEXUB.mjs.map +0 -1
- package/dist/chunk-TI7SY2RI.mjs +0 -164
- package/dist/chunk-TI7SY2RI.mjs.map +0 -1
- package/dist/chunk-UWVGLGFQ.mjs.map +0 -1
- /package/dist/{chunk-F2W5FD7L.mjs.map → chunk-2B57NCBA.mjs.map} +0 -0
- /package/dist/{chunk-WSMMTZCM.mjs.map → chunk-TKFQ7VQR.mjs.map} +0 -0
- /package/dist/{chunk-375NVWZM.mjs.map → chunk-VYKDFXGS.mjs.map} +0 -0
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import "../../chunk-MRFF7GSQ.mjs";
|
|
2
2
|
import {
|
|
3
3
|
CopilotSidebar
|
|
4
|
-
} from "../../chunk-
|
|
4
|
+
} from "../../chunk-TKFQ7VQR.mjs";
|
|
5
5
|
import "../../chunk-WB3YULQ4.mjs";
|
|
6
6
|
import {
|
|
7
7
|
CopilotPopup
|
|
8
|
-
} from "../../chunk-
|
|
9
|
-
import "../../chunk-
|
|
8
|
+
} from "../../chunk-VYKDFXGS.mjs";
|
|
9
|
+
import "../../chunk-63ZKP62F.mjs";
|
|
10
10
|
import "../../chunk-YAGE7RCE.mjs";
|
|
11
11
|
import "../../chunk-VEC45H6Q.mjs";
|
|
12
12
|
import "../../chunk-RQNJNK2W.mjs";
|
|
13
13
|
import {
|
|
14
14
|
CopilotChat
|
|
15
|
-
} from "../../chunk-
|
|
15
|
+
} from "../../chunk-DHGDU64D.mjs";
|
|
16
16
|
import "../../chunk-6INMITFA.mjs";
|
|
17
17
|
import "../../chunk-RU73BEZM.mjs";
|
|
18
18
|
import "../../chunk-V7W6IM2V.mjs";
|
|
19
|
-
import "../../chunk-
|
|
19
|
+
import "../../chunk-OMTPWC7T.mjs";
|
|
20
20
|
import "../../chunk-ZABXREBH.mjs";
|
|
21
21
|
import "../../chunk-RJCZRKTV.mjs";
|
|
22
|
-
import "../../chunk-
|
|
23
|
-
import "../../chunk-
|
|
22
|
+
import "../../chunk-2B57NCBA.mjs";
|
|
23
|
+
import "../../chunk-4FIGRRFS.mjs";
|
|
24
24
|
import "../../chunk-KXE2JCUH.mjs";
|
|
25
|
-
import "../../chunk-
|
|
26
|
-
import "../../chunk-
|
|
25
|
+
import "../../chunk-WOUWNTAV.mjs";
|
|
26
|
+
import "../../chunk-4T3TMQNJ.mjs";
|
|
27
27
|
import "../../chunk-OTPAZXVR.mjs";
|
|
28
|
-
import "../../chunk-
|
|
28
|
+
import "../../chunk-4LUMV4YO.mjs";
|
|
29
29
|
import "../../chunk-YQFVRDNC.mjs";
|
|
30
30
|
import "../../chunk-YQ3D5IQV.mjs";
|
|
31
|
-
import "../../chunk-
|
|
31
|
+
import "../../chunk-RKPANT3F.mjs";
|
|
32
32
|
import "../../chunk-3XAXY2Z3.mjs";
|
|
33
33
|
import {
|
|
34
34
|
useChatContext
|
|
@@ -57,8 +57,8 @@ function RenderActionExecutionMessage(props) {
|
|
|
57
57
|
const { chatComponentsCache } = (0, import_react_core.useCopilotContext)();
|
|
58
58
|
const { icons } = useChatContext();
|
|
59
59
|
if (message.isActionExecutionMessage()) {
|
|
60
|
-
if (chatComponentsCache.current !== null &&
|
|
61
|
-
const render = chatComponentsCache.current.actions[message.name]
|
|
60
|
+
if (chatComponentsCache.current !== null && chatComponentsCache.current.actions[message.name]) {
|
|
61
|
+
const render = chatComponentsCache.current.actions[message.name];
|
|
62
62
|
if (typeof render === "string") {
|
|
63
63
|
if (isCurrentMessage && inProgress) {
|
|
64
64
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
|
|
@@ -81,8 +81,7 @@ function RenderActionExecutionMessage(props) {
|
|
|
81
81
|
const toRender = render({
|
|
82
82
|
status,
|
|
83
83
|
args,
|
|
84
|
-
result: actionResult
|
|
85
|
-
name: message.name
|
|
84
|
+
result: actionResult
|
|
86
85
|
});
|
|
87
86
|
if (!toRender && status === "complete") {
|
|
88
87
|
return null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/chat/messages/RenderActionExecutionMessage.tsx","../../../../src/components/chat/ChatContext.tsx"],"sourcesContent":["import { MessageStatusCode } from \"@copilotkit/runtime-client-gql\";\nimport { RenderMessageProps } from \"../props\";\nimport { useChatContext } from \"../ChatContext\";\nimport { RenderFunctionStatus, useCopilotContext } from \"@copilotkit/react-core\";\n\nexport function RenderActionExecutionMessage(props: RenderMessageProps) {\n const { message, inProgress, index, isCurrentMessage, actionResult } = props;\n const { chatComponentsCache } = useCopilotContext();\n const { icons } = useChatContext();\n\n if (message.isActionExecutionMessage()) {\n if (\n chatComponentsCache.current !== null &&\n (chatComponentsCache.current.actions[message.name] ||\n chatComponentsCache.current.actions[\"*\"])\n ) {\n const render =\n chatComponentsCache.current.actions[message.name] ||\n chatComponentsCache.current.actions[\"*\"];\n // render a static string\n if (typeof render === \"string\") {\n // when render is static, we show it only when in progress\n if (isCurrentMessage && inProgress) {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {icons.spinnerIcon} <span className=\"inProgressLabel\">{render}</span>\n </div>\n );\n }\n // Done - silent by default to avoid a series of \"done\" messages\n else {\n return null;\n }\n }\n // render is a function\n else {\n const args = message.arguments;\n\n let status: RenderFunctionStatus = \"inProgress\";\n\n if (actionResult !== undefined) {\n status = \"complete\";\n } else if (message.status.code !== MessageStatusCode.Pending) {\n status = \"executing\";\n }\n\n try {\n const toRender = render({\n status: status as any,\n args,\n result: actionResult,\n name: message.name,\n });\n // No result and complete: stay silent\n if (!toRender && status === \"complete\") {\n return null;\n }\n if (typeof toRender === \"string\") {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {isCurrentMessage && inProgress && icons.spinnerIcon} {toRender}\n </div>\n );\n } else {\n return (\n <div\n key={index}\n data-message-type=\"action-render\"\n className=\"copilotKitCustomAssistantMessage\"\n >\n {toRender}\n </div>\n );\n }\n } catch (e) {\n console.error(`Error executing render function for action ${message.name}: ${e}`);\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {isCurrentMessage && inProgress && icons.spinnerIcon}\n <b>❌ Error executing render: {message.name}</b>\n <br />\n {e instanceof Error ? e.message : String(e)}\n </div>\n );\n }\n }\n }\n // No render function found- show the default message\n else if (!inProgress || !isCurrentMessage) {\n // Done - silent by default to avoid a series of \"done\" messages\n return null;\n } else {\n // In progress\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {icons.spinnerIcon}\n </div>\n );\n }\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;AAAA,gCAAkC;;;ACAlC,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;;;ADrHA,wBAAwD;AAqB5C,IAAAC,sBAAA;AAnBL,SAAS,6BAA6B,OAA2B;AACtE,QAAM,EAAE,SAAS,YAAY,OAAO,kBAAkB,aAAa,IAAI;AACvE,QAAM,EAAE,oBAAoB,QAAI,qCAAkB;AAClD,QAAM,EAAE,MAAM,IAAI,eAAe;AAEjC,MAAI,QAAQ,yBAAyB,GAAG;AACtC,QACE,oBAAoB,YAAY,SAC/B,oBAAoB,QAAQ,QAAQ,QAAQ,IAAI,KAC/C,oBAAoB,QAAQ,QAAQ,GAAG,IACzC;AACA,YAAM,SACJ,oBAAoB,QAAQ,QAAQ,QAAQ,IAAI,KAChD,oBAAoB,QAAQ,QAAQ,GAAG;AAEzC,UAAI,OAAO,WAAW,UAAU;AAE9B,YAAI,oBAAoB,YAAY;AAClC,iBACE,8CAAC,SAAgB,WAAW,gDACzB;AAAA,kBAAM;AAAA,YAAY;AAA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_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/chat/messages/RenderActionExecutionMessage.tsx","../../../../src/components/chat/ChatContext.tsx"],"sourcesContent":["import { ActionExecutionMessage, MessageStatusCode } from \"@copilotkit/runtime-client-gql\";\nimport { RenderMessageProps } from \"../props\";\nimport { useChatContext } from \"../ChatContext\";\nimport { RenderFunctionStatus, useCopilotContext } from \"@copilotkit/react-core\";\n\nexport function RenderActionExecutionMessage(props: RenderMessageProps) {\n const { message, inProgress, index, isCurrentMessage, actionResult } = props;\n const { chatComponentsCache } = useCopilotContext();\n const { icons } = useChatContext();\n\n if (message.isActionExecutionMessage()) {\n if (chatComponentsCache.current !== null && chatComponentsCache.current.actions[message.name]) {\n const render = chatComponentsCache.current.actions[message.name];\n // render a static string\n if (typeof render === \"string\") {\n // when render is static, we show it only when in progress\n if (isCurrentMessage && inProgress) {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {icons.spinnerIcon} <span className=\"inProgressLabel\">{render}</span>\n </div>\n );\n }\n // Done - silent by default to avoid a series of \"done\" messages\n else {\n return null;\n }\n }\n // render is a function\n else {\n const args = message.arguments;\n\n let status: RenderFunctionStatus = \"inProgress\";\n\n if (actionResult !== undefined) {\n status = \"complete\";\n } else if (message.status.code !== MessageStatusCode.Pending) {\n status = \"executing\";\n }\n\n try {\n const toRender = render({\n status: status as any,\n args,\n result: actionResult,\n });\n // No result and complete: stay silent\n if (!toRender && status === \"complete\") {\n return null;\n }\n if (typeof toRender === \"string\") {\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {isCurrentMessage && inProgress && icons.spinnerIcon} {toRender}\n </div>\n );\n } else {\n return (\n <div\n key={index}\n data-message-type=\"action-render\"\n className=\"copilotKitCustomAssistantMessage\"\n >\n {toRender}\n </div>\n );\n }\n } catch (e) {\n console.error(`Error executing render function for action ${message.name}: ${e}`);\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {isCurrentMessage && inProgress && icons.spinnerIcon}\n <b>❌ Error executing render: {message.name}</b>\n <br />\n {e instanceof Error ? e.message : String(e)}\n </div>\n );\n }\n }\n }\n // No render function found- show the default message\n else if (!inProgress || !isCurrentMessage) {\n // Done - silent by default to avoid a series of \"done\" messages\n return null;\n } else {\n // In progress\n return (\n <div key={index} className={`copilotKitMessage copilotKitAssistantMessage`}>\n {icons.spinnerIcon}\n </div>\n );\n }\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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A,YACA;AAAA,YACA,QAAQ;AAAA,UACV,CAAC;AAED,cAAI,CAAC,YAAY,WAAW,YAAY;AACtC,mBAAO;AAAA,UACT;AACA,cAAI,OAAO,aAAa,UAAU;AAChC,mBACE,8CAAC,SAAgB,WAAW,gDACzB;AAAA,kCAAoB,cAAc,MAAM;AAAA,cAAY;AAAA,cAAE;AAAA,iBAD/C,KAEV;AAAA,UAEJ,OAAO;AACL,mBACE;AAAA,cAAC;AAAA;AAAA,gBAEC,qBAAkB;AAAA,gBAClB,WAAU;AAAA,gBAET;AAAA;AAAA,cAJI;AAAA,YAKP;AAAA,UAEJ;AAAA,QACF,SAAS,GAAP;AACA,kBAAQ,MAAM,8CAA8C,QAAQ,SAAS,GAAG;AAChF,iBACE,8CAAC,SAAgB,WAAW,gDACzB;AAAA,gCAAoB,cAAc,MAAM;AAAA,YACzC,8CAAC,OAAE;AAAA;AAAA,cAA2B,QAAQ;AAAA,eAAK;AAAA,YAC3C,6CAAC,QAAG;AAAA,YACH,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC;AAAA,eAJlC,KAKV;AAAA,QAEJ;AAAA,MACF;AAAA,IACF,WAES,CAAC,cAAc,CAAC,kBAAkB;AAEzC,aAAO;AAAA,IACT,OAAO;AAEL,aACE,6CAAC,SAAgB,WAAW,gDACzB,gBAAM,eADC,KAEV;AAAA,IAEJ;AAAA,EACF;AACF;","names":["React","import_jsx_runtime"]}
|
|
@@ -153,7 +153,7 @@ function logMessages(context) {
|
|
|
153
153
|
type: "ActionExecutionMessage",
|
|
154
154
|
role: void 0,
|
|
155
155
|
name: message.name,
|
|
156
|
-
scope: message.
|
|
156
|
+
scope: message.scope,
|
|
157
157
|
content: message.arguments
|
|
158
158
|
};
|
|
159
159
|
} else if (message.isResultMessage()) {
|
|
@@ -312,52 +312,41 @@ var import_react = require("react");
|
|
|
312
312
|
|
|
313
313
|
// src/components/help-modal/icons.tsx
|
|
314
314
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
315
|
-
var
|
|
315
|
+
var LifeBuoyIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
316
316
|
"svg",
|
|
317
317
|
{
|
|
318
318
|
xmlns: "http://www.w3.org/2000/svg",
|
|
319
|
-
|
|
319
|
+
width: "24",
|
|
320
|
+
height: "24",
|
|
320
321
|
viewBox: "0 0 24 24",
|
|
321
|
-
|
|
322
|
+
fill: "none",
|
|
322
323
|
stroke: "currentColor",
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
324
|
+
strokeWidth: "2",
|
|
325
|
+
strokeLinecap: "round",
|
|
326
|
+
strokeLinejoin: "round",
|
|
327
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-lifebuoy",
|
|
328
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("g", { transform: "translate(0, -1)", children: [
|
|
329
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
330
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" }),
|
|
331
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" }),
|
|
332
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M15 15l3.35 3.35" }),
|
|
333
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M9 15l-3.35 3.35" }),
|
|
334
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M5.65 5.65l3.35 3.35" }),
|
|
335
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { d: "M18.35 5.65l-3.35 3.35" })
|
|
336
|
+
] })
|
|
326
337
|
}
|
|
327
338
|
);
|
|
328
|
-
var
|
|
339
|
+
var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
329
340
|
"svg",
|
|
330
341
|
{
|
|
331
|
-
style: {
|
|
332
|
-
animation: "copilotKitSpinAnimation 1s linear infinite",
|
|
333
|
-
color
|
|
334
|
-
},
|
|
335
|
-
width: "24",
|
|
336
|
-
height: "24",
|
|
337
342
|
xmlns: "http://www.w3.org/2000/svg",
|
|
338
343
|
fill: "none",
|
|
339
344
|
viewBox: "0 0 24 24",
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
cx: "12",
|
|
346
|
-
cy: "12",
|
|
347
|
-
r: "10",
|
|
348
|
-
stroke: "currentColor",
|
|
349
|
-
strokeWidth: "4"
|
|
350
|
-
}
|
|
351
|
-
),
|
|
352
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
353
|
-
"path",
|
|
354
|
-
{
|
|
355
|
-
style: { opacity: 0.75 },
|
|
356
|
-
fill: "currentColor",
|
|
357
|
-
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
358
|
-
}
|
|
359
|
-
)
|
|
360
|
-
]
|
|
345
|
+
strokeWidth: "1.5",
|
|
346
|
+
stroke: "currentColor",
|
|
347
|
+
width: "20",
|
|
348
|
+
height: "20",
|
|
349
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
361
350
|
}
|
|
362
351
|
);
|
|
363
352
|
|
|
@@ -366,52 +355,18 @@ var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
|
366
355
|
function CopilotKitHelpModal() {
|
|
367
356
|
const [showHelpModal, setShowHelpModal] = (0, import_react.useState)(false);
|
|
368
357
|
const [issueDescription, setIssueDescription] = (0, import_react.useState)("");
|
|
369
|
-
const
|
|
370
|
-
const [emailError, setEmailError] = (0, import_react.useState)("");
|
|
371
|
-
const [submitting, setSubmitting] = (0, import_react.useState)(false);
|
|
372
|
-
const validateEmail = (email2) => {
|
|
373
|
-
const re = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
374
|
-
return re.test(email2);
|
|
375
|
-
};
|
|
376
|
-
const handleSubmit = (e) => __async(this, null, function* () {
|
|
377
|
-
e.preventDefault();
|
|
378
|
-
if ((email == null ? void 0 : email.length) > 0 && !validateEmail(email)) {
|
|
379
|
-
setEmailError("Please enter a valid email address");
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
setSubmitting(true);
|
|
383
|
-
yield fetch("https://api.segment.io/v1/track", {
|
|
384
|
-
method: "POST",
|
|
385
|
-
headers: {
|
|
386
|
-
"Content-Type": "application/json"
|
|
387
|
-
},
|
|
388
|
-
body: JSON.stringify({
|
|
389
|
-
event: "oss.dev-console.help",
|
|
390
|
-
anonymousId: window.crypto.randomUUID(),
|
|
391
|
-
properties: { email, text: issueDescription },
|
|
392
|
-
writeKey: "q0gQqvGYyw9pNyhIocNzefSYKGO1aiwW"
|
|
393
|
-
})
|
|
394
|
-
});
|
|
395
|
-
setEmailError("");
|
|
396
|
-
setEmail("");
|
|
397
|
-
setIssueDescription("");
|
|
398
|
-
setSubmitting(false);
|
|
358
|
+
const handleSubmit = () => {
|
|
399
359
|
setShowHelpModal(false);
|
|
400
|
-
}
|
|
360
|
+
};
|
|
401
361
|
const HelpButton = () => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
402
362
|
"button",
|
|
403
363
|
{
|
|
404
364
|
onClick: () => setShowHelpModal(true),
|
|
405
|
-
|
|
406
|
-
className: "text-sm p-0 bg-transparent rounded border border-blue-500",
|
|
365
|
+
className: "p-2 bg-transparent rounded-full shadow-lg hover:shadow-xl transition-shadow duration-300 focus:outline-none focus:ring-2 focus:ring-blue-500",
|
|
407
366
|
"aria-label": "Open Help",
|
|
408
|
-
children:
|
|
367
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LifeBuoyIcon, {})
|
|
409
368
|
}
|
|
410
369
|
);
|
|
411
|
-
const submitButtonDisabled = (0, import_react.useMemo)(
|
|
412
|
-
() => submitting || !!emailError || issueDescription == null || (issueDescription == null ? void 0 : issueDescription.length) == 0,
|
|
413
|
-
[submitting, emailError, issueDescription]
|
|
414
|
-
);
|
|
415
370
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
416
371
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(HelpButton, {}),
|
|
417
372
|
showHelpModal && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
@@ -432,15 +387,6 @@ function CopilotKitHelpModal() {
|
|
|
432
387
|
),
|
|
433
388
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
|
|
434
389
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "space-y-4 mb-4", children: [
|
|
435
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
436
|
-
"a",
|
|
437
|
-
{
|
|
438
|
-
href: "https://docs.copilotkit.ai/coagents/troubleshooting/common-issues",
|
|
439
|
-
target: "_blank",
|
|
440
|
-
rel: "noopener noreferrer",
|
|
441
|
-
children: "Visit the Troubleshooting and FAQ section in the docs"
|
|
442
|
-
}
|
|
443
|
-
) }),
|
|
444
390
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "block w-full text-center py-2 px-4 bg-blue-500 text-white rounded hover:bg-blue-600 transition duration-150 text-sm", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
445
391
|
"a",
|
|
446
392
|
{
|
|
@@ -459,52 +405,6 @@ function CopilotKitHelpModal() {
|
|
|
459
405
|
children: "Apply for Priority Direct Slack Support"
|
|
460
406
|
}
|
|
461
407
|
) })
|
|
462
|
-
] }),
|
|
463
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("form", { onSubmit: handleSubmit, className: "flex flex-col space-y-2", children: [
|
|
464
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
465
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { htmlFor: "feedback", className: "block text-sm font-medium text-gray-700 mb-1", children: "Let us know what your issue is:" }),
|
|
466
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
467
|
-
"textarea",
|
|
468
|
-
{
|
|
469
|
-
id: "feedback",
|
|
470
|
-
rows: 4,
|
|
471
|
-
className: "w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500",
|
|
472
|
-
placeholder: "A Loom link / screen recording is always great!",
|
|
473
|
-
onChange: (e) => setIssueDescription(e.target.value),
|
|
474
|
-
value: issueDescription,
|
|
475
|
-
required: true
|
|
476
|
-
}
|
|
477
|
-
)
|
|
478
|
-
] }),
|
|
479
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
|
|
480
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("label", { htmlFor: "email", className: "block text-sm font-medium text-gray-700 mb-1", children: "Email (optional):" }),
|
|
481
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
482
|
-
"input",
|
|
483
|
-
{
|
|
484
|
-
type: "email",
|
|
485
|
-
id: "email",
|
|
486
|
-
className: `w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500 ${emailError ? "border-red-500" : ""}`,
|
|
487
|
-
placeholder: "Enter your email for follow-up",
|
|
488
|
-
onChange: (e) => {
|
|
489
|
-
setEmail(e.target.value);
|
|
490
|
-
setEmailError("");
|
|
491
|
-
},
|
|
492
|
-
value: email
|
|
493
|
-
}
|
|
494
|
-
),
|
|
495
|
-
emailError && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-red-500 text-sm mt-1", children: emailError })
|
|
496
|
-
] }),
|
|
497
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "bg-gray-50 px-4 py-4 sm:px-6 sm:flex sm:flex-row-reverse rounded-b-lg", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
498
|
-
"button",
|
|
499
|
-
{
|
|
500
|
-
type: "submit",
|
|
501
|
-
onClick: handleSubmit,
|
|
502
|
-
disabled: submitButtonDisabled,
|
|
503
|
-
style: submitButtonDisabled ? { backgroundColor: "rgb(216, 216, 216)", color: "rgb(129, 129, 129)" } : void 0,
|
|
504
|
-
className: "w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-blue-500 text-base font-medium text-white hover:bg-blue-600 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 sm:ml-3 sm:w-auto sm:text-sm disabled:shadow-none",
|
|
505
|
-
children: submitting ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(LoadingSpinnerIcon, { color: "white" }) : "Submit"
|
|
506
|
-
}
|
|
507
|
-
) })
|
|
508
408
|
] })
|
|
509
409
|
] })
|
|
510
410
|
}
|