@copilotkit/react-ui 1.6.0-next.8 → 1.6.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.
Files changed (33) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/{chunk-FUFTTTA3.mjs → chunk-2C3ANQCY.mjs} +14 -4
  3. package/dist/chunk-2C3ANQCY.mjs.map +1 -0
  4. package/dist/{chunk-CU525PBJ.mjs → chunk-3PJA5MFR.mjs} +2 -2
  5. package/dist/{chunk-UGTFROVP.mjs → chunk-ADTTDBLB.mjs} +2 -2
  6. package/dist/{chunk-UY34ERRQ.mjs → chunk-AZU4QOV5.mjs} +2 -2
  7. package/dist/components/chat/Chat.js +13 -3
  8. package/dist/components/chat/Chat.js.map +1 -1
  9. package/dist/components/chat/Chat.mjs +1 -1
  10. package/dist/components/chat/Modal.js +13 -3
  11. package/dist/components/chat/Modal.js.map +1 -1
  12. package/dist/components/chat/Modal.mjs +2 -2
  13. package/dist/components/chat/Popup.js +13 -3
  14. package/dist/components/chat/Popup.js.map +1 -1
  15. package/dist/components/chat/Popup.mjs +3 -3
  16. package/dist/components/chat/Sidebar.js +13 -3
  17. package/dist/components/chat/Sidebar.js.map +1 -1
  18. package/dist/components/chat/Sidebar.mjs +3 -3
  19. package/dist/components/chat/index.js +13 -3
  20. package/dist/components/chat/index.js.map +1 -1
  21. package/dist/components/chat/index.mjs +4 -4
  22. package/dist/components/index.js +13 -3
  23. package/dist/components/index.js.map +1 -1
  24. package/dist/components/index.mjs +4 -4
  25. package/dist/index.js +13 -3
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +4 -4
  28. package/package.json +4 -4
  29. package/src/components/chat/Chat.tsx +24 -4
  30. package/dist/chunk-FUFTTTA3.mjs.map +0 -1
  31. /package/dist/{chunk-CU525PBJ.mjs.map → chunk-3PJA5MFR.mjs.map} +0 -0
  32. /package/dist/{chunk-UGTFROVP.mjs.map → chunk-ADTTDBLB.mjs.map} +0 -0
  33. /package/dist/{chunk-UY34ERRQ.mjs.map → chunk-AZU4QOV5.mjs.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,46 @@
1
1
  # ui
2
2
 
3
+ ## 1.6.0
4
+
5
+ ### Patch Changes
6
+
7
+ - c1cc77f: - feat: new useCopilotAdditionalInstructions hook and available property on useCopilotReadable
8
+ - Updated dependencies [d833f4c]
9
+ - Updated dependencies [090203d]
10
+ - Updated dependencies [d800f03]
11
+ - Updated dependencies [85753b3]
12
+ - Updated dependencies [7d061d9]
13
+ - Updated dependencies [b454827]
14
+ - Updated dependencies [c1cc77f]
15
+ - @copilotkit/react-core@1.6.0
16
+ - @copilotkit/runtime-client-gql@1.6.0
17
+ - @copilotkit/shared@1.6.0
18
+
19
+ ## 1.6.0-next.11
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies [85753b3]
24
+ - @copilotkit/react-core@1.6.0-next.11
25
+ - @copilotkit/runtime-client-gql@1.6.0-next.11
26
+ - @copilotkit/shared@1.6.0-next.11
27
+
28
+ ## 1.6.0-next.10
29
+
30
+ ### Patch Changes
31
+
32
+ - @copilotkit/runtime-client-gql@1.6.0-next.10
33
+ - @copilotkit/react-core@1.6.0-next.10
34
+ - @copilotkit/shared@1.6.0-next.10
35
+
36
+ ## 1.6.0-next.9
37
+
38
+ ### Patch Changes
39
+
40
+ - @copilotkit/runtime-client-gql@1.6.0-next.9
41
+ - @copilotkit/react-core@1.6.0-next.9
42
+ - @copilotkit/shared@1.6.0-next.9
43
+
3
44
  ## 1.6.0-next.8
4
45
 
5
46
  ### Patch Changes
@@ -74,10 +74,20 @@ function CopilotChat({
74
74
  AssistantMessage: AssistantMessage2 = AssistantMessage,
75
75
  UserMessage: UserMessage2 = UserMessage
76
76
  }) {
77
- const context = useCopilotContext();
77
+ const { additionalInstructions, setChatInstructions } = useCopilotContext();
78
78
  useEffect(() => {
79
- context.setChatInstructions(instructions || "");
80
- }, [instructions]);
79
+ if (!(additionalInstructions == null ? void 0 : additionalInstructions.length)) {
80
+ setChatInstructions(instructions || "");
81
+ return;
82
+ }
83
+ const combinedAdditionalInstructions = [
84
+ instructions,
85
+ "Additionally, follow these instructions:",
86
+ ...additionalInstructions.map((instruction) => `- ${instruction}`)
87
+ ];
88
+ console.log("combinedAdditionalInstructions", combinedAdditionalInstructions);
89
+ setChatInstructions(combinedAdditionalInstructions.join("\n") || "");
90
+ }, [instructions, additionalInstructions]);
81
91
  const {
82
92
  visibleMessages,
83
93
  isLoading,
@@ -311,4 +321,4 @@ export {
311
321
  WrappedCopilotChat,
312
322
  useCopilotChatLogic
313
323
  };
314
- //# sourceMappingURL=chunk-FUFTTTA3.mjs.map
324
+ //# sourceMappingURL=chunk-2C3ANQCY.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 { AssistantMessage as DefaultAssistantMessage } from \"./messages/AssistantMessage\";\nimport { UserMessage as DefaultUserMessage } from \"./messages/UserMessage\";\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 { randomId } from \"@copilotkit/shared\";\nimport {\n AssistantMessageProps,\n InputProps,\n MessagesProps,\n RenderMessageProps,\n ResponseButtonProps,\n UserMessageProps,\n} from \"./props\";\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 assistant message component to use instead of the default.\n */\n AssistantMessage?: React.ComponentType<AssistantMessageProps>;\n\n /**\n * A custom user message component to use instead of the default.\n */\n UserMessage?: React.ComponentType<UserMessageProps>;\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 AssistantMessage = DefaultAssistantMessage,\n UserMessage = DefaultUserMessage,\n}: CopilotChatProps) {\n const { additionalInstructions, setChatInstructions } = useCopilotContext();\n\n useEffect(() => {\n if (!additionalInstructions?.length) {\n setChatInstructions(instructions || \"\");\n return;\n }\n\n /*\n Will result in a prompt like:\n\n You are a helpful assistant. \n Additionally, follow these instructions:\n - Do not answer questions about the weather.\n - Do not answer questions about the stock market.\"\n */\n const combinedAdditionalInstructions = [\n instructions,\n \"Additionally, follow these instructions:\",\n ...additionalInstructions.map((instruction) => `- ${instruction}`),\n ];\n\n console.log(\"combinedAdditionalInstructions\", combinedAdditionalInstructions);\n\n setChatInstructions(combinedAdditionalInstructions.join(\"\\n\") || \"\");\n }, [instructions, additionalInstructions]);\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 AssistantMessage={AssistantMessage}\n UserMessage={UserMessage}\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 runChatCompletion,\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(\n generalContext.agentSession.agentName,\n context,\n appendMessage,\n runChatCompletion,\n hint,\n );\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,OAAO,SAAS,WAAW,QAAQ,gBAAgB;AACnD;AAAA,EAEE;AAAA,EACA;AAAA,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,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","AssistantMessage","UserMessage","_a"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-UY34ERRQ.mjs";
3
+ } from "./chunk-AZU4QOV5.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-CU525PBJ.mjs.map
30
+ //# sourceMappingURL=chunk-3PJA5MFR.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotModal
3
- } from "./chunk-UY34ERRQ.mjs";
3
+ } from "./chunk-AZU4QOV5.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-UGTFROVP.mjs.map
21
+ //# sourceMappingURL=chunk-ADTTDBLB.mjs.map
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-RQNJNK2W.mjs";
10
10
  import {
11
11
  CopilotChat
12
- } from "./chunk-FUFTTTA3.mjs";
12
+ } from "./chunk-2C3ANQCY.mjs";
13
13
  import {
14
14
  UserMessage
15
15
  } from "./chunk-HEIDCT7I.mjs";
@@ -102,4 +102,4 @@ var CopilotModal = ({
102
102
  export {
103
103
  CopilotModal
104
104
  };
105
- //# sourceMappingURL=chunk-UY34ERRQ.mjs.map
105
+ //# sourceMappingURL=chunk-AZU4QOV5.mjs.map
@@ -2310,10 +2310,20 @@ function CopilotChat({
2310
2310
  AssistantMessage: AssistantMessage2 = AssistantMessage,
2311
2311
  UserMessage: UserMessage2 = UserMessage
2312
2312
  }) {
2313
- const context = (0, import_react_core9.useCopilotContext)();
2313
+ const { additionalInstructions, setChatInstructions } = (0, import_react_core9.useCopilotContext)();
2314
2314
  (0, import_react11.useEffect)(() => {
2315
- context.setChatInstructions(instructions || "");
2316
- }, [instructions]);
2315
+ if (!(additionalInstructions == null ? void 0 : additionalInstructions.length)) {
2316
+ setChatInstructions(instructions || "");
2317
+ return;
2318
+ }
2319
+ const combinedAdditionalInstructions = [
2320
+ instructions,
2321
+ "Additionally, follow these instructions:",
2322
+ ...additionalInstructions.map((instruction) => `- ${instruction}`)
2323
+ ];
2324
+ console.log("combinedAdditionalInstructions", combinedAdditionalInstructions);
2325
+ setChatInstructions(combinedAdditionalInstructions.join("\n") || "");
2326
+ }, [instructions, additionalInstructions]);
2317
2327
  const {
2318
2328
  visibleMessages,
2319
2329
  isLoading,