@copilotkit/react-ui 1.10.5-next.9 → 1.10.6-next.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 +34 -0
- package/dist/{chunk-QPONDGDJ.mjs → chunk-5HQD6ZPA.mjs} +2 -2
- package/dist/{chunk-DSNTTAJX.mjs → chunk-7HAFY2YK.mjs} +3 -3
- package/dist/{chunk-CGEAG65D.mjs → chunk-ELGRNEAO.mjs} +7 -2
- package/dist/chunk-ELGRNEAO.mjs.map +1 -0
- package/dist/{chunk-K2FLPUR5.mjs → chunk-G7VB7A4O.mjs} +2 -2
- package/dist/{chunk-SDQTGCT2.mjs → chunk-SNGWNZNH.mjs} +2 -2
- package/dist/{chunk-DTRPPNSA.mjs → chunk-ZJCHKHE4.mjs} +2 -2
- package/dist/components/chat/Chat.js +36 -29
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +3 -3
- package/dist/components/chat/Input.js +14 -7
- package/dist/components/chat/Input.js.map +1 -1
- package/dist/components/chat/Input.mjs +2 -2
- package/dist/components/chat/Modal.js +43 -36
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +4 -4
- package/dist/components/chat/Popup.js +43 -36
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +5 -5
- package/dist/components/chat/PoweredByTag.js +6 -1
- package/dist/components/chat/PoweredByTag.js.map +1 -1
- package/dist/components/chat/PoweredByTag.mjs +1 -1
- package/dist/components/chat/Sidebar.js +45 -38
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +5 -5
- package/dist/components/chat/index.js +45 -38
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +6 -6
- package/dist/components/index.js +45 -38
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +6 -6
- package/dist/index.js +47 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +11 -11
- package/package.json +4 -4
- package/src/components/chat/PoweredByTag.tsx +15 -2
- package/dist/chunk-CGEAG65D.mjs.map +0 -1
- /package/dist/{chunk-QPONDGDJ.mjs.map → chunk-5HQD6ZPA.mjs.map} +0 -0
- /package/dist/{chunk-DSNTTAJX.mjs.map → chunk-7HAFY2YK.mjs.map} +0 -0
- /package/dist/{chunk-K2FLPUR5.mjs.map → chunk-G7VB7A4O.mjs.map} +0 -0
- /package/dist/{chunk-SDQTGCT2.mjs.map → chunk-SNGWNZNH.mjs.map} +0 -0
- /package/dist/{chunk-DTRPPNSA.mjs.map → chunk-ZJCHKHE4.mjs.map} +0 -0
|
@@ -2,12 +2,12 @@ import "../chunk-MMVDU6DF.mjs";
|
|
|
2
2
|
import "../chunk-SC6JRFAJ.mjs";
|
|
3
3
|
import {
|
|
4
4
|
CopilotSidebar
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-SNGWNZNH.mjs";
|
|
6
6
|
import "../chunk-WB3YULQ4.mjs";
|
|
7
7
|
import {
|
|
8
8
|
CopilotPopup
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-5HQD6ZPA.mjs";
|
|
10
|
+
import "../chunk-7HAFY2YK.mjs";
|
|
11
11
|
import "../chunk-C3GSYRC3.mjs";
|
|
12
12
|
import "../chunk-GDSZGYCE.mjs";
|
|
13
13
|
import "../chunk-V7W6IM2V.mjs";
|
|
@@ -24,7 +24,7 @@ import "../chunk-BH6PCAAL.mjs";
|
|
|
24
24
|
import "../chunk-UFN2VWSR.mjs";
|
|
25
25
|
import {
|
|
26
26
|
CopilotChat
|
|
27
|
-
} from "../chunk-
|
|
27
|
+
} from "../chunk-G7VB7A4O.mjs";
|
|
28
28
|
import {
|
|
29
29
|
Suggestions
|
|
30
30
|
} from "../chunk-226ZMOE3.mjs";
|
|
@@ -32,8 +32,8 @@ import {
|
|
|
32
32
|
Suggestion
|
|
33
33
|
} from "../chunk-W26XFBEG.mjs";
|
|
34
34
|
import "../chunk-PLHTVHUW.mjs";
|
|
35
|
-
import "../chunk-
|
|
36
|
-
import "../chunk-
|
|
35
|
+
import "../chunk-ZJCHKHE4.mjs";
|
|
36
|
+
import "../chunk-ELGRNEAO.mjs";
|
|
37
37
|
import "../chunk-QIOJXTIQ.mjs";
|
|
38
38
|
import "../chunk-W7ONZTSW.mjs";
|
|
39
39
|
import "../chunk-2LIO4Z3E.mjs";
|
package/dist/index.js
CHANGED
|
@@ -97,7 +97,7 @@ __export(src_exports, {
|
|
|
97
97
|
module.exports = __toCommonJS(src_exports);
|
|
98
98
|
|
|
99
99
|
// src/components/chat/Modal.tsx
|
|
100
|
-
var
|
|
100
|
+
var import_react16 = __toESM(require("react"));
|
|
101
101
|
|
|
102
102
|
// src/components/chat/ChatContext.tsx
|
|
103
103
|
var import_react = __toESM(require("react"));
|
|
@@ -2049,7 +2049,7 @@ function useScrollToBottom(messages) {
|
|
|
2049
2049
|
}
|
|
2050
2050
|
|
|
2051
2051
|
// src/components/chat/Input.tsx
|
|
2052
|
-
var
|
|
2052
|
+
var import_react14 = require("react");
|
|
2053
2053
|
|
|
2054
2054
|
// src/components/chat/Textarea.tsx
|
|
2055
2055
|
var import_react11 = require("react");
|
|
@@ -2218,6 +2218,9 @@ var usePushToTalk = ({
|
|
|
2218
2218
|
// src/components/chat/Input.tsx
|
|
2219
2219
|
var import_react_core7 = require("@copilotkit/react-core");
|
|
2220
2220
|
|
|
2221
|
+
// src/components/chat/PoweredByTag.tsx
|
|
2222
|
+
var import_react13 = require("react");
|
|
2223
|
+
|
|
2221
2224
|
// src/hooks/use-dark-mode.ts
|
|
2222
2225
|
var useDarkMode = () => {
|
|
2223
2226
|
if (typeof window === "undefined")
|
|
@@ -2228,7 +2231,11 @@ var useDarkMode = () => {
|
|
|
2228
2231
|
// src/components/chat/PoweredByTag.tsx
|
|
2229
2232
|
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2230
2233
|
function PoweredByTag({ showPoweredBy = true }) {
|
|
2234
|
+
const [mounted, setMounted] = (0, import_react13.useState)(false);
|
|
2231
2235
|
const isDark = useDarkMode();
|
|
2236
|
+
(0, import_react13.useEffect)(() => {
|
|
2237
|
+
setMounted(true);
|
|
2238
|
+
}, []);
|
|
2232
2239
|
if (!showPoweredBy) {
|
|
2233
2240
|
return null;
|
|
2234
2241
|
}
|
|
@@ -2239,7 +2246,7 @@ function PoweredByTag({ showPoweredBy = true }) {
|
|
|
2239
2246
|
textAlign: "center",
|
|
2240
2247
|
fontSize: "12px",
|
|
2241
2248
|
padding: "3px 0",
|
|
2242
|
-
color: isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
2249
|
+
color: mounted && isDark ? "rgb(69, 69, 69)" : "rgb(214, 214, 214)"
|
|
2243
2250
|
};
|
|
2244
2251
|
return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "poweredBy", style: poweredByStyle, children: "Powered by CopilotKit" }) });
|
|
2245
2252
|
}
|
|
@@ -2260,8 +2267,8 @@ var Input = ({
|
|
|
2260
2267
|
const copilotContext = (0, import_react_core7.useCopilotContext)();
|
|
2261
2268
|
const showPoweredBy = !((_a = copilotContext.copilotApiConfig) == null ? void 0 : _a.publicApiKey);
|
|
2262
2269
|
const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
|
|
2263
|
-
const textareaRef = (0,
|
|
2264
|
-
const [isComposing, setIsComposing] = (0,
|
|
2270
|
+
const textareaRef = (0, import_react14.useRef)(null);
|
|
2271
|
+
const [isComposing, setIsComposing] = (0, import_react14.useState)(false);
|
|
2265
2272
|
const handleDivClick = (event) => {
|
|
2266
2273
|
var _a2;
|
|
2267
2274
|
const target = event.target;
|
|
@@ -2271,7 +2278,7 @@ var Input = ({
|
|
|
2271
2278
|
return;
|
|
2272
2279
|
(_a2 = textareaRef.current) == null ? void 0 : _a2.focus();
|
|
2273
2280
|
};
|
|
2274
|
-
const [text, setText] = (0,
|
|
2281
|
+
const [text, setText] = (0, import_react14.useState)("");
|
|
2275
2282
|
const send = () => {
|
|
2276
2283
|
var _a2;
|
|
2277
2284
|
if (inProgress)
|
|
@@ -2287,13 +2294,13 @@ var Input = ({
|
|
|
2287
2294
|
const isInProgress = inProgress || pushToTalkState === "transcribing";
|
|
2288
2295
|
const buttonIcon = isInProgress && !hideStopButton ? context.icons.stopIcon : context.icons.sendIcon;
|
|
2289
2296
|
const showPushToTalk = pushToTalkConfigured && (pushToTalkState === "idle" || pushToTalkState === "recording") && !inProgress;
|
|
2290
|
-
const canSend = (0,
|
|
2297
|
+
const canSend = (0, import_react14.useMemo)(() => {
|
|
2291
2298
|
var _a2;
|
|
2292
2299
|
const interruptEvent = (_a2 = copilotContext.langGraphInterruptAction) == null ? void 0 : _a2.event;
|
|
2293
2300
|
const interruptInProgress = (interruptEvent == null ? void 0 : interruptEvent.name) === "LangGraphInterruptEvent" && !(interruptEvent == null ? void 0 : interruptEvent.response);
|
|
2294
2301
|
return !isInProgress && text.trim().length > 0 && pushToTalkState === "idle" && !interruptInProgress;
|
|
2295
2302
|
}, [(_b = copilotContext.langGraphInterruptAction) == null ? void 0 : _b.event, isInProgress, text, pushToTalkState]);
|
|
2296
|
-
const canStop = (0,
|
|
2303
|
+
const canStop = (0, import_react14.useMemo)(() => {
|
|
2297
2304
|
return isInProgress && !hideStopButton;
|
|
2298
2305
|
}, [isInProgress, hideStopButton]);
|
|
2299
2306
|
const sendDisabled = !canSend && !canStop;
|
|
@@ -2349,7 +2356,7 @@ var Input = ({
|
|
|
2349
2356
|
};
|
|
2350
2357
|
|
|
2351
2358
|
// src/components/chat/Chat.tsx
|
|
2352
|
-
var
|
|
2359
|
+
var import_react15 = __toESM(require("react"));
|
|
2353
2360
|
var import_react_core9 = require("@copilotkit/react-core");
|
|
2354
2361
|
var import_shared3 = require("@copilotkit/shared");
|
|
2355
2362
|
var import_shared4 = require("@copilotkit/shared");
|
|
@@ -2520,10 +2527,10 @@ function CopilotChat({
|
|
|
2520
2527
|
removeInternalErrorHandler
|
|
2521
2528
|
} = (0, import_react_core9.useCopilotContext)();
|
|
2522
2529
|
const { publicApiKey, chatApiEndpoint } = copilotApiConfig;
|
|
2523
|
-
const [selectedImages, setSelectedImages] = (0,
|
|
2524
|
-
const [chatError, setChatError] = (0,
|
|
2525
|
-
const fileInputRef = (0,
|
|
2526
|
-
const triggerObservabilityHook = (0,
|
|
2530
|
+
const [selectedImages, setSelectedImages] = (0, import_react15.useState)([]);
|
|
2531
|
+
const [chatError, setChatError] = (0, import_react15.useState)(null);
|
|
2532
|
+
const fileInputRef = (0, import_react15.useRef)(null);
|
|
2533
|
+
const triggerObservabilityHook = (0, import_react15.useCallback)(
|
|
2527
2534
|
(hookName, ...args) => {
|
|
2528
2535
|
if (publicApiKey && (observabilityHooks == null ? void 0 : observabilityHooks[hookName])) {
|
|
2529
2536
|
observabilityHooks[hookName](...args);
|
|
@@ -2542,7 +2549,7 @@ function CopilotChat({
|
|
|
2542
2549
|
},
|
|
2543
2550
|
[publicApiKey, observabilityHooks, setBannerError]
|
|
2544
2551
|
);
|
|
2545
|
-
const triggerChatError = (0,
|
|
2552
|
+
const triggerChatError = (0, import_react15.useCallback)(
|
|
2546
2553
|
(error, operation, originalError) => {
|
|
2547
2554
|
const errorMessage = (error == null ? void 0 : error.message) || (error == null ? void 0 : error.toString()) || "An error occurred";
|
|
2548
2555
|
setChatError({
|
|
@@ -2588,7 +2595,7 @@ function CopilotChat({
|
|
|
2588
2595
|
},
|
|
2589
2596
|
[publicApiKey, chatApiEndpoint, observabilityHooks, setBannerError]
|
|
2590
2597
|
);
|
|
2591
|
-
(0,
|
|
2598
|
+
(0, import_react15.useEffect)(() => {
|
|
2592
2599
|
const id = "chat-component";
|
|
2593
2600
|
setInternalErrorHandler({
|
|
2594
2601
|
[id]: (error) => {
|
|
@@ -2601,7 +2608,7 @@ function CopilotChat({
|
|
|
2601
2608
|
removeInternalErrorHandler == null ? void 0 : removeInternalErrorHandler(id);
|
|
2602
2609
|
};
|
|
2603
2610
|
}, [triggerChatError, setInternalErrorHandler, removeInternalErrorHandler]);
|
|
2604
|
-
(0,
|
|
2611
|
+
(0, import_react15.useEffect)(() => {
|
|
2605
2612
|
if (!imageUploadsEnabled)
|
|
2606
2613
|
return;
|
|
2607
2614
|
const handlePaste = (e) => __async(this, null, function* () {
|
|
@@ -2647,7 +2654,7 @@ function CopilotChat({
|
|
|
2647
2654
|
document.addEventListener("paste", handlePaste);
|
|
2648
2655
|
return () => document.removeEventListener("paste", handlePaste);
|
|
2649
2656
|
}, [imageUploadsEnabled, triggerChatError]);
|
|
2650
|
-
(0,
|
|
2657
|
+
(0, import_react15.useEffect)(() => {
|
|
2651
2658
|
if (!(additionalInstructions == null ? void 0 : additionalInstructions.length)) {
|
|
2652
2659
|
setChatInstructions(instructions || "");
|
|
2653
2660
|
return;
|
|
@@ -2675,8 +2682,8 @@ function CopilotChat({
|
|
|
2675
2682
|
onStopGeneration,
|
|
2676
2683
|
onReloadMessages
|
|
2677
2684
|
);
|
|
2678
|
-
const prevIsLoading = (0,
|
|
2679
|
-
(0,
|
|
2685
|
+
const prevIsLoading = (0, import_react15.useRef)(isLoading);
|
|
2686
|
+
(0, import_react15.useEffect)(() => {
|
|
2680
2687
|
if (prevIsLoading.current !== isLoading) {
|
|
2681
2688
|
if (isLoading) {
|
|
2682
2689
|
triggerObservabilityHook("onChatStarted");
|
|
@@ -2695,7 +2702,7 @@ function CopilotChat({
|
|
|
2695
2702
|
triggerObservabilityHook("onMessageSent", text);
|
|
2696
2703
|
return sendMessage(text, images);
|
|
2697
2704
|
};
|
|
2698
|
-
const chatContext =
|
|
2705
|
+
const chatContext = import_react15.default.useContext(ChatContext);
|
|
2699
2706
|
const isVisible = chatContext ? chatContext.open : true;
|
|
2700
2707
|
const handleRegenerate = (messageId) => {
|
|
2701
2708
|
if (onRegenerate) {
|
|
@@ -2830,7 +2837,7 @@ function WrappedCopilotChat({
|
|
|
2830
2837
|
labels,
|
|
2831
2838
|
className
|
|
2832
2839
|
}) {
|
|
2833
|
-
const chatContext =
|
|
2840
|
+
const chatContext = import_react15.default.useContext(ChatContext);
|
|
2834
2841
|
if (!chatContext) {
|
|
2835
2842
|
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(ChatContextProvider, { icons, labels, open: true, setOpen: () => {
|
|
2836
2843
|
}, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `copilotKitChat ${className != null ? className : ""}`, children }) });
|
|
@@ -2859,15 +2866,15 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
|
|
|
2859
2866
|
const generalContext = (0, import_react_core9.useCopilotContext)();
|
|
2860
2867
|
const messagesContext = (0, import_react_core9.useCopilotMessagesContext)();
|
|
2861
2868
|
const { actions } = generalContext;
|
|
2862
|
-
const [suggestionsFailed, setSuggestionsFailed] = (0,
|
|
2863
|
-
const hasGeneratedInitialSuggestions = (0,
|
|
2864
|
-
(0,
|
|
2869
|
+
const [suggestionsFailed, setSuggestionsFailed] = (0, import_react15.useState)(false);
|
|
2870
|
+
const hasGeneratedInitialSuggestions = (0, import_react15.useRef)(false);
|
|
2871
|
+
(0, import_react15.useEffect)(() => {
|
|
2865
2872
|
if (Array.isArray(chatSuggestions)) {
|
|
2866
2873
|
setSuggestions(chatSuggestions);
|
|
2867
2874
|
hasGeneratedInitialSuggestions.current = true;
|
|
2868
2875
|
}
|
|
2869
2876
|
}, [JSON.stringify(chatSuggestions), setSuggestions]);
|
|
2870
|
-
const generateSuggestionsWithErrorHandling = (0,
|
|
2877
|
+
const generateSuggestionsWithErrorHandling = (0, import_react15.useCallback)(
|
|
2871
2878
|
(context) => __async(void 0, null, function* () {
|
|
2872
2879
|
try {
|
|
2873
2880
|
yield generateSuggestions();
|
|
@@ -2878,7 +2885,7 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
|
|
|
2878
2885
|
}),
|
|
2879
2886
|
[generateSuggestions]
|
|
2880
2887
|
);
|
|
2881
|
-
(0,
|
|
2888
|
+
(0, import_react15.useEffect)(() => {
|
|
2882
2889
|
if (chatSuggestions !== "auto" || isLoadingSuggestions || suggestionsFailed) {
|
|
2883
2890
|
return;
|
|
2884
2891
|
}
|
|
@@ -2908,13 +2915,13 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
|
|
|
2908
2915
|
// Use stable string instead of object reference
|
|
2909
2916
|
generateSuggestionsWithErrorHandling
|
|
2910
2917
|
]);
|
|
2911
|
-
(0,
|
|
2918
|
+
(0, import_react15.useEffect)(() => {
|
|
2912
2919
|
if (chatSuggestions !== "auto") {
|
|
2913
2920
|
hasGeneratedInitialSuggestions.current = false;
|
|
2914
2921
|
setSuggestionsFailed(false);
|
|
2915
2922
|
}
|
|
2916
2923
|
}, [chatSuggestions]);
|
|
2917
|
-
const stableContext = (0,
|
|
2924
|
+
const stableContext = (0, import_react15.useMemo)(
|
|
2918
2925
|
() => __spreadValues(__spreadValues({}, generalContext), messagesContext),
|
|
2919
2926
|
[
|
|
2920
2927
|
// Only include stable dependencies
|
|
@@ -2923,12 +2930,12 @@ var useCopilotChatLogic = (chatSuggestions, makeSystemMessage, disableSystemMess
|
|
|
2923
2930
|
generalContext.isLoading
|
|
2924
2931
|
]
|
|
2925
2932
|
);
|
|
2926
|
-
const resetSuggestions = (0,
|
|
2933
|
+
const resetSuggestions = (0, import_react15.useCallback)(() => {
|
|
2927
2934
|
resetSuggestionsFromHook();
|
|
2928
2935
|
setSuggestionsFailed(false);
|
|
2929
2936
|
hasGeneratedInitialSuggestions.current = false;
|
|
2930
2937
|
}, [resetSuggestionsFromHook]);
|
|
2931
|
-
(0,
|
|
2938
|
+
(0, import_react15.useEffect)(() => {
|
|
2932
2939
|
onInProgress == null ? void 0 : onInProgress(isLoading);
|
|
2933
2940
|
}, [onInProgress, isLoading]);
|
|
2934
2941
|
const safelySendMessage = (messageContent, imagesToUse) => __async(void 0, null, function* () {
|
|
@@ -3101,7 +3108,7 @@ var CopilotModalInner = (_a) => {
|
|
|
3101
3108
|
]);
|
|
3102
3109
|
const { copilotApiConfig, setBannerError } = (0, import_react_core11.useCopilotContext)();
|
|
3103
3110
|
const { publicApiKey } = copilotApiConfig;
|
|
3104
|
-
const triggerObservabilityHook = (0,
|
|
3111
|
+
const triggerObservabilityHook = (0, import_react16.useCallback)(
|
|
3105
3112
|
(hookName, ...args) => {
|
|
3106
3113
|
if (publicApiKey && (observabilityHooks == null ? void 0 : observabilityHooks[hookName])) {
|
|
3107
3114
|
observabilityHooks[hookName](...args);
|
|
@@ -3121,8 +3128,8 @@ var CopilotModalInner = (_a) => {
|
|
|
3121
3128
|
[publicApiKey, observabilityHooks, setBannerError]
|
|
3122
3129
|
);
|
|
3123
3130
|
const { open } = useChatContext();
|
|
3124
|
-
const prevOpen = (0,
|
|
3125
|
-
(0,
|
|
3131
|
+
const prevOpen = (0, import_react16.useRef)(open);
|
|
3132
|
+
(0, import_react16.useEffect)(() => {
|
|
3126
3133
|
if (prevOpen.current !== open) {
|
|
3127
3134
|
onSetOpen == null ? void 0 : onSetOpen(open);
|
|
3128
3135
|
if (open) {
|
|
@@ -3133,8 +3140,8 @@ var CopilotModalInner = (_a) => {
|
|
|
3133
3140
|
prevOpen.current = open;
|
|
3134
3141
|
}
|
|
3135
3142
|
}, [open, onSetOpen, triggerObservabilityHook]);
|
|
3136
|
-
const memoizedHeader = (0,
|
|
3137
|
-
const memoizedChildren = (0,
|
|
3143
|
+
const memoizedHeader = (0, import_react16.useMemo)(() => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Header2, {}), [Header2]);
|
|
3144
|
+
const memoizedChildren = (0, import_react16.useMemo)(() => children, [children]);
|
|
3138
3145
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
|
|
3139
3146
|
memoizedChildren,
|
|
3140
3147
|
/* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className, children: [
|
|
@@ -3214,7 +3221,7 @@ var CopilotModal = (_a) => {
|
|
|
3214
3221
|
"children",
|
|
3215
3222
|
"observabilityHooks"
|
|
3216
3223
|
]);
|
|
3217
|
-
const [openState, setOpenState] =
|
|
3224
|
+
const [openState, setOpenState] = import_react16.default.useState(defaultOpen);
|
|
3218
3225
|
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ChatContextProvider, { icons, labels, open: openState, setOpen: setOpenState, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
3219
3226
|
CopilotModalInner,
|
|
3220
3227
|
__spreadProps(__spreadValues({
|
|
@@ -3258,13 +3265,13 @@ function CopilotPopup(props) {
|
|
|
3258
3265
|
}
|
|
3259
3266
|
|
|
3260
3267
|
// src/components/chat/Sidebar.tsx
|
|
3261
|
-
var
|
|
3268
|
+
var import_react17 = require("react");
|
|
3262
3269
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
3263
3270
|
function CopilotSidebar(props) {
|
|
3264
3271
|
props = __spreadProps(__spreadValues({}, props), {
|
|
3265
3272
|
className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
|
|
3266
3273
|
});
|
|
3267
|
-
const [expandedClassName, setExpandedClassName] = (0,
|
|
3274
|
+
const [expandedClassName, setExpandedClassName] = (0, import_react17.useState)(
|
|
3268
3275
|
props.defaultOpen ? "sidebarExpanded" : ""
|
|
3269
3276
|
);
|
|
3270
3277
|
const onSetOpen = (open) => {
|
|
@@ -3276,7 +3283,7 @@ function CopilotSidebar(props) {
|
|
|
3276
3283
|
}
|
|
3277
3284
|
|
|
3278
3285
|
// src/hooks/use-copilot-chat-suggestions.tsx
|
|
3279
|
-
var
|
|
3286
|
+
var import_react18 = require("react");
|
|
3280
3287
|
var import_react_core12 = require("@copilotkit/react-core");
|
|
3281
3288
|
var import_shared6 = require("@copilotkit/shared");
|
|
3282
3289
|
function useCopilotChatSuggestions({
|
|
@@ -3287,7 +3294,7 @@ function useCopilotChatSuggestions({
|
|
|
3287
3294
|
maxSuggestions = 3
|
|
3288
3295
|
}, dependencies = []) {
|
|
3289
3296
|
const context = (0, import_react_core12.useCopilotContext)();
|
|
3290
|
-
(0,
|
|
3297
|
+
(0, import_react18.useEffect)(() => {
|
|
3291
3298
|
if (available === "disabled")
|
|
3292
3299
|
return;
|
|
3293
3300
|
const id = (0, import_shared6.randomId)();
|