@copilotkit/react-ui 1.1.2 → 1.1.3-feat-runtime-remote-actions.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 +16 -0
- package/README.md +32 -37
- package/dist/{chunk-UJHTRHS4.mjs → chunk-36OL6SEM.mjs} +3 -2
- package/dist/chunk-36OL6SEM.mjs.map +1 -0
- package/dist/{chunk-EJ4SJ2HU.mjs → chunk-AFD5I7MW.mjs} +2 -2
- package/dist/chunk-AFD5I7MW.mjs.map +1 -0
- package/dist/{chunk-WOPUCUQK.mjs → chunk-C534T3DM.mjs} +10 -11
- package/dist/{chunk-WOPUCUQK.mjs.map → chunk-C534T3DM.mjs.map} +1 -1
- package/dist/{chunk-SE6DAYSX.mjs → chunk-FLV3J3VX.mjs} +5 -5
- package/dist/chunk-FLV3J3VX.mjs.map +1 -0
- package/dist/{chunk-LLOSOTAT.mjs → chunk-FO7Z5LAL.mjs} +6 -3
- package/dist/chunk-FO7Z5LAL.mjs.map +1 -0
- package/dist/{chunk-4Z2WDXSK.mjs → chunk-FOZVHL73.mjs} +49 -4
- package/dist/chunk-FOZVHL73.mjs.map +1 -0
- package/dist/{chunk-PF5HUDUP.mjs → chunk-H7TM5JE6.mjs} +54 -2
- package/dist/chunk-H7TM5JE6.mjs.map +1 -0
- package/dist/{chunk-SWWFXRFF.mjs → chunk-HR36Y2FQ.mjs} +4 -4
- package/dist/chunk-HR36Y2FQ.mjs.map +1 -0
- package/dist/{chunk-D6QNFZXK.mjs → chunk-I4QG2ZZU.mjs} +4 -2
- package/dist/chunk-I4QG2ZZU.mjs.map +1 -0
- package/dist/{chunk-KSCXPA74.mjs → chunk-WCPLXRZX.mjs} +1 -1
- package/dist/chunk-WCPLXRZX.mjs.map +1 -0
- package/dist/{chunk-UC3Y7MWX.mjs → chunk-YOH25I6N.mjs} +5 -5
- package/dist/chunk-YOH25I6N.mjs.map +1 -0
- package/dist/components/chat/Button.d.ts +2 -1
- package/dist/components/chat/Button.js +4 -4
- package/dist/components/chat/Button.js.map +1 -1
- package/dist/components/chat/Button.mjs +1 -1
- package/dist/components/chat/Chat.d.ts +4 -49
- package/dist/components/chat/Chat.js +101 -5
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +5 -5
- package/dist/components/chat/ChatContext.d.ts +2 -1
- package/dist/components/chat/Header.d.ts +2 -1
- package/dist/components/chat/Header.js +4 -4
- package/dist/components/chat/Header.js.map +1 -1
- package/dist/components/chat/Header.mjs +1 -1
- package/dist/components/chat/Icons.d.ts +14 -13
- package/dist/components/chat/Input.d.ts +2 -1
- package/dist/components/chat/Markdown.d.ts +3 -1
- package/dist/components/chat/Messages.d.ts +2 -1
- package/dist/components/chat/Messages.js +46 -2
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +1 -1
- package/dist/components/chat/Modal.d.ts +2 -1
- package/dist/components/chat/Modal.js +114 -20
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +9 -9
- package/dist/components/chat/Popup.d.ts +2 -48
- package/dist/components/chat/Popup.js +114 -20
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +10 -10
- package/dist/components/chat/Response.d.ts +2 -1
- package/dist/components/chat/Sidebar.d.ts +2 -1
- package/dist/components/chat/Sidebar.js +115 -20
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +10 -10
- package/dist/components/chat/Suggestion.d.ts +2 -1
- package/dist/components/chat/Suggestion.js.map +1 -1
- package/dist/components/chat/Suggestion.mjs +1 -1
- package/dist/components/chat/Window.d.ts +2 -1
- package/dist/components/chat/Window.js +23 -8
- package/dist/components/chat/Window.js.map +1 -1
- package/dist/components/chat/Window.mjs +3 -1
- package/dist/components/chat/index.d.ts +1 -0
- package/dist/components/chat/index.js +115 -20
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +11 -11
- package/dist/components/chat/props.d.ts +0 -6
- package/dist/components/chat/props.js.map +1 -1
- package/dist/components/dev-console/console.d.ts +4 -2
- package/dist/components/dev-console/console.js +52 -0
- package/dist/components/dev-console/console.js.map +1 -1
- package/dist/components/dev-console/console.mjs +2 -2
- package/dist/components/dev-console/icons.d.ts +7 -5
- package/dist/components/dev-console/index.d.ts +1 -0
- package/dist/components/dev-console/index.js +52 -0
- package/dist/components/dev-console/index.js.map +1 -1
- package/dist/components/dev-console/index.mjs +2 -2
- package/dist/components/dev-console/utils.d.ts +2 -1
- package/dist/components/dev-console/utils.js +53 -0
- package/dist/components/dev-console/utils.js.map +1 -1
- package/dist/components/dev-console/utils.mjs +3 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +115 -20
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +11 -11
- package/dist/index.css +5 -4
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +115 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/package.json +8 -8
- package/src/components/chat/Button.tsx +4 -8
- package/src/components/chat/Chat.tsx +2 -1
- package/src/components/chat/Header.tsx +4 -4
- package/src/components/chat/Messages.tsx +83 -2
- package/src/components/chat/Modal.tsx +4 -5
- package/src/components/chat/Popup.tsx +1 -0
- package/src/components/chat/Sidebar.tsx +2 -0
- package/src/components/chat/Suggestion.tsx +2 -0
- package/src/components/chat/Window.tsx +3 -2
- package/src/components/chat/props.ts +2 -10
- package/src/components/dev-console/console.tsx +6 -0
- package/src/components/dev-console/utils.ts +56 -0
- package/src/css/markdown.css +5 -5
- package/dist/chunk-4Z2WDXSK.mjs.map +0 -1
- package/dist/chunk-D6QNFZXK.mjs.map +0 -1
- package/dist/chunk-EJ4SJ2HU.mjs.map +0 -1
- package/dist/chunk-KSCXPA74.mjs.map +0 -1
- package/dist/chunk-LLOSOTAT.mjs.map +0 -1
- package/dist/chunk-PF5HUDUP.mjs.map +0 -1
- package/dist/chunk-SE6DAYSX.mjs.map +0 -1
- package/dist/chunk-SWWFXRFF.mjs.map +0 -1
- package/dist/chunk-UC3Y7MWX.mjs.map +0 -1
- package/dist/chunk-UJHTRHS4.mjs.map +0 -1
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CopilotSidebar
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
8
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-36OL6SEM.mjs";
|
|
4
|
+
import "../../chunk-C534T3DM.mjs";
|
|
5
|
+
import "../../chunk-FO7Z5LAL.mjs";
|
|
6
|
+
import "../../chunk-FLV3J3VX.mjs";
|
|
7
|
+
import "../../chunk-YOH25I6N.mjs";
|
|
8
|
+
import "../../chunk-HR36Y2FQ.mjs";
|
|
9
9
|
import "../../chunk-V7W6IM2V.mjs";
|
|
10
|
-
import "../../chunk-
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-
|
|
10
|
+
import "../../chunk-WCPLXRZX.mjs";
|
|
11
|
+
import "../../chunk-I4QG2ZZU.mjs";
|
|
12
|
+
import "../../chunk-H7TM5JE6.mjs";
|
|
13
13
|
import "../../chunk-OTPAZXVR.mjs";
|
|
14
14
|
import "../../chunk-U6J5DGOE.mjs";
|
|
15
15
|
import "../../chunk-YQFVRDNC.mjs";
|
|
16
|
-
import "../../chunk-
|
|
16
|
+
import "../../chunk-FOZVHL73.mjs";
|
|
17
17
|
import "../../chunk-YQ3D5IQV.mjs";
|
|
18
18
|
import "../../chunk-XSUSSWDS.mjs";
|
|
19
19
|
import "../../chunk-BJPGMY3I.mjs";
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
1
2
|
import { CopilotContextParams, CopilotChatSuggestionConfiguration } from '@copilotkit/react-core';
|
|
2
3
|
import { SuggestionsProps } from './props.js';
|
|
3
4
|
import '@copilotkit/runtime-client-gql';
|
|
4
5
|
|
|
5
|
-
declare function Suggestion({ title, message, onClick, partial, className }: SuggestionsProps): JSX.Element;
|
|
6
|
+
declare function Suggestion({ title, message, onClick, partial, className }: SuggestionsProps): react_jsx_runtime.JSX.Element;
|
|
6
7
|
declare const reloadSuggestions: (context: CopilotContextParams, chatSuggestionConfiguration: {
|
|
7
8
|
[key: string]: CopilotChatSuggestionConfiguration;
|
|
8
9
|
}, setCurrentSuggestions: (suggestions: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/chat/Suggestion.tsx","../../../src/components/chat/Icons.tsx"],"sourcesContent":["import {\n CopilotContextParams,\n extract,\n CopilotChatSuggestionConfiguration,\n} from \"@copilotkit/react-core\";\nimport { SuggestionsProps } from \"./props\";\nimport { SmallSpinnerIcon } from \"./Icons\";\nimport { CopilotChatSuggestion } from \"../../types/suggestions\";\nimport { actionParametersToJsonSchema } from \"@copilotkit/shared\";\nimport { CopilotRequestType } from \"@copilotkit/runtime-client-gql\";\n\nexport function Suggestion({ title, message, onClick, partial, className }: SuggestionsProps) {\n return (\n <button\n disabled={partial}\n onClick={(e) => {\n e.preventDefault();\n onClick(message);\n }}\n className={className || \"suggestion\"}\n >\n {partial && SmallSpinnerIcon}\n <span>{title}</span>\n </button>\n );\n}\n\nexport const reloadSuggestions = async (\n context: CopilotContextParams,\n chatSuggestionConfiguration: { [key: string]: CopilotChatSuggestionConfiguration },\n setCurrentSuggestions: (suggestions: { title: string; message: string }[]) => void,\n abortControllerRef: React.MutableRefObject<AbortController | null>,\n) => {\n const abortController = abortControllerRef.current;\n\n const tools = JSON.stringify(\n Object.values(context.actions).map((action) => ({\n name: action.name,\n description: action.description,\n jsonSchema: JSON.stringify(actionParametersToJsonSchema(action.parameters)),\n })),\n );\n\n const allSuggestions: CopilotChatSuggestion[] = [];\n\n for (const config of Object.values(chatSuggestionConfiguration)) {\n try {\n const numOfSuggestionsInstructions =\n config.minSuggestions === 0\n ? `Produce up to ${config.maxSuggestions} suggestions. ` +\n `If there are no highly relevant suggestions you can think of, provide an empty array.`\n : `Produce between ${config.minSuggestions} and ${config.maxSuggestions} suggestions.`;\n const result = await extract({\n context,\n instructions:\n \"Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. \" +\n config.instructions +\n \"\\n\\n\" +\n numOfSuggestionsInstructions,\n data: \"Available tools: \" + tools + \"\\n\\n\",\n requestType: CopilotRequestType.Task,\n parameters: [\n {\n name: \"suggestions\",\n type: \"object[]\",\n attributes: [\n {\n name: \"title\",\n description:\n \"The title of the suggestion. This is shown as a button and should be short.\",\n type: \"string\",\n },\n {\n name: \"message\",\n description:\n \"The message to send when the suggestion is clicked. This should be a clear, complete sentence and will be sent as an instruction to the AI.\",\n type: \"string\",\n },\n ],\n },\n ],\n include: {\n messages: true,\n readable: true,\n },\n abortSignal: abortController?.signal,\n stream: ({ status, args }) => {\n const suggestions = args.suggestions || [];\n const newSuggestions: CopilotChatSuggestion[] = [];\n for (let i = 0; i < suggestions.length; i++) {\n // if GPT provides too many suggestions, limit the number of suggestions\n if (config.maxSuggestions !== undefined && i >= config.maxSuggestions) {\n break;\n }\n const { title, message } = suggestions[i];\n\n // If this is the last suggestion and the status is not complete, mark it as partial\n const partial = i == suggestions.length - 1 && status !== \"complete\";\n\n newSuggestions.push({\n title,\n message,\n partial,\n className: config.className,\n });\n }\n setCurrentSuggestions([...allSuggestions, ...newSuggestions]);\n },\n });\n allSuggestions.push(...result.suggestions);\n } catch (error) {\n console.error(\"Error loading suggestions\", error);\n }\n }\n\n if (abortControllerRef.current === abortController) {\n abortControllerRef.current = null;\n }\n};\n","import React from \"react\";\n\nexport const OpenIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <g transform=\"translate(24, 0) scale(-1, 1)\">\n <path\n fillRule=\"evenodd\"\n d=\"M5.337 21.718a6.707 6.707 0 01-.533-.074.75.75 0 01-.44-1.223 3.73 3.73 0 00.814-1.686c.023-.115-.022-.317-.254-.543C3.274 16.587 2.25 14.41 2.25 12c0-5.03 4.428-9 9.75-9s9.75 3.97 9.75 9c0 5.03-4.428 9-9.75 9-.833 0-1.643-.097-2.417-.279a6.721 6.721 0 01-4.246.997z\"\n clipRule=\"evenodd\"\n />\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=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M19.5 8.25l-7.5 7.5-7.5-7.5\" />\n </svg>\n);\n\nexport const HeaderCloseIcon = (\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=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n);\n\nexport const SendIcon = (\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=\"24\"\n height=\"24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5\"\n />\n </svg>\n);\n\nexport const SpinnerIcon = (\n <svg\n style={{\n animation: \"copilotKitSpinAnimation 1s linear infinite\",\n color: \"rgb(107 114 128)\",\n }}\n width=\"24\"\n height=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n >\n <circle\n style={{ opacity: 0.25 }}\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n ></circle>\n <path\n style={{ opacity: 0.75 }}\n fill=\"currentColor\"\n 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\"\n ></path>\n </svg>\n);\n\nexport const SmallSpinnerIcon = (\n <svg\n style={{\n animation: \"copilotKitSpinAnimation 1s linear infinite\",\n }}\n width=\"13\"\n height=\"13\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n >\n <circle\n style={{ opacity: 0.25 }}\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n ></circle>\n <path\n style={{ opacity: 0.75 }}\n fill=\"currentColor\"\n 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\"\n ></path>\n </svg>\n);\n\nexport const ActivityIcon = (\n <svg\n style={{\n display: \"inline-block\",\n marginLeft: \"0.25rem\",\n marginRight: \"0.25rem\",\n }}\n height=\"24\"\n width=\"24\"\n viewBox=\"0 0 27 27\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n >\n <circle className=\"copilotKitActivityDot1\" cx=\"4\" cy=\"12\" r=\"3\" />\n <circle className=\"copilotKitActivityDot1 copilotKitActivityDot2\" cx=\"12\" cy=\"12\" r=\"3\" />\n <circle className=\"copilotKitActivityDot1 copilotKitActivityDot3\" cx=\"20\" cy=\"12\" r=\"3\" />\n </svg>\n);\n\nexport function CheckIcon({ className, ...props }: React.ComponentProps<\"svg\">) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 256 256\"\n fill=\"currentColor\"\n style={{ height: \"1rem\", width: \"1rem\" }}\n className={className}\n {...props}\n >\n <path d=\"m229.66 77.66-128 128a8 8 0 0 1-11.32 0l-56-56a8 8 0 0 1 11.32-11.32L96 188.69 218.34 66.34a8 8 0 0 1 11.32 11.32Z\" />\n </svg>\n );\n}\n\nexport function DownloadIcon({ className, ...props }: React.ComponentProps<\"svg\">) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 256 256\"\n fill=\"currentColor\"\n style={{ height: \"1rem\", width: \"1rem\" }}\n className={className}\n {...props}\n >\n <path d=\"M224 152v56a16 16 0 0 1-16 16H48a16 16 0 0 1-16-16v-56a8 8 0 0 1 16 0v56h160v-56a8 8 0 0 1 16 0Zm-101.66 5.66a8 8 0 0 0 11.32 0l40-40a8 8 0 0 0-11.32-11.32L136 132.69V40a8 8 0 0 0-16 0v92.69l-26.34-26.35a8 8 0 0 0-11.32 11.32Z\" />\n </svg>\n );\n}\n\nexport function CopyIcon({ className, ...props }: React.ComponentProps<\"svg\">) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 256 256\"\n fill=\"currentColor\"\n style={{ height: \"1rem\", width: \"1rem\" }}\n className={className}\n {...props}\n >\n <path d=\"M216 32H88a8 8 0 0 0-8 8v40H40a8 8 0 0 0-8 8v128a8 8 0 0 0 8 8h128a8 8 0 0 0 8-8v-40h40a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8Zm-56 176H48V96h112Zm48-48h-32V88a8 8 0 0 0-8-8H96V48h112Z\" />\n </svg>\n );\n}\n\nexport const StopIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 256 256\"\n fill=\"currentColor\"\n style={{ height: \"1rem\", width: \"1rem\" }}\n >\n <path d=\"M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24Zm0 192a88 88 0 1 1 88-88 88.1 88.1 0 0 1-88 88Zm24-120h-48a8 8 0 0 0-8 8v48a8 8 0 0 0 8 8h48a8 8 0 0 0 8-8v-48a8 8 0 0 0-8-8Zm-8 48h-32v-32h32Z\" />\n </svg>\n);\n\nexport const RegenerateIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 256 256\"\n fill=\"currentColor\"\n style={{ height: \"1rem\", width: \"1rem\" }}\n >\n <path d=\"M197.67 186.37a8 8 0 0 1 0 11.29C196.58 198.73 170.82 224 128 224c-37.39 0-64.53-22.4-80-39.85V208a8 8 0 0 1-16 0v-48a8 8 0 0 1 8-8h48a8 8 0 0 1 0 16H55.44C67.76 183.35 93 208 128 208c36 0 58.14-21.46 58.36-21.68a8 8 0 0 1 11.31.05ZM216 40a8 8 0 0 0-8 8v23.85C192.53 54.4 165.39 32 128 32c-42.82 0-68.58 25.27-69.66 26.34a8 8 0 0 0 11.3 11.34C69.86 69.46 92 48 128 48c35 0 60.24 24.65 72.56 40H168a8 8 0 0 0 0 16h48a8 8 0 0 0 8-8V48a8 8 0 0 0-8-8Z\" />\n </svg>\n);\n\nexport const PushToTalkIcon = (\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 className=\"w-6 h-6\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M12 18.75a6 6 0 0 0 6-6v-1.5m-6 7.5a6 6 0 0 1-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 0 1-3-3V4.5a3 3 0 1 1 6 0v8.25a3 3 0 0 1-3 3Z\"\n />\n </svg>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAIO;;;ACOD;AAmFC,IAAM,mBACX;AAAA,EAAC;AAAA;AAAA,IACC,OAAO;AAAA,MACL,WAAW;AAAA,IACb;AAAA,IACA,OAAM;AAA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chat/Suggestion.tsx","../../../src/components/chat/Icons.tsx"],"sourcesContent":["import {\n CopilotContextParams,\n extract,\n CopilotChatSuggestionConfiguration,\n useCopilotContext,\n} from \"@copilotkit/react-core\";\nimport { SuggestionsProps } from \"./props\";\nimport { SmallSpinnerIcon } from \"./Icons\";\nimport { CopilotChatSuggestion } from \"../../types/suggestions\";\nimport { actionParametersToJsonSchema } from \"@copilotkit/shared\";\nimport { CopilotRequestType } from \"@copilotkit/runtime-client-gql\";\n\nexport function Suggestion({ title, message, onClick, partial, className }: SuggestionsProps) {\n return (\n <button\n disabled={partial}\n onClick={(e) => {\n e.preventDefault();\n onClick(message);\n }}\n className={className || \"suggestion\"}\n >\n {partial && SmallSpinnerIcon}\n <span>{title}</span>\n </button>\n );\n}\n\nexport const reloadSuggestions = async (\n context: CopilotContextParams,\n chatSuggestionConfiguration: { [key: string]: CopilotChatSuggestionConfiguration },\n setCurrentSuggestions: (suggestions: { title: string; message: string }[]) => void,\n abortControllerRef: React.MutableRefObject<AbortController | null>,\n) => {\n const abortController = abortControllerRef.current;\n\n const tools = JSON.stringify(\n Object.values(context.actions).map((action) => ({\n name: action.name,\n description: action.description,\n jsonSchema: JSON.stringify(actionParametersToJsonSchema(action.parameters)),\n })),\n );\n\n const allSuggestions: CopilotChatSuggestion[] = [];\n\n for (const config of Object.values(chatSuggestionConfiguration)) {\n try {\n const numOfSuggestionsInstructions =\n config.minSuggestions === 0\n ? `Produce up to ${config.maxSuggestions} suggestions. ` +\n `If there are no highly relevant suggestions you can think of, provide an empty array.`\n : `Produce between ${config.minSuggestions} and ${config.maxSuggestions} suggestions.`;\n\n const result = await extract({\n context,\n instructions:\n \"Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. \" +\n config.instructions +\n \"\\n\\n\" +\n numOfSuggestionsInstructions,\n data: \"Available tools: \" + tools + \"\\n\\n\",\n requestType: CopilotRequestType.Task,\n parameters: [\n {\n name: \"suggestions\",\n type: \"object[]\",\n attributes: [\n {\n name: \"title\",\n description:\n \"The title of the suggestion. This is shown as a button and should be short.\",\n type: \"string\",\n },\n {\n name: \"message\",\n description:\n \"The message to send when the suggestion is clicked. This should be a clear, complete sentence and will be sent as an instruction to the AI.\",\n type: \"string\",\n },\n ],\n },\n ],\n include: {\n messages: true,\n readable: true,\n },\n abortSignal: abortController?.signal,\n stream: ({ status, args }) => {\n const suggestions = args.suggestions || [];\n const newSuggestions: CopilotChatSuggestion[] = [];\n for (let i = 0; i < suggestions.length; i++) {\n // if GPT provides too many suggestions, limit the number of suggestions\n if (config.maxSuggestions !== undefined && i >= config.maxSuggestions) {\n break;\n }\n const { title, message } = suggestions[i];\n\n // If this is the last suggestion and the status is not complete, mark it as partial\n const partial = i == suggestions.length - 1 && status !== \"complete\";\n\n newSuggestions.push({\n title,\n message,\n partial,\n className: config.className,\n });\n }\n setCurrentSuggestions([...allSuggestions, ...newSuggestions]);\n },\n });\n allSuggestions.push(...result.suggestions);\n } catch (error) {\n console.error(\"Error loading suggestions\", error);\n }\n }\n\n if (abortControllerRef.current === abortController) {\n abortControllerRef.current = null;\n }\n};\n","import React from \"react\";\n\nexport const OpenIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"currentColor\"\n width=\"24\"\n height=\"24\"\n >\n <g transform=\"translate(24, 0) scale(-1, 1)\">\n <path\n fillRule=\"evenodd\"\n d=\"M5.337 21.718a6.707 6.707 0 01-.533-.074.75.75 0 01-.44-1.223 3.73 3.73 0 00.814-1.686c.023-.115-.022-.317-.254-.543C3.274 16.587 2.25 14.41 2.25 12c0-5.03 4.428-9 9.75-9s9.75 3.97 9.75 9c0 5.03-4.428 9-9.75 9-.833 0-1.643-.097-2.417-.279a6.721 6.721 0 01-4.246.997z\"\n clipRule=\"evenodd\"\n />\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=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M19.5 8.25l-7.5 7.5-7.5-7.5\" />\n </svg>\n);\n\nexport const HeaderCloseIcon = (\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=\"24\"\n height=\"24\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M6 18L18 6M6 6l12 12\" />\n </svg>\n);\n\nexport const SendIcon = (\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=\"24\"\n height=\"24\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M6 12L3.269 3.126A59.768 59.768 0 0121.485 12 59.77 59.77 0 013.27 20.876L5.999 12zm0 0h7.5\"\n />\n </svg>\n);\n\nexport const SpinnerIcon = (\n <svg\n style={{\n animation: \"copilotKitSpinAnimation 1s linear infinite\",\n color: \"rgb(107 114 128)\",\n }}\n width=\"24\"\n height=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n >\n <circle\n style={{ opacity: 0.25 }}\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n ></circle>\n <path\n style={{ opacity: 0.75 }}\n fill=\"currentColor\"\n 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\"\n ></path>\n </svg>\n);\n\nexport const SmallSpinnerIcon = (\n <svg\n style={{\n animation: \"copilotKitSpinAnimation 1s linear infinite\",\n }}\n width=\"13\"\n height=\"13\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n >\n <circle\n style={{ opacity: 0.25 }}\n cx=\"12\"\n cy=\"12\"\n r=\"10\"\n stroke=\"currentColor\"\n strokeWidth=\"4\"\n ></circle>\n <path\n style={{ opacity: 0.75 }}\n fill=\"currentColor\"\n 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\"\n ></path>\n </svg>\n);\n\nexport const ActivityIcon = (\n <svg\n style={{\n display: \"inline-block\",\n marginLeft: \"0.25rem\",\n marginRight: \"0.25rem\",\n }}\n height=\"24\"\n width=\"24\"\n viewBox=\"0 0 27 27\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"currentColor\"\n >\n <circle className=\"copilotKitActivityDot1\" cx=\"4\" cy=\"12\" r=\"3\" />\n <circle className=\"copilotKitActivityDot1 copilotKitActivityDot2\" cx=\"12\" cy=\"12\" r=\"3\" />\n <circle className=\"copilotKitActivityDot1 copilotKitActivityDot3\" cx=\"20\" cy=\"12\" r=\"3\" />\n </svg>\n);\n\nexport function CheckIcon({ className, ...props }: React.ComponentProps<\"svg\">) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 256 256\"\n fill=\"currentColor\"\n style={{ height: \"1rem\", width: \"1rem\" }}\n className={className}\n {...props}\n >\n <path d=\"m229.66 77.66-128 128a8 8 0 0 1-11.32 0l-56-56a8 8 0 0 1 11.32-11.32L96 188.69 218.34 66.34a8 8 0 0 1 11.32 11.32Z\" />\n </svg>\n );\n}\n\nexport function DownloadIcon({ className, ...props }: React.ComponentProps<\"svg\">) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 256 256\"\n fill=\"currentColor\"\n style={{ height: \"1rem\", width: \"1rem\" }}\n className={className}\n {...props}\n >\n <path d=\"M224 152v56a16 16 0 0 1-16 16H48a16 16 0 0 1-16-16v-56a8 8 0 0 1 16 0v56h160v-56a8 8 0 0 1 16 0Zm-101.66 5.66a8 8 0 0 0 11.32 0l40-40a8 8 0 0 0-11.32-11.32L136 132.69V40a8 8 0 0 0-16 0v92.69l-26.34-26.35a8 8 0 0 0-11.32 11.32Z\" />\n </svg>\n );\n}\n\nexport function CopyIcon({ className, ...props }: React.ComponentProps<\"svg\">) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 256 256\"\n fill=\"currentColor\"\n style={{ height: \"1rem\", width: \"1rem\" }}\n className={className}\n {...props}\n >\n <path d=\"M216 32H88a8 8 0 0 0-8 8v40H40a8 8 0 0 0-8 8v128a8 8 0 0 0 8 8h128a8 8 0 0 0 8-8v-40h40a8 8 0 0 0 8-8V40a8 8 0 0 0-8-8Zm-56 176H48V96h112Zm48-48h-32V88a8 8 0 0 0-8-8H96V48h112Z\" />\n </svg>\n );\n}\n\nexport const StopIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 256 256\"\n fill=\"currentColor\"\n style={{ height: \"1rem\", width: \"1rem\" }}\n >\n <path d=\"M128 24a104 104 0 1 0 104 104A104.11 104.11 0 0 0 128 24Zm0 192a88 88 0 1 1 88-88 88.1 88.1 0 0 1-88 88Zm24-120h-48a8 8 0 0 0-8 8v48a8 8 0 0 0 8 8h48a8 8 0 0 0 8-8v-48a8 8 0 0 0-8-8Zm-8 48h-32v-32h32Z\" />\n </svg>\n);\n\nexport const RegenerateIcon = (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 256 256\"\n fill=\"currentColor\"\n style={{ height: \"1rem\", width: \"1rem\" }}\n >\n <path d=\"M197.67 186.37a8 8 0 0 1 0 11.29C196.58 198.73 170.82 224 128 224c-37.39 0-64.53-22.4-80-39.85V208a8 8 0 0 1-16 0v-48a8 8 0 0 1 8-8h48a8 8 0 0 1 0 16H55.44C67.76 183.35 93 208 128 208c36 0 58.14-21.46 58.36-21.68a8 8 0 0 1 11.31.05ZM216 40a8 8 0 0 0-8 8v23.85C192.53 54.4 165.39 32 128 32c-42.82 0-68.58 25.27-69.66 26.34a8 8 0 0 0 11.3 11.34C69.86 69.46 92 48 128 48c35 0 60.24 24.65 72.56 40H168a8 8 0 0 0 0 16h48a8 8 0 0 0 8-8V48a8 8 0 0 0-8-8Z\" />\n </svg>\n);\n\nexport const PushToTalkIcon = (\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 className=\"w-6 h-6\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"M12 18.75a6 6 0 0 0 6-6v-1.5m-6 7.5a6 6 0 0 1-6-6v-1.5m6 7.5v3.75m-3.75 0h7.5M12 15.75a3 3 0 0 1-3-3V4.5a3 3 0 1 1 6 0v8.25a3 3 0 0 1-3 3Z\"\n />\n </svg>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAKO;;;ACMD;AAmFC,IAAM,mBACX;AAAA,EAAC;AAAA;AAAA,IACC,OAAO;AAAA,MACL,WAAW;AAAA,IACb;AAAA,IACA,OAAM;AAAA,IACN,QAAO;AAAA,IACP,OAAM;AAAA,IACN,MAAK;AAAA,IACL,SAAQ;AAAA,IAER;AAAA;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,EAAE,SAAS,KAAK;AAAA,UACvB,IAAG;AAAA,UACH,IAAG;AAAA,UACH,GAAE;AAAA,UACF,QAAO;AAAA,UACP,aAAY;AAAA;AAAA,MACb;AAAA,MACD;AAAA,QAAC;AAAA;AAAA,UACC,OAAO,EAAE,SAAS,KAAK;AAAA,UACvB,MAAK;AAAA,UACL,GAAE;AAAA;AAAA,MACH;AAAA;AAAA;AACH;;;AD7GF,oBAA6C;AA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AAA,UACP,UAAU;AAAA,UACV,UAAU;AAAA,QACZ;AAAA,QACA,aAAa,mDAAiB;AAAA,QAC9B,QAAQ,CAAC,EAAE,QAAQ,KAAK,MAAM;AAC5B,gBAAM,cAAc,KAAK,eAAe,CAAC;AACzC,gBAAM,iBAA0C,CAAC;AACjD,mBAAS,IAAI,GAAG,IAAI,YAAY,QAAQ,KAAK;AAE3C,gBAAI,OAAO,mBAAmB,UAAa,KAAK,OAAO,gBAAgB;AACrE;AAAA,YACF;AACA,kBAAM,EAAE,OAAO,QAAQ,IAAI,YAAY,CAAC;AAGxC,kBAAM,UAAU,KAAK,YAAY,SAAS,KAAK,WAAW;AAE1D,2BAAe,KAAK;AAAA,cAClB;AAAA,cACA;AAAA,cACA;AAAA,cACA,WAAW,OAAO;AAAA,YACpB,CAAC;AAAA,UACH;AACA,gCAAsB,CAAC,GAAG,gBAAgB,GAAG,cAAc,CAAC;AAAA,QAC9D;AAAA,MACF,CAAC;AACD,qBAAe,KAAK,GAAG,OAAO,WAAW;AAAA,IAC3C,SAAS,OAAP;AACA,cAAQ,MAAM,6BAA6B,KAAK;AAAA,IAClD;AAAA,EACF;AAEA,MAAI,mBAAmB,YAAY,iBAAiB;AAClD,uBAAmB,UAAU;AAAA,EAC/B;AACF;","names":["import_jsx_runtime"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
1
2
|
import { WindowProps } from './props.js';
|
|
2
3
|
import '@copilotkit/runtime-client-gql';
|
|
3
4
|
|
|
4
|
-
declare const Window: ({
|
|
5
|
+
declare const Window: ({ children, clickOutsideToClose, shortcut, hitEscapeToClose, }: WindowProps) => react_jsx_runtime.JSX.Element;
|
|
5
6
|
|
|
6
7
|
export { Window };
|
|
@@ -33,18 +33,33 @@ __export(Window_exports, {
|
|
|
33
33
|
Window: () => Window
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(Window_exports);
|
|
36
|
+
var import_react2 = __toESM(require("react"));
|
|
37
|
+
|
|
38
|
+
// src/components/chat/ChatContext.tsx
|
|
36
39
|
var import_react = __toESM(require("react"));
|
|
37
40
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
41
|
+
var ChatContext = import_react.default.createContext(void 0);
|
|
42
|
+
function useChatContext() {
|
|
43
|
+
const context = import_react.default.useContext(ChatContext);
|
|
44
|
+
if (context === void 0) {
|
|
45
|
+
throw new Error(
|
|
46
|
+
"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?"
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
return context;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// src/components/chat/Window.tsx
|
|
53
|
+
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
38
54
|
var Window = ({
|
|
39
|
-
open,
|
|
40
|
-
setOpen,
|
|
41
55
|
children,
|
|
42
56
|
clickOutsideToClose,
|
|
43
57
|
shortcut,
|
|
44
58
|
hitEscapeToClose
|
|
45
59
|
}) => {
|
|
46
|
-
const windowRef =
|
|
47
|
-
const
|
|
60
|
+
const windowRef = import_react2.default.useRef(null);
|
|
61
|
+
const { open, setOpen } = useChatContext();
|
|
62
|
+
const handleClickOutside = (0, import_react2.useCallback)(
|
|
48
63
|
(event) => {
|
|
49
64
|
var _a;
|
|
50
65
|
if (!clickOutsideToClose) {
|
|
@@ -62,7 +77,7 @@ var Window = ({
|
|
|
62
77
|
},
|
|
63
78
|
[clickOutsideToClose, open, setOpen]
|
|
64
79
|
);
|
|
65
|
-
const handleKeyDown = (0,
|
|
80
|
+
const handleKeyDown = (0, import_react2.useCallback)(
|
|
66
81
|
(event) => {
|
|
67
82
|
var _a;
|
|
68
83
|
const target = event.target;
|
|
@@ -76,7 +91,7 @@ var Window = ({
|
|
|
76
91
|
},
|
|
77
92
|
[hitEscapeToClose, shortcut, open, setOpen]
|
|
78
93
|
);
|
|
79
|
-
const adjustForMobile = (0,
|
|
94
|
+
const adjustForMobile = (0, import_react2.useCallback)(() => {
|
|
80
95
|
const copilotKitWindow = windowRef.current;
|
|
81
96
|
const vv = window.visualViewport;
|
|
82
97
|
if (!copilotKitWindow || !vv) {
|
|
@@ -107,7 +122,7 @@ var Window = ({
|
|
|
107
122
|
document.body.removeEventListener("touchmove", preventScroll);
|
|
108
123
|
}
|
|
109
124
|
}, [open]);
|
|
110
|
-
(0,
|
|
125
|
+
(0, import_react2.useEffect)(() => {
|
|
111
126
|
document.addEventListener("mousedown", handleClickOutside);
|
|
112
127
|
document.addEventListener("keydown", handleKeyDown);
|
|
113
128
|
if (window.visualViewport) {
|
|
@@ -122,7 +137,7 @@ var Window = ({
|
|
|
122
137
|
}
|
|
123
138
|
};
|
|
124
139
|
}, [adjustForMobile, handleClickOutside, handleKeyDown]);
|
|
125
|
-
return /* @__PURE__ */ (0,
|
|
140
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: `copilotKitWindow${open ? " open" : ""}`, ref: windowRef, children });
|
|
126
141
|
};
|
|
127
142
|
var preventScroll = (event) => {
|
|
128
143
|
let targetElement = event.target;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/chat/Window.tsx"],"sourcesContent":["import React, { useCallback, useEffect } from \"react\";\nimport { WindowProps } from \"./props\";\n\nexport const Window = ({\n open,\n setOpen,\n children,\n clickOutsideToClose,\n shortcut,\n hitEscapeToClose,\n}: WindowProps) => {\n const windowRef = React.useRef<HTMLDivElement>(null);\n\n const handleClickOutside = useCallback(\n (event: MouseEvent) => {\n if (!clickOutsideToClose) {\n return;\n }\n\n const parentElement = windowRef.current?.parentElement;\n\n let className = \"\";\n if (event.target instanceof HTMLElement) {\n className = event.target.className;\n }\n\n if (\n open &&\n parentElement &&\n !parentElement.contains(event.target as any) &&\n // prevent closing the window when clicking on the debug menu\n !className.includes(\"copilotKitDebugMenu\")\n ) {\n setOpen(false);\n }\n },\n [clickOutsideToClose, open, setOpen],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const isInput =\n target.tagName === \"INPUT\" ||\n target.tagName === \"SELECT\" ||\n target.tagName === \"TEXTAREA\" ||\n target.isContentEditable;\n\n const isDescendantOfWrapper = windowRef.current?.contains(target);\n\n if (\n open &&\n event.key === \"Escape\" &&\n (!isInput || isDescendantOfWrapper) &&\n hitEscapeToClose\n ) {\n setOpen(false);\n } else if (\n event.key === shortcut &&\n ((isMacOS() && event.metaKey) || (!isMacOS() && event.ctrlKey)) &&\n (!isInput || isDescendantOfWrapper)\n ) {\n setOpen(!open);\n }\n },\n [hitEscapeToClose, shortcut, open, setOpen],\n );\n\n const adjustForMobile = useCallback(() => {\n const copilotKitWindow = windowRef.current;\n const vv = window.visualViewport;\n if (!copilotKitWindow || !vv) {\n return;\n }\n\n if (window.innerWidth < 640 && open) {\n copilotKitWindow.style.height = `${vv.height}px`;\n copilotKitWindow.style.left = `${vv.offsetLeft}px`;\n copilotKitWindow.style.top = `${vv.offsetTop}px`;\n\n document.body.style.position = \"fixed\";\n document.body.style.width = \"100%\";\n document.body.style.height = `${window.innerHeight}px`;\n document.body.style.overflow = \"hidden\";\n document.body.style.touchAction = \"none\";\n\n // Prevent scrolling on iOS\n document.body.addEventListener(\"touchmove\", preventScroll, {\n passive: false,\n });\n } else {\n copilotKitWindow.style.height = \"\";\n copilotKitWindow.style.left = \"\";\n copilotKitWindow.style.top = \"\";\n document.body.style.position = \"\";\n document.body.style.height = \"\";\n document.body.style.width = \"\";\n document.body.style.overflow = \"\";\n document.body.style.top = \"\";\n document.body.style.touchAction = \"\";\n\n document.body.removeEventListener(\"touchmove\", preventScroll);\n }\n }, [open]);\n\n useEffect(() => {\n document.addEventListener(\"mousedown\", handleClickOutside);\n document.addEventListener(\"keydown\", handleKeyDown);\n if (window.visualViewport) {\n window.visualViewport.addEventListener(\"resize\", adjustForMobile);\n adjustForMobile();\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n document.removeEventListener(\"keydown\", handleKeyDown);\n if (window.visualViewport) {\n window.visualViewport.removeEventListener(\"resize\", adjustForMobile);\n }\n };\n }, [adjustForMobile, handleClickOutside, handleKeyDown]);\n\n return (\n <div className={`copilotKitWindow${open ? \" open\" : \"\"}`} ref={windowRef}>\n {children}\n </div>\n );\n};\n\nconst preventScroll = (event: TouchEvent): void => {\n let targetElement = event.target as Element;\n\n // Function to check if the target has the parent with a given class\n const hasParentWithClass = (element: Element, className: string): boolean => {\n while (element && element !== document.body) {\n if (element.classList.contains(className)) {\n return true;\n }\n element = element.parentElement!;\n }\n return false;\n };\n\n // Check if the target of the touch event is inside an element with the 'copilotKitMessages' class\n if (!hasParentWithClass(targetElement, \"copilotKitMessages\")) {\n event.preventDefault();\n }\n};\n\nfunction isMacOS() {\n return /Mac|iMac|Macintosh/i.test(navigator.userAgent);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA8C;AA2H1C;AAxHG,IAAM,SAAS,CAAC;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAmB;AACjB,QAAM,YAAY,aAAAA,QAAM,OAAuB,IAAI;AAEnD,QAAM,yBAAqB;AAAA,IACzB,CAAC,UAAsB;AAd3B;AAeM,UAAI,CAAC,qBAAqB;AACxB;AAAA,MACF;AAEA,YAAM,iBAAgB,eAAU,YAAV,mBAAmB;AAEzC,UAAI,YAAY;AAChB,UAAI,MAAM,kBAAkB,aAAa;AACvC,oBAAY,MAAM,OAAO;AAAA,MAC3B;AAEA,UACE,QACA,iBACA,CAAC,cAAc,SAAS,MAAM,MAAa;AAAA,MAE3C,CAAC,UAAU,SAAS,qBAAqB,GACzC;AACA,gBAAQ,KAAK;AAAA,MACf;AAAA,IACF;AAAA,IACA,CAAC,qBAAqB,MAAM,OAAO;AAAA,EACrC;AAEA,QAAM,oBAAgB;AAAA,IACpB,CAAC,UAAy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M,MAAM;AAC1B,eAAS,KAAK,MAAM,cAAc;AAElC,eAAS,KAAK,oBAAoB,aAAa,aAAa;AAAA,IAC9D;AAAA,EACF,GAAG,CAAC,IAAI,CAAC;AAET,8BAAU,MAAM;AACd,aAAS,iBAAiB,aAAa,kBAAkB;AACzD,aAAS,iBAAiB,WAAW,aAAa;AAClD,QAAI,OAAO,gBAAgB;AACzB,aAAO,eAAe,iBAAiB,UAAU,eAAe;AAChE,sBAAgB;AAAA,IAClB;AAEA,WAAO,MAAM;AACX,eAAS,oBAAoB,aAAa,kBAAkB;AAC5D,eAAS,oBAAoB,WAAW,aAAa;AACrD,UAAI,OAAO,gBAAgB;AACzB,eAAO,eAAe,oBAAoB,UAAU,eAAe;AAAA,MACrE;AAAA,IACF;AAAA,EACF,GAAG,CAAC,iBAAiB,oBAAoB,aAAa,CAAC;AAEvD,SACE,4CAAC,SAAI,WAAW,mBAAmB,OAAO,UAAU,MAAM,KAAK,WAC5D,UACH;AAEJ;AAEA,IAAM,gBAAgB,CAAC,UAA4B;AACjD,MAAI,gBAAgB,MAAM;AAG1B,QAAM,qBAAqB,CAAC,SAAkB,cAA+B;AAC3E,WAAO,WAAW,YAAY,SAAS,MAAM;AAC3C,UAAI,QAAQ,UAAU,SAAS,SAAS,GAAG;AACzC,eAAO;AAAA,MACT;AACA,gBAAU,QAAQ;AAAA,IACpB;AACA,WAAO;AAAA,EACT;AAGA,MAAI,CAAC,mBAAmB,eAAe,oBAAoB,GAAG;AAC5D,UAAM,eAAe;AAAA,EACvB;AACF;AAEA,SAAS,UAAU;AACjB,SAAO,sBAAsB,KAAK,UAAU,SAAS;AACvD;","names":["React"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/chat/Window.tsx","../../../src/components/chat/ChatContext.tsx"],"sourcesContent":["import React, { useCallback, useEffect } from \"react\";\nimport { WindowProps } from \"./props\";\nimport { useChatContext } from \"./ChatContext\";\n\nexport const Window = ({\n children,\n clickOutsideToClose,\n shortcut,\n hitEscapeToClose,\n}: WindowProps) => {\n const windowRef = React.useRef<HTMLDivElement>(null);\n\n const { open, setOpen } = useChatContext();\n\n const handleClickOutside = useCallback(\n (event: MouseEvent) => {\n if (!clickOutsideToClose) {\n return;\n }\n\n const parentElement = windowRef.current?.parentElement;\n\n let className = \"\";\n if (event.target instanceof HTMLElement) {\n className = event.target.className;\n }\n\n if (\n open &&\n parentElement &&\n !parentElement.contains(event.target as any) &&\n // prevent closing the window when clicking on the debug menu\n !className.includes(\"copilotKitDebugMenu\")\n ) {\n setOpen(false);\n }\n },\n [clickOutsideToClose, open, setOpen],\n );\n\n const handleKeyDown = useCallback(\n (event: KeyboardEvent) => {\n const target = event.target as HTMLElement;\n const isInput =\n target.tagName === \"INPUT\" ||\n target.tagName === \"SELECT\" ||\n target.tagName === \"TEXTAREA\" ||\n target.isContentEditable;\n\n const isDescendantOfWrapper = windowRef.current?.contains(target);\n\n if (\n open &&\n event.key === \"Escape\" &&\n (!isInput || isDescendantOfWrapper) &&\n hitEscapeToClose\n ) {\n setOpen(false);\n } else if (\n event.key === shortcut &&\n ((isMacOS() && event.metaKey) || (!isMacOS() && event.ctrlKey)) &&\n (!isInput || isDescendantOfWrapper)\n ) {\n setOpen(!open);\n }\n },\n [hitEscapeToClose, shortcut, open, setOpen],\n );\n\n const adjustForMobile = useCallback(() => {\n const copilotKitWindow = windowRef.current;\n const vv = window.visualViewport;\n if (!copilotKitWindow || !vv) {\n return;\n }\n\n if (window.innerWidth < 640 && open) {\n copilotKitWindow.style.height = `${vv.height}px`;\n copilotKitWindow.style.left = `${vv.offsetLeft}px`;\n copilotKitWindow.style.top = `${vv.offsetTop}px`;\n\n document.body.style.position = \"fixed\";\n document.body.style.width = \"100%\";\n document.body.style.height = `${window.innerHeight}px`;\n document.body.style.overflow = \"hidden\";\n document.body.style.touchAction = \"none\";\n\n // Prevent scrolling on iOS\n document.body.addEventListener(\"touchmove\", preventScroll, {\n passive: false,\n });\n } else {\n copilotKitWindow.style.height = \"\";\n copilotKitWindow.style.left = \"\";\n copilotKitWindow.style.top = \"\";\n document.body.style.position = \"\";\n document.body.style.height = \"\";\n document.body.style.width = \"\";\n document.body.style.overflow = \"\";\n document.body.style.top = \"\";\n document.body.style.touchAction = \"\";\n\n document.body.removeEventListener(\"touchmove\", preventScroll);\n }\n }, [open]);\n\n useEffect(() => {\n document.addEventListener(\"mousedown\", handleClickOutside);\n document.addEventListener(\"keydown\", handleKeyDown);\n if (window.visualViewport) {\n window.visualViewport.addEventListener(\"resize\", adjustForMobile);\n adjustForMobile();\n }\n\n return () => {\n document.removeEventListener(\"mousedown\", handleClickOutside);\n document.removeEventListener(\"keydown\", handleKeyDown);\n if (window.visualViewport) {\n window.visualViewport.removeEventListener(\"resize\", adjustForMobile);\n }\n };\n }, [adjustForMobile, handleClickOutside, handleKeyDown]);\n\n return (\n <div className={`copilotKitWindow${open ? \" open\" : \"\"}`} ref={windowRef}>\n {children}\n </div>\n );\n};\n\nconst preventScroll = (event: TouchEvent): void => {\n let targetElement = event.target as Element;\n\n // Function to check if the target has the parent with a given class\n const hasParentWithClass = (element: Element, className: string): boolean => {\n while (element && element !== document.body) {\n if (element.classList.contains(className)) {\n return true;\n }\n element = element.parentElement!;\n }\n return false;\n };\n\n // Check if the target of the touch event is inside an element with the 'copilotKitMessages' class\n if (!hasParentWithClass(targetElement, \"copilotKitMessages\")) {\n event.preventDefault();\n }\n};\n\nfunction isMacOS() {\n return /Mac|iMac|Macintosh/i.test(navigator.userAgent);\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 context = {\n labels: {\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\n icons: {\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 open,\n setOpen,\n };\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,gBAA8C;;;ACA9C,mBAAyC;AA6KhC;AA/DF,IAAM,cAAc,aAAAC,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;;;ADII,IAAAC,sBAAA;AAxHG,IAAM,SAAS,CAAC;AAAA,EACrB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAmB;AACjB,QAAM,YAAY,cAAAC,QAAM,OAAuB,IAAI;AAEnD,QAAM,EAAE,MAAM,QAAQ,IAAI,eAAe;AAEzC,QAAM,yBAAqB;AAAA,IACzB,CAAC,UAAsB;AAf3B;AAgBM,UAAI,CAAC,qBAAqB;AACxB;AAAA,MACF;AAEA,YAAM,iBAAgB,eAAU,YAAV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,oBAAoB,GAAG;AAC5D,UAAM,eAAe;AAAA,EACvB;AACF;AAEA,SAAS,UAAU;AACjB,SAAO,sBAAsB,KAAK,UAAU,SAAS;AACvD;","names":["import_react","React","import_jsx_runtime","React"]}
|
|
@@ -4,6 +4,7 @@ export { CopilotSidebar } from './Sidebar.js';
|
|
|
4
4
|
export { CopilotChat } from './Chat.js';
|
|
5
5
|
export { useChatContext } from './ChatContext.js';
|
|
6
6
|
import '@copilotkit/runtime-client-gql';
|
|
7
|
+
import 'react/jsx-runtime';
|
|
7
8
|
import './Modal.js';
|
|
8
9
|
import 'react';
|
|
9
10
|
import '@copilotkit/react-core';
|
|
@@ -384,14 +384,13 @@ var ChatContextProvider = ({
|
|
|
384
384
|
var import_react2 = __toESM(require("react"));
|
|
385
385
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
386
386
|
var Window = ({
|
|
387
|
-
open,
|
|
388
|
-
setOpen,
|
|
389
387
|
children,
|
|
390
388
|
clickOutsideToClose,
|
|
391
389
|
shortcut,
|
|
392
390
|
hitEscapeToClose
|
|
393
391
|
}) => {
|
|
394
392
|
const windowRef = import_react2.default.useRef(null);
|
|
393
|
+
const { open, setOpen } = useChatContext();
|
|
395
394
|
const handleClickOutside = (0, import_react2.useCallback)(
|
|
396
395
|
(event) => {
|
|
397
396
|
var _a;
|
|
@@ -493,16 +492,16 @@ function isMacOS() {
|
|
|
493
492
|
|
|
494
493
|
// src/components/chat/Button.tsx
|
|
495
494
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
496
|
-
var Button = ({
|
|
497
|
-
const
|
|
495
|
+
var Button = ({}) => {
|
|
496
|
+
const { open, setOpen, icons } = useChatContext();
|
|
498
497
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { onClick: () => setOpen(!open), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
|
|
499
498
|
"button",
|
|
500
499
|
{
|
|
501
500
|
className: `copilotKitButton ${open ? "open" : ""}`,
|
|
502
501
|
"aria-label": open ? "Close Chat" : "Open Chat",
|
|
503
502
|
children: [
|
|
504
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "copilotKitButtonIcon copilotKitButtonIconOpen", children:
|
|
505
|
-
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "copilotKitButtonIcon copilotKitButtonIconClose", children:
|
|
503
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "copilotKitButtonIcon copilotKitButtonIconOpen", children: icons.openIcon }),
|
|
504
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "copilotKitButtonIcon copilotKitButtonIconClose", children: icons.closeIcon })
|
|
506
505
|
]
|
|
507
506
|
}
|
|
508
507
|
) });
|
|
@@ -510,11 +509,11 @@ var Button = ({ open, setOpen }) => {
|
|
|
510
509
|
|
|
511
510
|
// src/components/chat/Header.tsx
|
|
512
511
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
513
|
-
var Header = ({
|
|
514
|
-
const
|
|
512
|
+
var Header = ({}) => {
|
|
513
|
+
const { setOpen, icons, labels } = useChatContext();
|
|
515
514
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "copilotKitHeader", children: [
|
|
516
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children:
|
|
517
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: () => setOpen(false), "aria-label": "Close", children:
|
|
515
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { children: labels.title }),
|
|
516
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("button", { onClick: () => setOpen(false), "aria-label": "Close", children: icons.headerCloseIcon })
|
|
518
517
|
] });
|
|
519
518
|
};
|
|
520
519
|
|
|
@@ -1032,8 +1031,8 @@ var Messages = ({ messages, inProgress, children }) => {
|
|
|
1032
1031
|
} else if (message instanceof import_runtime_client_gql.TextMessage && message.role == "assistant") {
|
|
1033
1032
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: isCurrentMessage && inProgress && !message.content ? context.icons.spinnerIcon : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Markdown, { content: message.content }) }, index);
|
|
1034
1033
|
} else if (message instanceof import_runtime_client_gql.ActionExecutionMessage) {
|
|
1035
|
-
if (chatComponentsCache.current !== null && chatComponentsCache.current[message.name]) {
|
|
1036
|
-
const render = chatComponentsCache.current[message.name];
|
|
1034
|
+
if (chatComponentsCache.current !== null && chatComponentsCache.current.actions[message.name]) {
|
|
1035
|
+
const render = chatComponentsCache.current.actions[message.name];
|
|
1037
1036
|
if (typeof render === "string") {
|
|
1038
1037
|
if (isCurrentMessage && inProgress) {
|
|
1039
1038
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
|
|
@@ -1075,6 +1074,50 @@ var Messages = ({ messages, inProgress, children }) => {
|
|
|
1075
1074
|
} else {
|
|
1076
1075
|
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: context.icons.spinnerIcon }, index);
|
|
1077
1076
|
}
|
|
1077
|
+
} else if (message instanceof import_runtime_client_gql.AgentStateMessage) {
|
|
1078
|
+
let render;
|
|
1079
|
+
if (chatComponentsCache.current !== null) {
|
|
1080
|
+
render = chatComponentsCache.current.coagentActions[`${message.agentName}-${message.nodeName}`] || chatComponentsCache.current.coagentActions[`${message.agentName}-global`];
|
|
1081
|
+
}
|
|
1082
|
+
if (render) {
|
|
1083
|
+
if (typeof render === "string") {
|
|
1084
|
+
if (isCurrentMessage && inProgress) {
|
|
1085
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
|
|
1086
|
+
context.icons.spinnerIcon,
|
|
1087
|
+
" ",
|
|
1088
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "inProgressLabel", children: render })
|
|
1089
|
+
] }, index);
|
|
1090
|
+
} else {
|
|
1091
|
+
return null;
|
|
1092
|
+
}
|
|
1093
|
+
} else {
|
|
1094
|
+
const state = message.state;
|
|
1095
|
+
let status = message.active ? "inProgress" : "complete";
|
|
1096
|
+
const toRender = render({
|
|
1097
|
+
status,
|
|
1098
|
+
state,
|
|
1099
|
+
nodeName: message.nodeName
|
|
1100
|
+
});
|
|
1101
|
+
if (!toRender && status === "complete") {
|
|
1102
|
+
return null;
|
|
1103
|
+
}
|
|
1104
|
+
if (typeof toRender === "string") {
|
|
1105
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: [
|
|
1106
|
+
isCurrentMessage && inProgress && context.icons.spinnerIcon,
|
|
1107
|
+
" ",
|
|
1108
|
+
toRender
|
|
1109
|
+
] }, index);
|
|
1110
|
+
} else {
|
|
1111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "copilotKitCustomAssistantMessage", children: toRender }, index);
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
} else if (!inProgress || !isCurrentMessage) {
|
|
1115
|
+
return null;
|
|
1116
|
+
} else {
|
|
1117
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: context.icons.spinnerIcon }, index);
|
|
1118
|
+
}
|
|
1119
|
+
} else if (message instanceof import_runtime_client_gql.ResultMessage && inProgress && isCurrentMessage) {
|
|
1120
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `copilotKitMessage copilotKitAssistantMessage`, children: context.icons.spinnerIcon }, index);
|
|
1078
1121
|
}
|
|
1079
1122
|
}),
|
|
1080
1123
|
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("footer", { ref: messagesEndRef, children })
|
|
@@ -1425,11 +1468,13 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
1425
1468
|
// src/components/chat/Chat.tsx
|
|
1426
1469
|
var import_react11 = __toESM(require("react"));
|
|
1427
1470
|
var import_react_core7 = require("@copilotkit/react-core");
|
|
1428
|
-
var
|
|
1471
|
+
var import_runtime_client_gql6 = require("@copilotkit/runtime-client-gql");
|
|
1429
1472
|
var import_shared3 = require("@copilotkit/shared");
|
|
1430
1473
|
|
|
1431
1474
|
// src/components/dev-console/utils.ts
|
|
1432
1475
|
var import_react_core5 = require("@copilotkit/react-core");
|
|
1476
|
+
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
1477
|
+
var import_runtime_client_gql5 = require("@copilotkit/runtime-client-gql");
|
|
1433
1478
|
function shouldShowDevConsole(showDevConsole) {
|
|
1434
1479
|
if (typeof showDevConsole === "boolean") {
|
|
1435
1480
|
return showDevConsole;
|
|
@@ -1490,6 +1535,7 @@ function getPublishedCopilotKitVersion(current, forceCheck = false) {
|
|
|
1490
1535
|
});
|
|
1491
1536
|
}
|
|
1492
1537
|
function logReadables(context) {
|
|
1538
|
+
console.log("%cCurrent Readables:", "font-size: 16px; font-weight: bold;");
|
|
1493
1539
|
const readables = context.getContextString([], import_react_core5.defaultCopilotContextCategories).trim();
|
|
1494
1540
|
if (readables.length === 0) {
|
|
1495
1541
|
console.log("No readables found");
|
|
@@ -1498,6 +1544,7 @@ function logReadables(context) {
|
|
|
1498
1544
|
console.log(readables);
|
|
1499
1545
|
}
|
|
1500
1546
|
function logActions(context) {
|
|
1547
|
+
console.log("%cCurrent Actions:", "font-size: 16px; font-weight: bold;");
|
|
1501
1548
|
if (Object.values(context.actions).length === 0) {
|
|
1502
1549
|
console.log("No actions found");
|
|
1503
1550
|
return;
|
|
@@ -1510,6 +1557,53 @@ function logActions(context) {
|
|
|
1510
1557
|
console.groupEnd();
|
|
1511
1558
|
}
|
|
1512
1559
|
}
|
|
1560
|
+
function logMessages(context) {
|
|
1561
|
+
console.log("%cCurrent Messages:", "font-size: 16px; font-weight: bold;");
|
|
1562
|
+
if (context.messages.length === 0) {
|
|
1563
|
+
console.log("No messages found");
|
|
1564
|
+
return;
|
|
1565
|
+
}
|
|
1566
|
+
const tableData = context.messages.map((message) => {
|
|
1567
|
+
if (message instanceof import_runtime_client_gql4.TextMessage) {
|
|
1568
|
+
return {
|
|
1569
|
+
id: message.id,
|
|
1570
|
+
type: "TextMessage",
|
|
1571
|
+
role: message.role,
|
|
1572
|
+
name: void 0,
|
|
1573
|
+
scope: void 0,
|
|
1574
|
+
content: message.content
|
|
1575
|
+
};
|
|
1576
|
+
} else if (message instanceof import_runtime_client_gql4.ActionExecutionMessage) {
|
|
1577
|
+
return {
|
|
1578
|
+
id: message.id,
|
|
1579
|
+
type: "ActionExecutionMessage",
|
|
1580
|
+
role: void 0,
|
|
1581
|
+
name: message.name,
|
|
1582
|
+
scope: message.scope,
|
|
1583
|
+
content: message.arguments
|
|
1584
|
+
};
|
|
1585
|
+
} else if (message instanceof import_runtime_client_gql4.ResultMessage) {
|
|
1586
|
+
return {
|
|
1587
|
+
id: message.id,
|
|
1588
|
+
type: "ResultMessage",
|
|
1589
|
+
role: void 0,
|
|
1590
|
+
name: message.actionName,
|
|
1591
|
+
scope: message.actionExecutionId,
|
|
1592
|
+
content: message.result
|
|
1593
|
+
};
|
|
1594
|
+
} else if (message instanceof import_runtime_client_gql5.AgentStateMessage) {
|
|
1595
|
+
return {
|
|
1596
|
+
id: message.id,
|
|
1597
|
+
type: `AgentStateMessage (running: ${message.running})`,
|
|
1598
|
+
role: message.role,
|
|
1599
|
+
name: void 0,
|
|
1600
|
+
scope: message.threadId,
|
|
1601
|
+
content: message.state
|
|
1602
|
+
};
|
|
1603
|
+
}
|
|
1604
|
+
});
|
|
1605
|
+
console.table(tableData);
|
|
1606
|
+
}
|
|
1513
1607
|
|
|
1514
1608
|
// src/components/dev-console/console.tsx
|
|
1515
1609
|
var import_react_core6 = require("@copilotkit/react-core");
|
|
@@ -1784,6 +1878,7 @@ function DebugMenuButton({
|
|
|
1784
1878
|
children: [
|
|
1785
1879
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react10.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logReadables(context), children: "Log Readables" }) }),
|
|
1786
1880
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react10.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logActions(context), children: "Log Actions" }) }),
|
|
1881
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react10.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => logMessages(context), children: "Log Messages" }) }),
|
|
1787
1882
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react10.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => checkForUpdates(true), children: "Check for Updates" }) }),
|
|
1788
1883
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("hr", {}),
|
|
1789
1884
|
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react10.MenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { className: "copilotKitDebugMenuItem", onClick: () => setShowDevConsole(false), children: "Hide Dev Console" }) })
|
|
@@ -1902,9 +1997,9 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage) =>
|
|
|
1902
1997
|
const sendMessage = (messageContent) => __async(void 0, null, function* () {
|
|
1903
1998
|
abortSuggestions();
|
|
1904
1999
|
setCurrentSuggestions([]);
|
|
1905
|
-
const message = new
|
|
2000
|
+
const message = new import_runtime_client_gql6.TextMessage({
|
|
1906
2001
|
content: messageContent,
|
|
1907
|
-
role:
|
|
2002
|
+
role: import_runtime_client_gql6.Role.User
|
|
1908
2003
|
});
|
|
1909
2004
|
appendMessage(message);
|
|
1910
2005
|
if (onSubmitMessage) {
|
|
@@ -1952,23 +2047,22 @@ var CopilotModal = ({
|
|
|
1952
2047
|
}) => {
|
|
1953
2048
|
const [openState, setOpenState] = import_react12.default.useState(defaultOpen);
|
|
1954
2049
|
const setOpen = (open) => {
|
|
2050
|
+
console.log("setOpen!!", open);
|
|
1955
2051
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
1956
2052
|
setOpenState(open);
|
|
1957
2053
|
};
|
|
1958
|
-
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen
|
|
2054
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(ChatContextProvider, { icons, labels, open: openState, setOpen, children: [
|
|
1959
2055
|
children,
|
|
1960
2056
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className, children: [
|
|
1961
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button2, {
|
|
2057
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Button2, {}),
|
|
1962
2058
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1963
2059
|
Window2,
|
|
1964
2060
|
{
|
|
1965
|
-
open: openState,
|
|
1966
|
-
setOpen,
|
|
1967
2061
|
clickOutsideToClose,
|
|
1968
2062
|
shortcut,
|
|
1969
2063
|
hitEscapeToClose,
|
|
1970
2064
|
children: [
|
|
1971
|
-
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Header2, {
|
|
2065
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Header2, {}),
|
|
1972
2066
|
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
1973
2067
|
CopilotChat,
|
|
1974
2068
|
{
|
|
@@ -2010,6 +2104,7 @@ function CopilotSidebar(props) {
|
|
|
2010
2104
|
);
|
|
2011
2105
|
const onSetOpen = (open) => {
|
|
2012
2106
|
var _a;
|
|
2107
|
+
console.log("onSetOpen", open);
|
|
2013
2108
|
(_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
|
|
2014
2109
|
setExpandedClassName(open ? "sidebarExpanded" : "");
|
|
2015
2110
|
};
|