@copilotkit/react-ui 1.4.1-pre.6 → 1.4.2-tyler-reset-chat.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +59 -0
- package/dist/{chunk-RS6UPR5N.mjs → chunk-2B57NCBA.mjs} +5 -1
- package/dist/chunk-2B57NCBA.mjs.map +1 -0
- package/dist/chunk-4T3TMQNJ.mjs +45 -0
- package/dist/chunk-4T3TMQNJ.mjs.map +1 -0
- package/dist/{chunk-H5CXJBR5.mjs → chunk-B6A6OMIG.mjs} +6 -2
- package/dist/chunk-B6A6OMIG.mjs.map +1 -0
- package/dist/chunk-KXE2JCUH.mjs +1 -0
- package/dist/chunk-KXE2JCUH.mjs.map +1 -0
- package/dist/{chunk-ORHE7FYT.mjs → chunk-OI5EKZPO.mjs} +110 -14
- package/dist/chunk-OI5EKZPO.mjs.map +1 -0
- package/dist/{chunk-ECPBML4L.mjs → chunk-RQRK6DEW.mjs} +2 -2
- package/dist/chunk-WOUWNTAV.mjs +72 -0
- package/dist/chunk-WOUWNTAV.mjs.map +1 -0
- package/dist/{chunk-TSIFZ5N5.mjs → chunk-Z2RXDT7O.mjs} +2 -2
- package/dist/components/chat/Chat.d.ts +50 -5
- package/dist/components/chat/Chat.js +260 -57
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +7 -4
- package/dist/components/chat/Modal.d.ts +1 -1
- package/dist/components/chat/Modal.js +273 -66
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +8 -5
- package/dist/components/chat/Popup.js +275 -68
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +9 -6
- package/dist/components/chat/Sidebar.js +277 -70
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +9 -6
- package/dist/components/chat/index.js +279 -72
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +10 -7
- package/dist/components/dev-console/console.js +138 -32
- package/dist/components/dev-console/console.js.map +1 -1
- package/dist/components/dev-console/console.mjs +4 -1
- package/dist/components/dev-console/index.js +138 -32
- package/dist/components/dev-console/index.js.map +1 -1
- package/dist/components/dev-console/index.mjs +4 -1
- package/dist/components/help-modal/icons.d.ts +6 -0
- package/dist/components/help-modal/icons.js +70 -0
- package/dist/components/help-modal/icons.js.map +1 -0
- package/dist/components/help-modal/icons.mjs +10 -0
- package/dist/components/help-modal/icons.mjs.map +1 -0
- package/dist/components/help-modal/index.d.ts +2 -0
- package/dist/components/help-modal/index.js +135 -0
- package/dist/components/help-modal/index.js.map +1 -0
- package/dist/components/help-modal/index.mjs +10 -0
- package/dist/components/help-modal/index.mjs.map +1 -0
- package/dist/components/help-modal/modal.d.ts +5 -0
- package/dist/components/help-modal/modal.js +133 -0
- package/dist/components/help-modal/modal.js.map +1 -0
- package/dist/components/help-modal/modal.mjs +9 -0
- package/dist/components/help-modal/modal.mjs.map +1 -0
- package/dist/components/index.js +279 -72
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +10 -7
- package/dist/index.js +283 -76
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -7
- package/package.json +7 -7
- package/src/components/chat/Chat.tsx +167 -8
- package/src/components/chat/Modal.tsx +4 -0
- package/src/components/dev-console/console.tsx +4 -1
- package/src/components/help-modal/icons.tsx +40 -0
- package/src/components/help-modal/index.tsx +1 -0
- package/src/components/help-modal/modal.tsx +91 -0
- package/dist/chunk-H5CXJBR5.mjs.map +0 -1
- package/dist/chunk-ORHE7FYT.mjs.map +0 -1
- package/dist/chunk-RS6UPR5N.mjs.map +0 -1
- /package/dist/{chunk-ECPBML4L.mjs.map → chunk-RQRK6DEW.mjs.map} +0 -0
- /package/dist/{chunk-TSIFZ5N5.mjs.map → chunk-Z2RXDT7O.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,64 @@
|
|
|
1
1
|
# ui
|
|
2
2
|
|
|
3
|
+
## 1.4.2-tyler-reset-chat.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Add Markus' reset chat changes along with everything in 1.4.1 + a fix for resetting the agent during front-end action calls
|
|
8
|
+
- Updated dependencies
|
|
9
|
+
- @copilotkit/react-core@1.4.2-tyler-reset-chat.0
|
|
10
|
+
- @copilotkit/runtime-client-gql@1.4.2-tyler-reset-chat.0
|
|
11
|
+
- @copilotkit/shared@1.4.2-tyler-reset-chat.0
|
|
12
|
+
|
|
13
|
+
## 1.4.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- 1721cbd: lower case copilotkit property
|
|
18
|
+
- 1721cbd: add zod conversion
|
|
19
|
+
- 8d0144f: bump
|
|
20
|
+
- 8d0144f: bump
|
|
21
|
+
- 8d0144f: bump
|
|
22
|
+
- e16d95e: New prerelease
|
|
23
|
+
- 1721cbd: Add convertActionsToDynamicStructuredTools to sdk-js
|
|
24
|
+
- CopilotKit Core:
|
|
25
|
+
|
|
26
|
+
- Improved error messages and overall logs
|
|
27
|
+
- `useCopilotAction.renderAndAwait` renamed to `.renderAndAwaitForResponse` (backwards compatible, will be deprecated in the future)
|
|
28
|
+
- Improved scrolling behavior. It is now possible to scroll up during LLM response generation
|
|
29
|
+
- Added Azure OpenAI integration
|
|
30
|
+
- Updated interfaces for better developer ergonomics
|
|
31
|
+
|
|
32
|
+
CoAgents:
|
|
33
|
+
|
|
34
|
+
- Renamed `remoteActions` to `remoteEndpoints` (backwards compatible, will be deprecated in the future)
|
|
35
|
+
- Support for LangGraph Platform in Remote Endpoints
|
|
36
|
+
- LangGraph JS Support for CoAgents (locally via `langgraph dev`, `langgraph up` or deployed to LangGraph Platform)
|
|
37
|
+
- Improved LangSmith integration - requests made through CoAgents will now surface in LangSmith
|
|
38
|
+
- Enhanced state management and message handling
|
|
39
|
+
|
|
40
|
+
CopilotKid Back-end SDK:
|
|
41
|
+
|
|
42
|
+
- Released a whole-new `@copilotkit/sdk-js` for building agents with LangGraph JS Support
|
|
43
|
+
|
|
44
|
+
- 8d0144f: bump
|
|
45
|
+
- 8d0144f: bump
|
|
46
|
+
- fef1b74: fix assistant message CSS and propagate actions to LG JS
|
|
47
|
+
- Updated dependencies [1721cbd]
|
|
48
|
+
- Updated dependencies [1721cbd]
|
|
49
|
+
- Updated dependencies [8d0144f]
|
|
50
|
+
- Updated dependencies [8d0144f]
|
|
51
|
+
- Updated dependencies [8d0144f]
|
|
52
|
+
- Updated dependencies [e16d95e]
|
|
53
|
+
- Updated dependencies [1721cbd]
|
|
54
|
+
- Updated dependencies
|
|
55
|
+
- Updated dependencies [8d0144f]
|
|
56
|
+
- Updated dependencies [8d0144f]
|
|
57
|
+
- Updated dependencies [fef1b74]
|
|
58
|
+
- @copilotkit/react-core@1.4.1
|
|
59
|
+
- @copilotkit/runtime-client-gql@1.4.1
|
|
60
|
+
- @copilotkit/shared@1.4.1
|
|
61
|
+
|
|
3
62
|
## 1.4.1-pre.6
|
|
4
63
|
|
|
5
64
|
### Patch Changes
|
|
@@ -5,6 +5,9 @@ import {
|
|
|
5
5
|
logReadables,
|
|
6
6
|
shouldShowDevConsole
|
|
7
7
|
} from "./chunk-4FIGRRFS.mjs";
|
|
8
|
+
import {
|
|
9
|
+
CopilotKitHelpModal
|
|
10
|
+
} from "./chunk-WOUWNTAV.mjs";
|
|
8
11
|
import {
|
|
9
12
|
CheckIcon,
|
|
10
13
|
ChevronDownIcon,
|
|
@@ -111,6 +114,7 @@ function CopilotDevConsole() {
|
|
|
111
114
|
latestVersion
|
|
112
115
|
}
|
|
113
116
|
),
|
|
117
|
+
/* @__PURE__ */ jsx(CopilotKitHelpModal, {}),
|
|
114
118
|
/* @__PURE__ */ jsx(
|
|
115
119
|
DebugMenuButton,
|
|
116
120
|
{
|
|
@@ -225,4 +229,4 @@ export {
|
|
|
225
229
|
CopilotDevConsole,
|
|
226
230
|
DebugMenuButton
|
|
227
231
|
};
|
|
228
|
-
//# sourceMappingURL=chunk-
|
|
232
|
+
//# sourceMappingURL=chunk-2B57NCBA.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/dev-console/console.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCopilotContext, useCopilotMessagesContext } from \"@copilotkit/react-core\";\nimport {\n getPublishedCopilotKitVersion,\n logActions,\n logMessages,\n logReadables,\n shouldShowDevConsole,\n} from \"./utils\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport {\n CheckIcon,\n ChevronDownIcon,\n CopilotKitIcon,\n ExclamationMarkIcon,\n ExclamationMarkTriangleIcon,\n} from \"./icons\";\nimport { Menu, MenuButton, MenuItem, MenuItems } from \"@headlessui/react\";\nimport { COPILOTKIT_VERSION } from \"@copilotkit/shared\";\nimport { SmallSpinnerIcon } from \"../chat/Icons\";\nimport { CopilotKitHelpModal } from \"../help-modal\";\n\ntype VersionStatus = \"unknown\" | \"checking\" | \"latest\" | \"update-available\" | \"outdated\";\n\nexport function CopilotDevConsole() {\n const currentVersion = COPILOTKIT_VERSION;\n const context = useCopilotContext();\n\n // to prevent hydration errors, ensure that the component renders the same content\n // server-side as it does during the initial client-side render to prevent a hydration\n // mismatch\n // see: https://nextjs.org/docs/messages/react-hydration-error#solution-1-using-useeffect-to-run-on-the-client-only\n\n const [showDevConsole, setShowDevConsole] = useState(false);\n\n useEffect(() => {\n setShowDevConsole(shouldShowDevConsole(context.showDevConsole));\n }, [context.showDevConsole]);\n\n const dontRunTwiceInDevMode = useRef(false);\n const [versionStatus, setVersionStatus] = useState<VersionStatus>(\"unknown\");\n const [latestVersion, setLatestVersion] = useState<string>(\"\");\n const consoleRef = useRef<HTMLDivElement>(null);\n const [debugButtonMode, setDebugButtonMode] = useState<\"full\" | \"compact\">(\"full\");\n\n const checkForUpdates = (force: boolean = false) => {\n setVersionStatus(\"checking\");\n\n getPublishedCopilotKitVersion(currentVersion, force)\n .then((v) => {\n setLatestVersion(v.latest);\n let versionOk = false;\n\n // match exact version or a version with a letter (e.g. 1.0.0-alpha.1)\n if (v.current === v.latest) {\n versionOk = true;\n } else if (/[a-zA-Z]/.test(v.current)) {\n versionOk = true;\n }\n\n if (versionOk) {\n setVersionStatus(\"latest\");\n } else if (v.severity !== \"low\") {\n setVersionStatus(\"outdated\");\n } else {\n setVersionStatus(\"update-available\");\n }\n })\n .catch((e) => {\n console.error(e);\n setVersionStatus(\"unknown\");\n });\n };\n\n useEffect(() => {\n if (dontRunTwiceInDevMode.current === true) {\n return;\n }\n dontRunTwiceInDevMode.current = true;\n\n checkForUpdates();\n }, []);\n\n useEffect(() => {\n const handleResize = (entries: ResizeObserverEntry[]) => {\n for (let entry of entries) {\n if (entry.target === consoleRef.current) {\n const width = entry.contentRect.width;\n if (width < 400) {\n setDebugButtonMode(\"compact\");\n } else {\n setDebugButtonMode(\"full\");\n }\n }\n }\n };\n\n const observer = new ResizeObserver(handleResize);\n if (consoleRef.current) {\n observer.observe(consoleRef.current);\n\n const initialWidth = consoleRef.current.getBoundingClientRect().width;\n if (initialWidth < 400) {\n setDebugButtonMode(\"compact\");\n } else {\n setDebugButtonMode(\"full\");\n }\n }\n\n return () => {\n if (consoleRef.current) {\n observer.unobserve(consoleRef.current);\n }\n };\n }, [consoleRef.current]);\n\n if (!showDevConsole) {\n return null;\n }\n return (\n <div\n ref={consoleRef}\n className={\n \"copilotKitDevConsole \" +\n (versionStatus === \"update-available\" ? \"copilotKitDevConsoleUpgrade\" : \"\") +\n (versionStatus === \"outdated\" ? \"copilotKitDevConsoleWarnOutdated\" : \"\")\n }\n >\n <div className=\"copilotKitDevConsoleLogo\">\n <a href=\"https://copilotkit.ai\" target=\"_blank\">\n {CopilotKitIcon}\n </a>\n </div>\n <VersionInfo\n showDevConsole={context.showDevConsole}\n versionStatus={versionStatus}\n currentVersion={currentVersion}\n latestVersion={latestVersion}\n />\n\n <CopilotKitHelpModal />\n\n <DebugMenuButton\n setShowDevConsole={setShowDevConsole}\n checkForUpdates={checkForUpdates}\n mode={debugButtonMode}\n />\n </div>\n );\n}\n\nfunction VersionInfo({\n showDevConsole,\n versionStatus,\n currentVersion,\n latestVersion,\n}: {\n showDevConsole: boolean | \"auto\";\n versionStatus: VersionStatus;\n currentVersion: string;\n latestVersion: string;\n}) {\n const [copyStatus, setCopyStatus] = useState<string>(\"\");\n\n let versionLabel = \"\";\n let versionIcon: any = \"\";\n let currentVersionLabel = currentVersion;\n\n if (versionStatus === \"latest\") {\n versionLabel = \"latest\";\n versionIcon = CheckIcon;\n } else if (versionStatus === \"checking\") {\n versionLabel = \"checking\";\n versionIcon = SmallSpinnerIcon;\n } else if (versionStatus === \"update-available\") {\n versionLabel = \"update available\";\n versionIcon = ExclamationMarkIcon;\n currentVersionLabel = `${currentVersion} → ${latestVersion}`;\n } else if (versionStatus === \"outdated\") {\n versionLabel = \"outdated\";\n versionIcon = ExclamationMarkTriangleIcon;\n currentVersionLabel = `${currentVersion} → ${latestVersion}`;\n }\n\n let asideLabel = \"\";\n if (showDevConsole === \"auto\") {\n asideLabel = \"(localhost only)\";\n } else if (showDevConsole === true) {\n asideLabel = \"(always on)\";\n }\n\n const installCommand = [\n `npm install`,\n `@copilotkit/react-core@${latestVersion}`,\n `@copilotkit/react-ui@${latestVersion}`,\n `@copilotkit/react-textarea@${latestVersion}`,\n ].join(\" \");\n\n const handleCopyClick = () => {\n navigator.clipboard.writeText(installCommand.trim()).then(() => {\n setCopyStatus(\"Command copied to clipboard!\");\n setTimeout(() => setCopyStatus(\"\"), 1000);\n });\n };\n\n return (\n <div className=\"copilotKitVersionInfo\">\n <header>\n COPILOTKIT DEV CONSOLE{showDevConsole === \"auto\" && <aside>{asideLabel}</aside>}\n </header>\n <section>\n Version: {versionLabel} ({currentVersionLabel}) {versionIcon}\n </section>\n {(versionStatus === \"update-available\" || versionStatus === \"outdated\") && (\n <footer>\n <button onClick={handleCopyClick}>{copyStatus || installCommand}</button>\n </footer>\n )}\n </div>\n );\n}\nexport default function DebugMenuButton({\n setShowDevConsole,\n checkForUpdates,\n mode,\n}: {\n setShowDevConsole: (show: boolean) => void;\n checkForUpdates: (force: boolean) => void;\n mode: \"full\" | \"compact\";\n}) {\n const context = useCopilotContext();\n const messagesContext = useCopilotMessagesContext();\n\n return (\n <div className=\"bg-black top-24 w-52 text-right\">\n <Menu>\n <MenuButton className={`copilotKitDebugMenuButton ${mode === \"compact\" ? \"compact\" : \"\"}`}>\n {mode == \"compact\" ? \"Debug\" : <>Debug {ChevronDownIcon}</>}\n </MenuButton>\n\n <MenuItems\n transition\n anchor=\"bottom end\"\n className=\"copilotKitDebugMenu\"\n style={{ zIndex: 40 }}\n >\n <MenuItem>\n <button className=\"copilotKitDebugMenuItem\" onClick={() => logReadables(context)}>\n Log Readables\n </button>\n </MenuItem>\n <MenuItem>\n <button className=\"copilotKitDebugMenuItem\" onClick={() => logActions(context)}>\n Log Actions\n </button>\n </MenuItem>\n <MenuItem>\n <button\n className=\"copilotKitDebugMenuItem\"\n onClick={() => logMessages(messagesContext)}\n >\n Log Messages\n </button>\n </MenuItem>\n <MenuItem>\n <button className=\"copilotKitDebugMenuItem\" onClick={() => checkForUpdates(true)}>\n Check for Updates\n </button>\n </MenuItem>\n <hr />\n <MenuItem>\n <button className=\"copilotKitDebugMenuItem\" onClick={() => setShowDevConsole(false)}>\n Hide Dev Console\n </button>\n </MenuItem>\n </MenuItems>\n </Menu>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,mBAAmB,iCAAiC;AAQ7D,SAAgB,WAAW,QAAQ,gBAAgB;AAQnD,SAAS,MAAM,YAAY,UAAU,iBAAiB;AACtD,SAAS,0BAA0B;AAsG/B,SAqHqC,UA5GjC,KATJ;AAhGG,SAAS,oBAAoB;AAClC,QAAM,iBAAiB;AACvB,QAAM,UAAU,kBAAkB;AAOlC,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAS,KAAK;AAE1D,YAAU,MAAM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AC1D;AAAA,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,YAAU;AAAA,QACV,QAAO;AAAA,QACP,WAAU;AAAA,QACV,OAAO,EAAE,QAAQ,GAAG;AAAA,QAEpB;AAAA,8BAAC,YACC,8BAAC,YAAO,WAAU,2BAA0B,SAAS,MAAM,aAAa,OAAO,GAAG,2BAElF,GACF;AAAA,UACA,oBAAC,YACC,8BAAC,YAAO,WAAU,2BAA0B,SAAS,MAAM,WAAW,OAAO,GAAG,yBAEhF,GACF;AAAA,UACA,oBAAC,YACC;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,SAAS,MAAM,YAAY,eAAe;AAAA,cAC3C;AAAA;AAAA,UAED,GACF;AAAA,UACA,oBAAC,YACC,8BAAC,YAAO,WAAU,2BAA0B,SAAS,MAAM,gBAAgB,IAAI,GAAG,+BAElF,GACF;AAAA,UACA,oBAAC,QAAG;AAAA,UACJ,oBAAC,YACC,8BAAC,YAAO,WAAU,2BAA0B,SAAS,MAAM,kBAAkB,KAAK,GAAG,8BAErF,GACF;AAAA;AAAA;AAAA,IACF;AAAA,KACF,GACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// src/components/help-modal/icons.tsx
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
var LifeBuoyIcon = () => /* @__PURE__ */ jsx(
|
|
4
|
+
"svg",
|
|
5
|
+
{
|
|
6
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
7
|
+
width: "24",
|
|
8
|
+
height: "24",
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
fill: "none",
|
|
11
|
+
stroke: "currentColor",
|
|
12
|
+
strokeWidth: "2",
|
|
13
|
+
strokeLinecap: "round",
|
|
14
|
+
strokeLinejoin: "round",
|
|
15
|
+
className: "icon icon-tabler icons-tabler-outline icon-tabler-lifebuoy",
|
|
16
|
+
children: /* @__PURE__ */ jsxs("g", { transform: "translate(0, -1)", children: [
|
|
17
|
+
/* @__PURE__ */ jsx("path", { stroke: "none", d: "M0 0h24v24H0z", fill: "none" }),
|
|
18
|
+
/* @__PURE__ */ jsx("path", { d: "M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0" }),
|
|
19
|
+
/* @__PURE__ */ jsx("path", { d: "M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0" }),
|
|
20
|
+
/* @__PURE__ */ jsx("path", { d: "M15 15l3.35 3.35" }),
|
|
21
|
+
/* @__PURE__ */ jsx("path", { d: "M9 15l-3.35 3.35" }),
|
|
22
|
+
/* @__PURE__ */ jsx("path", { d: "M5.65 5.65l3.35 3.35" }),
|
|
23
|
+
/* @__PURE__ */ jsx("path", { d: "M18.35 5.65l-3.35 3.35" })
|
|
24
|
+
] })
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
var CloseIcon = () => /* @__PURE__ */ jsx(
|
|
28
|
+
"svg",
|
|
29
|
+
{
|
|
30
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
31
|
+
fill: "none",
|
|
32
|
+
viewBox: "0 0 24 24",
|
|
33
|
+
strokeWidth: "1.5",
|
|
34
|
+
stroke: "currentColor",
|
|
35
|
+
width: "20",
|
|
36
|
+
height: "20",
|
|
37
|
+
children: /* @__PURE__ */ jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M6 18L18 6M6 6l12 12" })
|
|
38
|
+
}
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
LifeBuoyIcon,
|
|
43
|
+
CloseIcon
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=chunk-4T3TMQNJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/help-modal/icons.tsx"],"sourcesContent":["import React from \"react\";\n\nexport const LifeBuoyIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n width=\"24\"\n height=\"24\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n className=\"icon icon-tabler icons-tabler-outline icon-tabler-lifebuoy\"\n >\n <g transform=\"translate(0, -1)\">\n <path stroke=\"none\" d=\"M0 0h24v24H0z\" fill=\"none\" />\n <path d=\"M12 12m-4 0a4 4 0 1 0 8 0a4 4 0 1 0 -8 0\" />\n <path d=\"M12 12m-9 0a9 9 0 1 0 18 0a9 9 0 1 0 -18 0\" />\n <path d=\"M15 15l3.35 3.35\" />\n <path d=\"M9 15l-3.35 3.35\" />\n <path d=\"M5.65 5.65l3.35 3.35\" />\n <path d=\"M18.35 5.65l-3.35 3.35\" />\n </g>\n </svg>\n);\n\nexport const CloseIcon = () => (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth=\"1.5\"\n stroke=\"currentColor\"\n width=\"20\"\n height=\"20\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n);\n"],"mappings":";AAeI,SACE,KADF;AAbG,IAAM,eAAe,MAC1B;AAAA,EAAC;AAAA;AAAA,IACC,OAAM;AAAA,IACN,OAAM;AAAA,IACN,QAAO;AAAA,IACP,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,QAAO;AAAA,IACP,aAAY;AAAA,IACZ,eAAc;AAAA,IACd,gBAAe;AAAA,IACf,WAAU;AAAA,IAEV,+BAAC,OAAE,WAAU,oBACX;AAAA,0BAAC,UAAK,QAAO,QAAO,GAAE,iBAAgB,MAAK,QAAO;AAAA,MAClD,oBAAC,UAAK,GAAE,4CAA2C;AAAA,MACnD,oBAAC,UAAK,GAAE,8CAA6C;AAAA,MACrD,oBAAC,UAAK,GAAE,oBAAmB;AAAA,MAC3B,oBAAC,UAAK,GAAE,oBAAmB;AAAA,MAC3B,oBAAC,UAAK,GAAE,wBAAuB;AAAA,MAC/B,oBAAC,UAAK,GAAE,0BAAyB;AAAA,OACnC;AAAA;AACF;AAGK,IAAM,YAAY,MACvB;AAAA,EAAC;AAAA;AAAA,IACC,OAAM;AAAA,IACN,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,aAAY;AAAA,IACZ,QAAO;AAAA,IACP,OAAM;AAAA,IACN,QAAO;AAAA,IAEP,8BAAC,UAAK,eAAc,SAAQ,gBAAe,SAAQ,GAAE,wBAAuB;AAAA;AAC9E;","names":[]}
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-RQNJNK2W.mjs";
|
|
10
10
|
import {
|
|
11
11
|
CopilotChat
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-OI5EKZPO.mjs";
|
|
13
13
|
import {
|
|
14
14
|
Input
|
|
15
15
|
} from "./chunk-4LUMV4YO.mjs";
|
|
@@ -33,6 +33,8 @@ var CopilotModal = ({
|
|
|
33
33
|
hitEscapeToClose = true,
|
|
34
34
|
onSetOpen,
|
|
35
35
|
onSubmitMessage,
|
|
36
|
+
onStopGeneration,
|
|
37
|
+
onReloadMessages,
|
|
36
38
|
shortcut = "/",
|
|
37
39
|
icons,
|
|
38
40
|
labels,
|
|
@@ -70,6 +72,8 @@ var CopilotModal = ({
|
|
|
70
72
|
{
|
|
71
73
|
instructions,
|
|
72
74
|
onSubmitMessage,
|
|
75
|
+
onStopGeneration,
|
|
76
|
+
onReloadMessages,
|
|
73
77
|
makeSystemMessage,
|
|
74
78
|
showResponseButton,
|
|
75
79
|
onInProgress,
|
|
@@ -88,4 +92,4 @@ var CopilotModal = ({
|
|
|
88
92
|
export {
|
|
89
93
|
CopilotModal
|
|
90
94
|
};
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
95
|
+
//# sourceMappingURL=chunk-B6A6OMIG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Modal.tsx"],"sourcesContent":["import React from \"react\";\nimport { ChatContextProvider } from \"./ChatContext\";\nimport { ButtonProps, HeaderProps, WindowProps } from \"./props\";\nimport { Window as DefaultWindow } from \"./Window\";\nimport { Button as DefaultButton } from \"./Button\";\nimport { Header as DefaultHeader } from \"./Header\";\nimport { Messages as DefaultMessages } from \"./Messages\";\nimport { Input as DefaultInput } from \"./Input\";\nimport { ResponseButton as DefaultResponseButton } from \"./Response\";\nimport { CopilotChat, CopilotChatProps } from \"./Chat\";\n\nexport interface CopilotModalProps extends CopilotChatProps {\n /**\n * Whether the chat window should be open by default.\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * If the chat window should close when the user clicks outside of it.\n * @default true\n */\n clickOutsideToClose?: boolean;\n\n /**\n * If the chat window should close when the user hits the Escape key.\n * @default true\n */\n hitEscapeToClose?: boolean;\n\n /**\n * The shortcut key to open the chat window.\n * Uses Command-[shortcut] on a Mac and Ctrl-[shortcut] on Windows.\n * @default '/'\n */\n shortcut?: string;\n\n /**\n * A callback that gets called when the chat window opens or closes.\n */\n onSetOpen?: (open: boolean) => void;\n\n /**\n * A custom Window component to use instead of the default.\n */\n Window?: React.ComponentType<WindowProps>;\n\n /**\n * A custom Button component to use instead of the default.\n */\n Button?: React.ComponentType<ButtonProps>;\n\n /**\n * A custom Header component to use instead of the default.\n */\n Header?: React.ComponentType<HeaderProps>;\n}\n\nexport const CopilotModal = ({\n instructions,\n defaultOpen = false,\n clickOutsideToClose = true,\n hitEscapeToClose = true,\n onSetOpen,\n onSubmitMessage,\n onStopGeneration,\n onReloadMessages,\n shortcut = \"/\",\n icons,\n labels,\n makeSystemMessage,\n showResponseButton = true,\n onInProgress,\n Window = DefaultWindow,\n Button = DefaultButton,\n Header = DefaultHeader,\n Messages = DefaultMessages,\n Input = DefaultInput,\n ResponseButton = DefaultResponseButton,\n className,\n children,\n}: CopilotModalProps) => {\n const [openState, setOpenState] = React.useState(defaultOpen);\n\n const setOpen = (open: boolean) => {\n onSetOpen?.(open);\n setOpenState(open);\n };\n\n return (\n <ChatContextProvider icons={icons} labels={labels} open={openState} setOpen={setOpen}>\n {children}\n <div className={className}>\n <Button></Button>\n <Window\n clickOutsideToClose={clickOutsideToClose}\n shortcut={shortcut}\n hitEscapeToClose={hitEscapeToClose}\n >\n <Header />\n <CopilotChat\n instructions={instructions}\n onSubmitMessage={onSubmitMessage}\n onStopGeneration={onStopGeneration}\n onReloadMessages={onReloadMessages}\n makeSystemMessage={makeSystemMessage}\n showResponseButton={showResponseButton}\n onInProgress={onInProgress}\n Messages={Messages}\n Input={Input}\n ResponseButton={ResponseButton}\n />\n </Window>\n </div>\n </ChatContextProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,WAAW;AA6FV,cACA,YADA;AAnCD,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA,cAAc;AAAA,EACd,sBAAsB;AAAA,EACtB,mBAAmB;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB;AAAA,EACrB;AAAA,EACA,QAAAA,UAAS;AAAA,EACT,QAAAC,UAAS;AAAA,EACT,QAAAC,UAAS;AAAA,EACT,UAAAC,YAAW;AAAA,EACX,OAAAC,SAAQ;AAAA,EACR,gBAAAC,kBAAiB;AAAA,EACjB;AAAA,EACA;AACF,MAAyB;AACvB,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,WAAW;AAE5D,QAAM,UAAU,CAAC,SAAkB;AACjC,2CAAY;AACZ,iBAAa,IAAI;AAAA,EACnB;AAEA,SACE,qBAAC,uBAAoB,OAAc,QAAgB,MAAM,WAAW,SACjE;AAAA;AAAA,IACD,qBAAC,SAAI,WACH;AAAA,0BAACJ,SAAA,EAAO;AAAA,MACR;AAAA,QAACD;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UAEA;AAAA,gCAACE,SAAA,EAAO;AAAA,YACR;AAAA,cAAC;AAAA;AAAA,gBACC;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA,UAAUC;AAAA,gBACV,OAAOC;AAAA,gBACP,gBAAgBC;AAAA;AAAA,YAClB;AAAA;AAAA;AAAA,MACF;AAAA,OACF;AAAA,KACF;AAEJ;","names":["Window","Button","Header","Messages","Input","ResponseButton"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-KXE2JCUH.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RenderActionExecutionMessage
|
|
3
|
-
} from "./chunk-OMTPWC7T.mjs";
|
|
4
|
-
import {
|
|
5
|
-
RenderAgentStateMessage
|
|
6
|
-
} from "./chunk-ZABXREBH.mjs";
|
|
7
1
|
import {
|
|
8
2
|
RenderResultMessage
|
|
9
3
|
} from "./chunk-6INMITFA.mjs";
|
|
10
4
|
import {
|
|
11
5
|
RenderTextMessage
|
|
12
6
|
} from "./chunk-RU73BEZM.mjs";
|
|
7
|
+
import {
|
|
8
|
+
RenderActionExecutionMessage
|
|
9
|
+
} from "./chunk-OMTPWC7T.mjs";
|
|
10
|
+
import {
|
|
11
|
+
RenderAgentStateMessage
|
|
12
|
+
} from "./chunk-ZABXREBH.mjs";
|
|
13
13
|
import {
|
|
14
14
|
Suggestion,
|
|
15
15
|
reloadSuggestions
|
|
16
16
|
} from "./chunk-RJCZRKTV.mjs";
|
|
17
17
|
import {
|
|
18
18
|
CopilotDevConsole
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-2B57NCBA.mjs";
|
|
20
20
|
import {
|
|
21
21
|
Input
|
|
22
22
|
} from "./chunk-4LUMV4YO.mjs";
|
|
@@ -32,6 +32,7 @@ import {
|
|
|
32
32
|
} from "./chunk-CBBFRI3Q.mjs";
|
|
33
33
|
import {
|
|
34
34
|
__async,
|
|
35
|
+
__spreadProps,
|
|
35
36
|
__spreadValues
|
|
36
37
|
} from "./chunk-MRXNTQOX.mjs";
|
|
37
38
|
|
|
@@ -44,6 +45,7 @@ import {
|
|
|
44
45
|
} from "@copilotkit/react-core";
|
|
45
46
|
import { Role, TextMessage } from "@copilotkit/runtime-client-gql";
|
|
46
47
|
import { randomId } from "@copilotkit/shared";
|
|
48
|
+
import { runAgent, stopAgent } from "@copilotkit/react-core";
|
|
47
49
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
48
50
|
function CopilotChat({
|
|
49
51
|
instructions,
|
|
@@ -51,6 +53,8 @@ function CopilotChat({
|
|
|
51
53
|
makeSystemMessage,
|
|
52
54
|
showResponseButton = true,
|
|
53
55
|
onInProgress,
|
|
56
|
+
onStopGeneration,
|
|
57
|
+
onReloadMessages,
|
|
54
58
|
Messages: Messages2 = Messages,
|
|
55
59
|
RenderTextMessage: RenderTextMessage2 = RenderTextMessage,
|
|
56
60
|
RenderActionExecutionMessage: RenderActionExecutionMessage2 = RenderActionExecutionMessage,
|
|
@@ -73,7 +77,13 @@ function CopilotChat({
|
|
|
73
77
|
sendMessage,
|
|
74
78
|
stopGeneration,
|
|
75
79
|
reloadMessages
|
|
76
|
-
} = useCopilotChatLogic(
|
|
80
|
+
} = useCopilotChatLogic(
|
|
81
|
+
makeSystemMessage,
|
|
82
|
+
onInProgress,
|
|
83
|
+
onSubmitMessage,
|
|
84
|
+
onStopGeneration,
|
|
85
|
+
onReloadMessages
|
|
86
|
+
);
|
|
77
87
|
const chatContext = React.useContext(ChatContext);
|
|
78
88
|
const isVisible = chatContext ? chatContext.open : true;
|
|
79
89
|
return /* @__PURE__ */ jsxs(WrappedCopilotChat, { icons, labels, className, children: [
|
|
@@ -129,8 +139,15 @@ function WrappedCopilotChat({
|
|
|
129
139
|
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
130
140
|
}
|
|
131
141
|
var SUGGESTIONS_DEBOUNCE_TIMEOUT = 1e3;
|
|
132
|
-
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) => {
|
|
133
|
-
|
|
142
|
+
var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onStopGeneration, onReloadMessages) => {
|
|
143
|
+
var _a;
|
|
144
|
+
const {
|
|
145
|
+
visibleMessages,
|
|
146
|
+
appendMessage,
|
|
147
|
+
reloadMessages: defaultReloadMessages,
|
|
148
|
+
stopGeneration: defaultStopGeneration,
|
|
149
|
+
isLoading
|
|
150
|
+
} = useCopilotChat({
|
|
134
151
|
id: randomId(),
|
|
135
152
|
makeSystemMessage
|
|
136
153
|
});
|
|
@@ -138,8 +155,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
138
155
|
const suggestionsAbortControllerRef = useRef(null);
|
|
139
156
|
const debounceTimerRef = useRef();
|
|
140
157
|
const abortSuggestions = () => {
|
|
141
|
-
var
|
|
142
|
-
(
|
|
158
|
+
var _a2;
|
|
159
|
+
(_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
|
|
143
160
|
suggestionsAbortControllerRef.current = null;
|
|
144
161
|
};
|
|
145
162
|
const generalContext = useCopilotContext();
|
|
@@ -165,7 +182,13 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
165
182
|
return () => {
|
|
166
183
|
clearTimeout(debounceTimerRef.current);
|
|
167
184
|
};
|
|
168
|
-
}, [
|
|
185
|
+
}, [
|
|
186
|
+
isLoading,
|
|
187
|
+
context.chatSuggestionConfiguration,
|
|
188
|
+
// hackish way to trigger suggestions reload on reset, but better than moving suggestions to the
|
|
189
|
+
// global context
|
|
190
|
+
visibleMessages.length == 0
|
|
191
|
+
]);
|
|
169
192
|
const sendMessage = (messageContent) => __async(void 0, null, function* () {
|
|
170
193
|
abortSuggestions();
|
|
171
194
|
setCurrentSuggestions([]);
|
|
@@ -183,6 +206,79 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
183
206
|
appendMessage(message);
|
|
184
207
|
return message;
|
|
185
208
|
});
|
|
209
|
+
const messages = visibleMessages;
|
|
210
|
+
const { setMessages } = messagesContext;
|
|
211
|
+
const currentAgentName = (_a = generalContext.agentSession) == null ? void 0 : _a.agentName;
|
|
212
|
+
const restartCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
213
|
+
if (generalContext.agentSession) {
|
|
214
|
+
generalContext.setAgentSession(__spreadProps(__spreadValues({}, generalContext.agentSession), {
|
|
215
|
+
nodeName: void 0,
|
|
216
|
+
threadId: void 0
|
|
217
|
+
}));
|
|
218
|
+
generalContext.setCoagentStates((prevAgentStates) => {
|
|
219
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
220
|
+
[generalContext.agentSession.agentName]: __spreadProps(__spreadValues({}, prevAgentStates[generalContext.agentSession.agentName]), {
|
|
221
|
+
threadId: void 0,
|
|
222
|
+
nodeName: void 0,
|
|
223
|
+
runId: void 0
|
|
224
|
+
})
|
|
225
|
+
});
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
230
|
+
if (generalContext.agentSession) {
|
|
231
|
+
yield runAgent(generalContext.agentSession.agentName, context, appendMessage, hint);
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
const stopCurrentAgent = () => {
|
|
235
|
+
if (generalContext.agentSession) {
|
|
236
|
+
stopAgent(generalContext.agentSession.agentName, context);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
const setCurrentAgentState = (state) => {
|
|
240
|
+
if (generalContext.agentSession) {
|
|
241
|
+
generalContext.setCoagentStates((prevAgentStates) => {
|
|
242
|
+
return __spreadProps(__spreadValues({}, prevAgentStates), {
|
|
243
|
+
[generalContext.agentSession.agentName]: {
|
|
244
|
+
state
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
};
|
|
250
|
+
function stopGeneration() {
|
|
251
|
+
if (onStopGeneration) {
|
|
252
|
+
onStopGeneration({
|
|
253
|
+
messages,
|
|
254
|
+
setMessages,
|
|
255
|
+
stopGeneration: defaultStopGeneration,
|
|
256
|
+
currentAgentName,
|
|
257
|
+
restartCurrentAgent,
|
|
258
|
+
stopCurrentAgent,
|
|
259
|
+
runCurrentAgent,
|
|
260
|
+
setCurrentAgentState
|
|
261
|
+
});
|
|
262
|
+
} else {
|
|
263
|
+
defaultStopGeneration();
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function reloadMessages() {
|
|
267
|
+
if (onReloadMessages) {
|
|
268
|
+
onReloadMessages({
|
|
269
|
+
messages,
|
|
270
|
+
setMessages,
|
|
271
|
+
stopGeneration: defaultStopGeneration,
|
|
272
|
+
currentAgentName,
|
|
273
|
+
restartCurrentAgent,
|
|
274
|
+
stopCurrentAgent,
|
|
275
|
+
runCurrentAgent,
|
|
276
|
+
setCurrentAgentState
|
|
277
|
+
});
|
|
278
|
+
} else {
|
|
279
|
+
defaultReloadMessages();
|
|
280
|
+
}
|
|
281
|
+
}
|
|
186
282
|
return {
|
|
187
283
|
visibleMessages,
|
|
188
284
|
isLoading,
|
|
@@ -198,4 +294,4 @@ export {
|
|
|
198
294
|
WrappedCopilotChat,
|
|
199
295
|
useCopilotChatLogic
|
|
200
296
|
};
|
|
201
|
-
//# sourceMappingURL=chunk-
|
|
297
|
+
//# sourceMappingURL=chunk-OI5EKZPO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/chat/Chat.tsx"],"sourcesContent":["/**\n * <br/>\n * <img src=\"/images/CopilotChat.gif\" width=\"500\" />\n *\n * A chatbot panel component for the CopilotKit framework. The component allows for a high degree\n * of customization through various props and custom CSS.\n *\n * ## Install Dependencies\n *\n * This component is part of the [@copilotkit/react-ui](https://npmjs.com/package/@copilotkit/react-ui) package.\n *\n * ```shell npm2yarn \\\"@copilotkit/react-ui\"\\\n * npm install @copilotkit/react-core @copilotkit/react-ui\n * ```\n *\n * ## Usage\n *\n * ```tsx\n * import { CopilotChat } from \"@copilotkit/react-ui\";\n * import \"@copilotkit/react-ui/styles.css\";\n *\n * <CopilotChat\n * labels={{\n * title: \"Your Assistant\",\n * initial: \"Hi! 👋 How can I assist you today?\",\n * }}\n * />\n * ```\n *\n * ### Look & Feel\n *\n * By default, CopilotKit components do not have any styles. You can import CopilotKit's stylesheet at the root of your project:\n * ```tsx title=\"YourRootComponent.tsx\"\n * ...\n * import \"@copilotkit/react-ui/styles.css\"; // [!code highlight]\n *\n * export function YourRootComponent() {\n * return (\n * <CopilotKit>\n * ...\n * </CopilotKit>\n * );\n * }\n * ```\n * For more information about how to customize the styles, check out the [Customize Look & Feel](/guides/custom-look-and-feel/customize-built-in-ui-components) guide.\n */\n\nimport {\n ChatContext,\n ChatContextProvider,\n CopilotChatIcons,\n CopilotChatLabels,\n} from \"./ChatContext\";\nimport { Messages as DefaultMessages } from \"./Messages\";\nimport { Input as DefaultInput } from \"./Input\";\nimport { ResponseButton as DefaultResponseButton } from \"./Response\";\nimport { RenderTextMessage as DefaultRenderTextMessage } from \"./messages/RenderTextMessage\";\nimport { RenderActionExecutionMessage as DefaultRenderActionExecutionMessage } from \"./messages/RenderActionExecutionMessage\";\nimport { RenderResultMessage as DefaultRenderResultMessage } from \"./messages/RenderResultMessage\";\nimport { RenderAgentStateMessage as DefaultRenderAgentStateMessage } from \"./messages/RenderAgentStateMessage\";\nimport { Suggestion } from \"./Suggestion\";\nimport React, { useEffect, useRef, useState } from \"react\";\nimport {\n SystemMessageFunction,\n useCopilotChat,\n useCopilotContext,\n useCopilotMessagesContext,\n} from \"@copilotkit/react-core\";\nimport { reloadSuggestions } from \"./Suggestion\";\nimport { CopilotChatSuggestion } from \"../../types/suggestions\";\nimport { Message, Role, TextMessage } from \"@copilotkit/runtime-client-gql\";\nimport { InputProps, MessagesProps, RenderMessageProps, ResponseButtonProps } from \"./props\";\nimport { randomId } from \"@copilotkit/shared\";\n\nimport { CopilotDevConsole } from \"../dev-console\";\nimport { HintFunction, runAgent, stopAgent } from \"@copilotkit/react-core\";\n\n/**\n * Props for CopilotChat component.\n */\nexport interface CopilotChatProps {\n /**\n * Custom instructions to be added to the system message. Use this property to\n * provide additional context or guidance to the language model, influencing\n * its responses. These instructions can include specific directions,\n * preferences, or criteria that the model should consider when generating\n * its output, thereby tailoring the conversation more precisely to the\n * user's needs or the application's requirements.\n */\n instructions?: string;\n\n /**\n * A callback that gets called when the in progress state changes.\n */\n onInProgress?: (inProgress: boolean) => void;\n\n /**\n * A callback that gets called when a new message it submitted.\n */\n onSubmitMessage?: (message: string) => void | Promise<void>;\n\n /**\n * A custom stop generation function.\n */\n onStopGeneration?: OnStopGeneration;\n\n /**\n * A custom reload messages function.\n */\n onReloadMessages?: OnReloadMessages;\n\n /**\n * Icons can be used to set custom icons for the chat window.\n */\n icons?: CopilotChatIcons;\n\n /**\n * Labels can be used to set custom labels for the chat window.\n */\n labels?: CopilotChatLabels;\n\n /**\n * A function that takes in context string and instructions and returns\n * the system message to include in the chat request.\n * Use this to completely override the system message, when providing\n * instructions is not enough.\n */\n makeSystemMessage?: SystemMessageFunction;\n\n /**\n * Whether to show the response button.\n * @default true\n */\n showResponseButton?: boolean;\n\n /**\n * A custom Messages component to use instead of the default.\n */\n Messages?: React.ComponentType<MessagesProps>;\n\n /**\n * A custom RenderTextMessage component to use instead of the default.\n */\n RenderTextMessage?: React.ComponentType<RenderMessageProps>;\n\n /**\n * A custom RenderActionExecutionMessage component to use instead of the default.\n */\n RenderActionExecutionMessage?: React.ComponentType<RenderMessageProps>;\n\n /**\n * A custom RenderAgentStateMessage component to use instead of the default.\n */\n RenderAgentStateMessage?: React.ComponentType<RenderMessageProps>;\n\n /**\n * A custom RenderResultMessage component to use instead of the default.\n */\n RenderResultMessage?: React.ComponentType<RenderMessageProps>;\n\n /**\n * A custom Input component to use instead of the default.\n */\n Input?: React.ComponentType<InputProps>;\n\n /**\n * A custom ResponseButton component to use instead of the default.\n */\n ResponseButton?: React.ComponentType<ResponseButtonProps>;\n\n /**\n * A class name to apply to the root element.\n */\n className?: string;\n\n /**\n * Children to render.\n */\n children?: React.ReactNode;\n}\n\ninterface OnStopGenerationArguments {\n /**\n * The name of the currently executing agent.\n */\n currentAgentName: string | undefined;\n\n /**\n * The messages in the chat.\n */\n messages: Message[];\n\n /**\n * Set the messages in the chat.\n */\n setMessages: (messages: Message[]) => void;\n\n /**\n * Stop chat generation.\n */\n stopGeneration: () => void;\n\n /**\n * Restart the currently executing agent.\n */\n restartCurrentAgent: () => void;\n\n /**\n * Stop the currently executing agent.\n */\n stopCurrentAgent: () => void;\n\n /**\n * Run the currently executing agent.\n */\n runCurrentAgent: (hint?: HintFunction) => Promise<void>;\n\n /**\n * Set the state of the currently executing agent.\n */\n setCurrentAgentState: (state: any) => void;\n}\n\nexport type OnReloadMessagesArguments = OnStopGenerationArguments;\n\nexport type OnStopGeneration = (args: OnStopGenerationArguments) => void;\n\nexport type OnReloadMessages = (args: OnReloadMessagesArguments) => void;\n\nexport function CopilotChat({\n instructions,\n onSubmitMessage,\n makeSystemMessage,\n showResponseButton = true,\n onInProgress,\n onStopGeneration,\n onReloadMessages,\n Messages = DefaultMessages,\n RenderTextMessage = DefaultRenderTextMessage,\n RenderActionExecutionMessage = DefaultRenderActionExecutionMessage,\n RenderAgentStateMessage = DefaultRenderAgentStateMessage,\n RenderResultMessage = DefaultRenderResultMessage,\n Input = DefaultInput,\n ResponseButton = DefaultResponseButton,\n className,\n icons,\n labels,\n}: CopilotChatProps) {\n const context = useCopilotContext();\n\n useEffect(() => {\n context.setChatInstructions(instructions || \"\");\n }, [instructions]);\n\n const {\n visibleMessages,\n isLoading,\n currentSuggestions,\n sendMessage,\n stopGeneration,\n reloadMessages,\n } = useCopilotChatLogic(\n makeSystemMessage,\n onInProgress,\n onSubmitMessage,\n onStopGeneration,\n onReloadMessages,\n );\n\n const chatContext = React.useContext(ChatContext);\n const isVisible = chatContext ? chatContext.open : true;\n\n return (\n <WrappedCopilotChat icons={icons} labels={labels} className={className}>\n <CopilotDevConsole />\n <Messages\n RenderTextMessage={RenderTextMessage}\n RenderActionExecutionMessage={RenderActionExecutionMessage}\n RenderAgentStateMessage={RenderAgentStateMessage}\n RenderResultMessage={RenderResultMessage}\n messages={visibleMessages}\n inProgress={isLoading}\n >\n {currentSuggestions.length > 0 && (\n <div>\n <h6>Suggested:</h6>\n <div className=\"suggestions\">\n {currentSuggestions.map((suggestion, index) => (\n <Suggestion\n key={index}\n title={suggestion.title}\n message={suggestion.message}\n partial={suggestion.partial}\n className={suggestion.className}\n onClick={(message) => sendMessage(message)}\n />\n ))}\n </div>\n </div>\n )}\n {showResponseButton && visibleMessages.length > 0 && (\n <ResponseButton\n onClick={isLoading ? stopGeneration : reloadMessages}\n inProgress={isLoading}\n />\n )}\n </Messages>\n <Input inProgress={isLoading} onSend={sendMessage} isVisible={isVisible} />\n </WrappedCopilotChat>\n );\n}\n\nexport function WrappedCopilotChat({\n children,\n icons,\n labels,\n className,\n}: {\n children: React.ReactNode;\n icons?: CopilotChatIcons;\n labels?: CopilotChatLabels;\n className?: string;\n}) {\n const chatContext = React.useContext(ChatContext);\n if (!chatContext) {\n return (\n <ChatContextProvider icons={icons} labels={labels} open={true} setOpen={() => {}}>\n <div className={`copilotKitChat ${className}`}>{children}</div>\n </ChatContextProvider>\n );\n }\n return <>{children}</>;\n}\n\nconst SUGGESTIONS_DEBOUNCE_TIMEOUT = 1000;\n\nexport const useCopilotChatLogic = (\n makeSystemMessage?: SystemMessageFunction,\n onInProgress?: (isLoading: boolean) => void,\n onSubmitMessage?: (messageContent: string) => Promise<void> | void,\n onStopGeneration?: OnStopGeneration,\n onReloadMessages?: OnReloadMessages,\n) => {\n const {\n visibleMessages,\n appendMessage,\n reloadMessages: defaultReloadMessages,\n stopGeneration: defaultStopGeneration,\n isLoading,\n } = useCopilotChat({\n id: randomId(),\n makeSystemMessage,\n });\n\n const [currentSuggestions, setCurrentSuggestions] = useState<CopilotChatSuggestion[]>([]);\n const suggestionsAbortControllerRef = useRef<AbortController | null>(null);\n const debounceTimerRef = useRef<any>();\n\n const abortSuggestions = () => {\n suggestionsAbortControllerRef.current?.abort();\n suggestionsAbortControllerRef.current = null;\n };\n\n const generalContext = useCopilotContext();\n const messagesContext = useCopilotMessagesContext();\n const context = { ...generalContext, ...messagesContext };\n\n useEffect(() => {\n onInProgress?.(isLoading);\n\n abortSuggestions();\n\n debounceTimerRef.current = setTimeout(\n () => {\n if (!isLoading && Object.keys(context.chatSuggestionConfiguration).length !== 0) {\n suggestionsAbortControllerRef.current = new AbortController();\n reloadSuggestions(\n context,\n context.chatSuggestionConfiguration,\n setCurrentSuggestions,\n suggestionsAbortControllerRef,\n );\n }\n },\n currentSuggestions.length == 0 ? 0 : SUGGESTIONS_DEBOUNCE_TIMEOUT,\n );\n\n return () => {\n clearTimeout(debounceTimerRef.current);\n }\n }, [\n isLoading,\n context.chatSuggestionConfiguration,\n // hackish way to trigger suggestions reload on reset, but better than moving suggestions to the\n // global context\n visibleMessages.length == 0,\n ]);\n\n const sendMessage = async (messageContent: string) => {\n abortSuggestions();\n setCurrentSuggestions([]);\n\n const message: Message = new TextMessage({\n content: messageContent,\n role: Role.User,\n });\n\n if (onSubmitMessage) {\n try {\n await onSubmitMessage(messageContent);\n } catch (error) {\n console.error(\"Error in onSubmitMessage:\", error);\n }\n }\n // this needs to happen after onSubmitMessage, because it will trigger submission\n // of the message to the endpoint. Some users depend on performing some actions\n // before the message is submitted.\n appendMessage(message);\n\n return message;\n };\n\n const messages = visibleMessages;\n const { setMessages } = messagesContext;\n const currentAgentName = generalContext.agentSession?.agentName;\n const restartCurrentAgent = async (hint?: HintFunction) => {\n if (generalContext.agentSession) {\n generalContext.setAgentSession({\n ...generalContext.agentSession,\n nodeName: undefined,\n threadId: undefined,\n });\n generalContext.setCoagentStates((prevAgentStates) => {\n return {\n ...prevAgentStates,\n [generalContext.agentSession!.agentName]: {\n ...prevAgentStates[generalContext.agentSession!.agentName],\n threadId: undefined,\n nodeName: undefined,\n runId: undefined,\n },\n };\n });\n }\n };\n const runCurrentAgent = async (hint?: HintFunction) => {\n if (generalContext.agentSession) {\n await runAgent(generalContext.agentSession.agentName, context, appendMessage, hint);\n }\n };\n const stopCurrentAgent = () => {\n if (generalContext.agentSession) {\n stopAgent(generalContext.agentSession.agentName, context);\n }\n };\n const setCurrentAgentState = (state: any) => {\n if (generalContext.agentSession) {\n generalContext.setCoagentStates((prevAgentStates) => {\n return {\n ...prevAgentStates,\n [generalContext.agentSession!.agentName]: {\n state,\n },\n } as any;\n });\n }\n };\n\n function stopGeneration() {\n if (onStopGeneration) {\n onStopGeneration({\n messages,\n setMessages,\n stopGeneration: defaultStopGeneration,\n currentAgentName,\n restartCurrentAgent,\n stopCurrentAgent,\n runCurrentAgent,\n setCurrentAgentState,\n });\n } else {\n defaultStopGeneration();\n }\n }\n function reloadMessages() {\n if (onReloadMessages) {\n onReloadMessages({\n messages,\n setMessages,\n stopGeneration: defaultStopGeneration,\n currentAgentName,\n restartCurrentAgent,\n stopCurrentAgent,\n runCurrentAgent,\n setCurrentAgentState,\n });\n } else {\n defaultReloadMessages();\n }\n }\n\n return {\n visibleMessages,\n isLoading,\n currentSuggestions,\n sendMessage,\n stopGeneration,\n reloadMessages,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6DA,OAAO,SAAS,WAAW,QAAQ,gBAAgB;AACnD;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAGP,SAAkB,MAAM,mBAAmB;AAE3C,SAAS,gBAAgB;AAGzB,SAAuB,UAAU,iBAAiB;AAuM5C,SAyDG,UAzDH,KAUI,YAVJ;AA7CC,SAAS,YAAY;AAAA,EAC1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,IACH;AAAA,EACF;AACA,QAAM,kBAAkB,CAAO,SAAwB;AACrD,QAAI,eAAe,cAAc;AAC/B,YAAM,SAAS,eAAe,aAAa,WAAW,SAAS,eAAe,IAAI;AAAA,IACpF;AAAA,EACF;AACA,QAAM,mBAAmB,MAAM;AAC7B,QAAI,eAAe,cAAc;AAC/B,gBAAU,eAAe,aAAa,WAAW,OAAO;AAAA,IAC1D;AAAA,EACF;AACA,QAAM,uBAAuB,CAAC,UAAe;AAC3C,QAAI,eAAe,cAAc;AAC/B,qBAAe,iBAAiB,CAAC,oBAAoB;AACnD,eAAO,iCACF,kBADE;AAAA,UAEL,CAAC,eAAe,aAAc,SAAS,GAAG;AAAA,YACxC;AAAA,UACF;AAAA,QACF;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AAEA,WAAS,iBAAiB;AACxB,QAAI,kBAAkB;AACpB,uBAAiB;AAAA,QACf;AAAA,QACA;AAAA,QACA,gBAAgB;AAAA,QAChB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,OAAO;AACL,4BAAsB;AAAA,IACxB;AAAA,EACF;AACA,WAAS,iBAAiB;AACxB,QAAI,kBAAkB;AACpB,uBAAiB;AAAA,QACf;AAAA,QACA;AAAA,QACA,gBAAgB;AAAA,QAChB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF,CAAC;AAAA,IACH,OAAO;AACL,4BAAsB;AAAA,IACxB;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":["Messages","RenderTextMessage","RenderActionExecutionMessage","RenderAgentStateMessage","RenderResultMessage","Input","ResponseButton","_a"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B6A6OMIG.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-RQRK6DEW.mjs.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CloseIcon,
|
|
3
|
+
LifeBuoyIcon
|
|
4
|
+
} from "./chunk-4T3TMQNJ.mjs";
|
|
5
|
+
|
|
6
|
+
// src/components/help-modal/modal.tsx
|
|
7
|
+
import { useState } from "react";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
function CopilotKitHelpModal() {
|
|
10
|
+
const [showHelpModal, setShowHelpModal] = useState(false);
|
|
11
|
+
const [issueDescription, setIssueDescription] = useState("");
|
|
12
|
+
const handleSubmit = () => {
|
|
13
|
+
setShowHelpModal(false);
|
|
14
|
+
};
|
|
15
|
+
const HelpButton = () => /* @__PURE__ */ jsx(
|
|
16
|
+
"button",
|
|
17
|
+
{
|
|
18
|
+
onClick: () => setShowHelpModal(true),
|
|
19
|
+
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",
|
|
20
|
+
"aria-label": "Open Help",
|
|
21
|
+
children: /* @__PURE__ */ jsx(LifeBuoyIcon, {})
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
25
|
+
/* @__PURE__ */ jsx(HelpButton, {}),
|
|
26
|
+
showHelpModal && /* @__PURE__ */ jsx(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
className: "fixed inset-0 flex items-center justify-center p-4",
|
|
30
|
+
style: { backgroundColor: "rgba(11, 15, 26, 0.5)", zIndex: 99 },
|
|
31
|
+
children: /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-lg shadow-xl max-w-md w-full p-4 flex-col relative", children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
"button",
|
|
34
|
+
{
|
|
35
|
+
className: "absolute text-gray-400 hover:text-gray-600 focus:outline-none",
|
|
36
|
+
style: { top: "10px", right: "10px" },
|
|
37
|
+
onClick: () => setShowHelpModal(false),
|
|
38
|
+
"aria-label": "Close",
|
|
39
|
+
children: /* @__PURE__ */ jsx(CloseIcon, {})
|
|
40
|
+
}
|
|
41
|
+
),
|
|
42
|
+
/* @__PURE__ */ jsx("div", { className: "w-full flex mb-6 justify-center", children: /* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold", children: "Help Options" }) }),
|
|
43
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-4 mb-4", children: [
|
|
44
|
+
/* @__PURE__ */ 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__ */ jsx(
|
|
45
|
+
"a",
|
|
46
|
+
{
|
|
47
|
+
href: "https://go.copilotkit.ai/dev-console-support-discord",
|
|
48
|
+
target: "_blank",
|
|
49
|
+
rel: "noopener noreferrer",
|
|
50
|
+
children: "Go to Discord Support Channel (Community Support)"
|
|
51
|
+
}
|
|
52
|
+
) }),
|
|
53
|
+
/* @__PURE__ */ 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__ */ jsx(
|
|
54
|
+
"a",
|
|
55
|
+
{
|
|
56
|
+
href: "https://go.copilotkit.ai/dev-console-support-slack",
|
|
57
|
+
target: "_blank",
|
|
58
|
+
rel: "noopener noreferrer",
|
|
59
|
+
children: "Apply for Priority Direct Slack Support"
|
|
60
|
+
}
|
|
61
|
+
) })
|
|
62
|
+
] })
|
|
63
|
+
] })
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] });
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export {
|
|
70
|
+
CopilotKitHelpModal
|
|
71
|
+
};
|
|
72
|
+
//# sourceMappingURL=chunk-WOUWNTAV.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/help-modal/modal.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { CloseIcon, LifeBuoyIcon } from \"./icons\";\n\nexport function CopilotKitHelpModal() {\n const [showHelpModal, setShowHelpModal] = useState(false);\n const [issueDescription, setIssueDescription] = useState(\"\");\n\n const handleSubmit = () => {\n // submit issueDescription\n setShowHelpModal(false);\n };\n\n const HelpButton = () => (\n <button\n onClick={() => setShowHelpModal(true)}\n 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\"\n aria-label=\"Open Help\"\n >\n <LifeBuoyIcon />\n </button>\n );\n\n return (\n <>\n <HelpButton />\n {showHelpModal && (\n <div\n className=\"fixed inset-0 flex items-center justify-center p-4\"\n style={{ backgroundColor: \"rgba(11, 15, 26, 0.5)\", zIndex: 99 }}\n >\n <div className=\"bg-white rounded-lg shadow-xl max-w-md w-full p-4 flex-col relative\">\n <button\n className=\"absolute text-gray-400 hover:text-gray-600 focus:outline-none\"\n style={{ top: \"10px\", right: \"10px\" }}\n onClick={() => setShowHelpModal(false)}\n aria-label=\"Close\"\n >\n <CloseIcon />\n </button>\n <div className=\"w-full flex mb-6 justify-center\">\n <h2 className=\"text-2xl font-bold\">Help Options</h2>\n </div>\n <div className=\"space-y-4 mb-4\">\n <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\">\n <a\n href=\"https://go.copilotkit.ai/dev-console-support-discord\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Go to Discord Support Channel (Community Support)\n </a>\n </div>\n <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\">\n <a\n href=\"https://go.copilotkit.ai/dev-console-support-slack\"\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n Apply for Priority Direct Slack Support\n </a>\n </div>\n </div>\n {/*<form onSubmit={handleSubmit} className=\"flex flex-col space-y-4\">*/}\n {/* <div>*/}\n {/* <label htmlFor=\"feedback\" className=\"block text-sm font-medium text-gray-700 mb-1\">*/}\n {/* Let us know what your issue is:*/}\n {/* </label>*/}\n {/* <textarea*/}\n {/* id=\"feedback\"*/}\n {/* rows={4}*/}\n {/* className=\"w-full px-3 py-2 text-gray-700 border rounded-lg focus:outline-none focus:border-blue-500\"*/}\n {/* placeholder=\"A Loom link / screen recording is always great!\"*/}\n {/* onChange={e => setIssueDescription(e.target.value)}*/}\n {/* value={issueDescription}*/}\n {/* ></textarea>*/}\n {/* </div>*/}\n {/* <div className=\"bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse rounded-b-lg\">*/}\n {/* <button*/}\n {/* type=\"submit\"*/}\n {/* 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\"*/}\n {/* >*/}\n {/* Submit*/}\n {/* </button>*/}\n {/* </div>*/}\n {/*</form>*/}\n </div>\n </div>\n )}\n </>\n );\n}\n"],"mappings":";;;;;;AAAA,SAAgB,gBAAgB;AAkB1B,SAKF,UALE,KAwBM,YAxBN;AAfC,SAAS,sBAAsB;AACpC,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,KAAK;AACxD,QAAM,CAAC,kBAAkB,mBAAmB,IAAI,SAAS,EAAE;AAE3D,QAAM,eAAe,MAAM;AAEzB,qBAAiB,KAAK;AAAA,EACxB;AAEA,QAAM,aAAa,MACjB;AAAA,IAAC;AAAA;AAAA,MACC,SAAS,MAAM,iBAAiB,IAAI;AAAA,MACpC,WAAU;AAAA,MACV,cAAW;AAAA,MAEX,8BAAC,gBAAa;AAAA;AAAA,EAChB;AAGF,SACE,iCACE;AAAA,wBAAC,cAAW;AAAA,IACX,iBACC;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,OAAO,EAAE,iBAAiB,yBAAyB,QAAQ,GAAG;AAAA,QAE9D,+BAAC,SAAI,WAAU,uEACb;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,WAAU;AAAA,cACV,OAAO,EAAE,KAAK,QAAQ,OAAO,OAAO;AAAA,cACpC,SAAS,MAAM,iBAAiB,KAAK;AAAA,cACrC,cAAW;AAAA,cAEX,8BAAC,aAAU;AAAA;AAAA,UACb;AAAA,UACA,oBAAC,SAAI,WAAU,mCACb,8BAAC,QAAG,WAAU,sBAAqB,0BAAY,GACjD;AAAA,UACA,qBAAC,SAAI,WAAU,kBACb;AAAA,gCAAC,SAAI,WAAU,uHACb;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,QAAO;AAAA,gBACP,KAAI;AAAA,gBACL;AAAA;AAAA,YAED,GACF;AAAA,YACA,oBAAC,SAAI,WAAU,uHACb;AAAA,cAAC;AAAA;AAAA,gBACC,MAAK;AAAA,gBACL,QAAO;AAAA,gBACP,KAAI;AAAA,gBACL;AAAA;AAAA,YAED,GACF;AAAA,aACF;AAAA,WAwBF;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotModal
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-B6A6OMIG.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-Z2RXDT7O.mjs.map
|