@copilotkit/react-ui 1.5.15-next.2 → 1.5.15-next.4
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 +20 -0
- package/dist/{chunk-34FREWVK.mjs → chunk-6FTRYYR5.mjs} +4 -1
- package/dist/chunk-6FTRYYR5.mjs.map +1 -0
- package/dist/{chunk-6ZBXFJHS.mjs → chunk-7D6TIVZ6.mjs} +3 -3
- package/dist/{chunk-I37TTM3T.mjs → chunk-NCM42YQL.mjs} +2 -2
- package/dist/{chunk-R5ZETDHL.mjs → chunk-PGXWPTAW.mjs} +2 -2
- package/dist/{chunk-HBUJWEWY.mjs → chunk-Q77YGF2I.mjs} +2 -2
- package/dist/components/chat/Chat.js +28 -25
- package/dist/components/chat/Chat.js.map +1 -1
- package/dist/components/chat/Chat.mjs +2 -2
- package/dist/components/chat/Messages.js +3 -0
- package/dist/components/chat/Messages.js.map +1 -1
- package/dist/components/chat/Messages.mjs +1 -1
- package/dist/components/chat/Modal.js +28 -25
- package/dist/components/chat/Modal.js.map +1 -1
- package/dist/components/chat/Modal.mjs +3 -3
- package/dist/components/chat/Popup.js +28 -25
- package/dist/components/chat/Popup.js.map +1 -1
- package/dist/components/chat/Popup.mjs +4 -4
- package/dist/components/chat/Sidebar.js +28 -25
- package/dist/components/chat/Sidebar.js.map +1 -1
- package/dist/components/chat/Sidebar.mjs +4 -4
- package/dist/components/chat/index.js +28 -25
- package/dist/components/chat/index.js.map +1 -1
- package/dist/components/chat/index.mjs +5 -5
- package/dist/components/index.js +28 -25
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +5 -5
- package/dist/index.js +30 -27
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +5 -5
- package/package.json +4 -4
- package/src/components/chat/Messages.tsx +6 -1
- package/dist/chunk-34FREWVK.mjs.map +0 -1
- /package/dist/{chunk-6ZBXFJHS.mjs.map → chunk-7D6TIVZ6.mjs.map} +0 -0
- /package/dist/{chunk-I37TTM3T.mjs.map → chunk-NCM42YQL.mjs.map} +0 -0
- /package/dist/{chunk-R5ZETDHL.mjs.map → chunk-PGXWPTAW.mjs.map} +0 -0
- /package/dist/{chunk-HBUJWEWY.mjs.map → chunk-Q77YGF2I.mjs.map} +0 -0
|
@@ -2,18 +2,18 @@ import "../chunk-MMVDU6DF.mjs";
|
|
|
2
2
|
import "../chunk-SQMEPWVT.mjs";
|
|
3
3
|
import {
|
|
4
4
|
CopilotSidebar
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-PGXWPTAW.mjs";
|
|
6
6
|
import "../chunk-WB3YULQ4.mjs";
|
|
7
7
|
import {
|
|
8
8
|
CopilotPopup
|
|
9
|
-
} from "../chunk-
|
|
10
|
-
import "../chunk-
|
|
9
|
+
} from "../chunk-NCM42YQL.mjs";
|
|
10
|
+
import "../chunk-7D6TIVZ6.mjs";
|
|
11
11
|
import "../chunk-YAGE7RCE.mjs";
|
|
12
12
|
import "../chunk-VEC45H6Q.mjs";
|
|
13
13
|
import "../chunk-RQNJNK2W.mjs";
|
|
14
14
|
import {
|
|
15
15
|
CopilotChat
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-Q77YGF2I.mjs";
|
|
17
17
|
import "../chunk-UWWMAJ7R.mjs";
|
|
18
18
|
import "../chunk-F7VWGY77.mjs";
|
|
19
19
|
import "../chunk-OFYI4UU4.mjs";
|
|
@@ -41,7 +41,7 @@ import "../chunk-YQFVRDNC.mjs";
|
|
|
41
41
|
import {
|
|
42
42
|
Markdown
|
|
43
43
|
} from "../chunk-YQ3D5IQV.mjs";
|
|
44
|
-
import "../chunk-
|
|
44
|
+
import "../chunk-6FTRYYR5.mjs";
|
|
45
45
|
import "../chunk-3XAXY2Z3.mjs";
|
|
46
46
|
import {
|
|
47
47
|
useChatContext
|
package/dist/index.js
CHANGED
|
@@ -538,6 +538,7 @@ var Header = ({}) => {
|
|
|
538
538
|
// src/components/chat/Messages.tsx
|
|
539
539
|
var import_react3 = require("react");
|
|
540
540
|
var import_runtime_client_gql = require("@copilotkit/runtime-client-gql");
|
|
541
|
+
var import_react_core = require("@copilotkit/react-core");
|
|
541
542
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
542
543
|
var Messages = ({
|
|
543
544
|
messages,
|
|
@@ -569,6 +570,7 @@ var Messages = ({
|
|
|
569
570
|
}
|
|
570
571
|
}
|
|
571
572
|
const { messagesEndRef, messagesContainerRef } = useScrollToBottom(messages);
|
|
573
|
+
const interrupt = (0, import_react_core.useLangGraphInterruptRender)();
|
|
572
574
|
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "copilotKitMessages", ref: messagesContainerRef, children: [
|
|
573
575
|
messages.map((message, index) => {
|
|
574
576
|
const isCurrentMessage = index === messages.length - 1;
|
|
@@ -627,6 +629,7 @@ var Messages = ({
|
|
|
627
629
|
);
|
|
628
630
|
}
|
|
629
631
|
}),
|
|
632
|
+
interrupt,
|
|
630
633
|
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)("footer", { ref: messagesEndRef, children })
|
|
631
634
|
] });
|
|
632
635
|
};
|
|
@@ -759,7 +762,7 @@ var AutoResizingTextarea = (0, import_react4.forwardRef)(
|
|
|
759
762
|
var Textarea_default = AutoResizingTextarea;
|
|
760
763
|
|
|
761
764
|
// src/hooks/use-push-to-talk.tsx
|
|
762
|
-
var
|
|
765
|
+
var import_react_core2 = require("@copilotkit/react-core");
|
|
763
766
|
var import_react5 = require("react");
|
|
764
767
|
var startRecording = (mediaStreamRef, mediaRecorderRef, audioContextRef, recordedChunks, onStop) => __async(void 0, null, function* () {
|
|
765
768
|
if (!mediaStreamRef.current || !audioContextRef.current) {
|
|
@@ -814,8 +817,8 @@ var usePushToTalk = ({
|
|
|
814
817
|
const audioContextRef = (0, import_react5.useRef)(null);
|
|
815
818
|
const mediaRecorderRef = (0, import_react5.useRef)(null);
|
|
816
819
|
const recordedChunks = (0, import_react5.useRef)([]);
|
|
817
|
-
const generalContext = (0,
|
|
818
|
-
const messagesContext = (0,
|
|
820
|
+
const generalContext = (0, import_react_core2.useCopilotContext)();
|
|
821
|
+
const messagesContext = (0, import_react_core2.useCopilotMessagesContext)();
|
|
819
822
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
820
823
|
const [startReadingFromMessageId, setStartReadingFromMessageId] = (0, import_react5.useState)(null);
|
|
821
824
|
(0, import_react5.useEffect)(() => {
|
|
@@ -863,11 +866,11 @@ var usePushToTalk = ({
|
|
|
863
866
|
};
|
|
864
867
|
|
|
865
868
|
// src/components/chat/Input.tsx
|
|
866
|
-
var
|
|
869
|
+
var import_react_core3 = require("@copilotkit/react-core");
|
|
867
870
|
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
868
871
|
var Input = ({ inProgress, onSend, isVisible = false }) => {
|
|
869
872
|
const context = useChatContext();
|
|
870
|
-
const copilotContext = (0,
|
|
873
|
+
const copilotContext = (0, import_react_core3.useCopilotContext)();
|
|
871
874
|
const pushToTalkConfigured = copilotContext.copilotApiConfig.textToSpeechUrl !== void 0 && copilotContext.copilotApiConfig.transcribeAudioUrl !== void 0;
|
|
872
875
|
const textareaRef = (0, import_react6.useRef)(null);
|
|
873
876
|
const handleDivClick = (event) => {
|
|
@@ -987,10 +990,10 @@ function RenderTextMessage(props) {
|
|
|
987
990
|
|
|
988
991
|
// src/components/chat/messages/RenderActionExecutionMessage.tsx
|
|
989
992
|
var import_runtime_client_gql2 = require("@copilotkit/runtime-client-gql");
|
|
990
|
-
var
|
|
993
|
+
var import_react_core4 = require("@copilotkit/react-core");
|
|
991
994
|
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
992
995
|
function RenderActionExecutionMessage(props) {
|
|
993
|
-
const { chatComponentsCache } = (0,
|
|
996
|
+
const { chatComponentsCache } = (0, import_react_core4.useCopilotContext)();
|
|
994
997
|
const { message, inProgress, index, isCurrentMessage, actionResult, AssistantMessage: AssistantMessage2 } = props;
|
|
995
998
|
if (message.isActionExecutionMessage()) {
|
|
996
999
|
if (chatComponentsCache.current !== null && (chatComponentsCache.current.actions[message.name] || chatComponentsCache.current.actions["*"])) {
|
|
@@ -1112,10 +1115,10 @@ function RenderResultMessage(props) {
|
|
|
1112
1115
|
}
|
|
1113
1116
|
|
|
1114
1117
|
// src/components/chat/messages/RenderAgentStateMessage.tsx
|
|
1115
|
-
var
|
|
1118
|
+
var import_react_core5 = require("@copilotkit/react-core");
|
|
1116
1119
|
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1117
1120
|
function RenderAgentStateMessage(props) {
|
|
1118
|
-
const { chatComponentsCache } = (0,
|
|
1121
|
+
const { chatComponentsCache } = (0, import_react_core5.useCopilotContext)();
|
|
1119
1122
|
const { message, inProgress, index, isCurrentMessage, AssistantMessage: AssistantMessage2 } = props;
|
|
1120
1123
|
if (message.isAgentStateMessage()) {
|
|
1121
1124
|
let render;
|
|
@@ -1696,7 +1699,7 @@ var UserMessage = (props) => {
|
|
|
1696
1699
|
};
|
|
1697
1700
|
|
|
1698
1701
|
// src/components/chat/Suggestion.tsx
|
|
1699
|
-
var
|
|
1702
|
+
var import_react_core6 = require("@copilotkit/react-core");
|
|
1700
1703
|
var import_shared = require("@copilotkit/shared");
|
|
1701
1704
|
var import_runtime_client_gql3 = require("@copilotkit/runtime-client-gql");
|
|
1702
1705
|
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
@@ -1731,7 +1734,7 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
1731
1734
|
for (const config of Object.values(chatSuggestionConfiguration)) {
|
|
1732
1735
|
try {
|
|
1733
1736
|
const numOfSuggestionsInstructions = config.minSuggestions === 0 ? `Produce up to ${config.maxSuggestions} suggestions. If there are no highly relevant suggestions you can think of, provide an empty array.` : `Produce between ${config.minSuggestions} and ${config.maxSuggestions} suggestions.`;
|
|
1734
|
-
const result = yield (0,
|
|
1737
|
+
const result = yield (0, import_react_core6.extract)({
|
|
1735
1738
|
context,
|
|
1736
1739
|
instructions: "Suggest what the user could say next. Provide clear, highly relevant suggestions. Do not literally suggest function calls. ",
|
|
1737
1740
|
data: config.instructions + "\n\n" + numOfSuggestionsInstructions + "\n\nAvailable tools: " + tools + "\n\n",
|
|
@@ -1790,12 +1793,12 @@ var reloadSuggestions = (context, chatSuggestionConfiguration, setCurrentSuggest
|
|
|
1790
1793
|
|
|
1791
1794
|
// src/components/chat/Chat.tsx
|
|
1792
1795
|
var import_react12 = __toESM(require("react"));
|
|
1793
|
-
var
|
|
1796
|
+
var import_react_core9 = require("@copilotkit/react-core");
|
|
1794
1797
|
var import_runtime_client_gql4 = require("@copilotkit/runtime-client-gql");
|
|
1795
1798
|
var import_shared3 = require("@copilotkit/shared");
|
|
1796
1799
|
|
|
1797
1800
|
// src/components/dev-console/utils.ts
|
|
1798
|
-
var
|
|
1801
|
+
var import_react_core7 = require("@copilotkit/react-core");
|
|
1799
1802
|
function shouldShowDevConsole(showDevConsole) {
|
|
1800
1803
|
if (typeof showDevConsole === "boolean") {
|
|
1801
1804
|
return showDevConsole;
|
|
@@ -1857,7 +1860,7 @@ function getPublishedCopilotKitVersion(current, forceCheck = false) {
|
|
|
1857
1860
|
}
|
|
1858
1861
|
function logReadables(context) {
|
|
1859
1862
|
console.log("%cCurrent Readables:", "font-size: 16px; font-weight: bold;");
|
|
1860
|
-
const readables = context.getContextString([],
|
|
1863
|
+
const readables = context.getContextString([], import_react_core7.defaultCopilotContextCategories).trim();
|
|
1861
1864
|
if (readables.length === 0) {
|
|
1862
1865
|
console.log("No readables found");
|
|
1863
1866
|
return;
|
|
@@ -1927,7 +1930,7 @@ function logMessages(context) {
|
|
|
1927
1930
|
}
|
|
1928
1931
|
|
|
1929
1932
|
// src/components/dev-console/console.tsx
|
|
1930
|
-
var
|
|
1933
|
+
var import_react_core8 = require("@copilotkit/react-core");
|
|
1931
1934
|
var import_react10 = require("react");
|
|
1932
1935
|
|
|
1933
1936
|
// src/components/dev-console/icons.tsx
|
|
@@ -2227,7 +2230,7 @@ function CopilotKitHelpModal() {
|
|
|
2227
2230
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2228
2231
|
function CopilotDevConsole() {
|
|
2229
2232
|
const currentVersion = import_shared2.COPILOTKIT_VERSION;
|
|
2230
|
-
const context = (0,
|
|
2233
|
+
const context = (0, import_react_core8.useCopilotContext)();
|
|
2231
2234
|
const [showDevConsole, setShowDevConsole] = (0, import_react10.useState)(false);
|
|
2232
2235
|
(0, import_react10.useEffect)(() => {
|
|
2233
2236
|
setShowDevConsole(shouldShowDevConsole(context.showDevConsole));
|
|
@@ -2391,8 +2394,8 @@ function DebugMenuButton({
|
|
|
2391
2394
|
checkForUpdates,
|
|
2392
2395
|
mode
|
|
2393
2396
|
}) {
|
|
2394
|
-
const context = (0,
|
|
2395
|
-
const messagesContext = (0,
|
|
2397
|
+
const context = (0, import_react_core8.useCopilotContext)();
|
|
2398
|
+
const messagesContext = (0, import_react_core8.useCopilotMessagesContext)();
|
|
2396
2399
|
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "bg-black top-24 w-52 text-right", children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_react11.Menu, { children: [
|
|
2397
2400
|
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react11.MenuButton, { className: `copilotKitDebugMenuButton ${mode === "compact" ? "compact" : ""}`, children: mode == "compact" ? "Debug" : /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [
|
|
2398
2401
|
"Debug ",
|
|
@@ -2426,7 +2429,7 @@ function DebugMenuButton({
|
|
|
2426
2429
|
}
|
|
2427
2430
|
|
|
2428
2431
|
// src/components/chat/Chat.tsx
|
|
2429
|
-
var
|
|
2432
|
+
var import_react_core10 = require("@copilotkit/react-core");
|
|
2430
2433
|
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2431
2434
|
function CopilotChat({
|
|
2432
2435
|
instructions,
|
|
@@ -2449,7 +2452,7 @@ function CopilotChat({
|
|
|
2449
2452
|
AssistantMessage: AssistantMessage2 = AssistantMessage,
|
|
2450
2453
|
UserMessage: UserMessage2 = UserMessage
|
|
2451
2454
|
}) {
|
|
2452
|
-
const context = (0,
|
|
2455
|
+
const context = (0, import_react_core9.useCopilotContext)();
|
|
2453
2456
|
(0, import_react12.useEffect)(() => {
|
|
2454
2457
|
context.setChatInstructions(instructions || "");
|
|
2455
2458
|
}, [instructions]);
|
|
@@ -2533,7 +2536,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2533
2536
|
stopGeneration: defaultStopGeneration,
|
|
2534
2537
|
runChatCompletion,
|
|
2535
2538
|
isLoading
|
|
2536
|
-
} = (0,
|
|
2539
|
+
} = (0, import_react_core9.useCopilotChat)({
|
|
2537
2540
|
id: (0, import_shared3.randomId)(),
|
|
2538
2541
|
makeSystemMessage
|
|
2539
2542
|
});
|
|
@@ -2545,8 +2548,8 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2545
2548
|
(_a2 = suggestionsAbortControllerRef.current) == null ? void 0 : _a2.abort();
|
|
2546
2549
|
suggestionsAbortControllerRef.current = null;
|
|
2547
2550
|
};
|
|
2548
|
-
const generalContext = (0,
|
|
2549
|
-
const messagesContext = (0,
|
|
2551
|
+
const generalContext = (0, import_react_core9.useCopilotContext)();
|
|
2552
|
+
const messagesContext = (0, import_react_core9.useCopilotMessagesContext)();
|
|
2550
2553
|
const context = __spreadValues(__spreadValues({}, generalContext), messagesContext);
|
|
2551
2554
|
(0, import_react12.useEffect)(() => {
|
|
2552
2555
|
onInProgress == null ? void 0 : onInProgress(isLoading);
|
|
@@ -2614,7 +2617,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2614
2617
|
});
|
|
2615
2618
|
const runCurrentAgent = (hint) => __async(void 0, null, function* () {
|
|
2616
2619
|
if (generalContext.agentSession) {
|
|
2617
|
-
yield (0,
|
|
2620
|
+
yield (0, import_react_core10.runAgent)(
|
|
2618
2621
|
generalContext.agentSession.agentName,
|
|
2619
2622
|
context,
|
|
2620
2623
|
appendMessage,
|
|
@@ -2625,7 +2628,7 @@ var useCopilotChatLogic = (makeSystemMessage, onInProgress, onSubmitMessage, onS
|
|
|
2625
2628
|
});
|
|
2626
2629
|
const stopCurrentAgent = () => {
|
|
2627
2630
|
if (generalContext.agentSession) {
|
|
2628
|
-
(0,
|
|
2631
|
+
(0, import_react_core10.stopAgent)(generalContext.agentSession.agentName, context);
|
|
2629
2632
|
}
|
|
2630
2633
|
};
|
|
2631
2634
|
const setCurrentAgentState = (state) => {
|
|
@@ -2779,7 +2782,7 @@ function CopilotSidebar(props) {
|
|
|
2779
2782
|
|
|
2780
2783
|
// src/hooks/use-copilot-chat-suggestions.tsx
|
|
2781
2784
|
var import_react15 = require("react");
|
|
2782
|
-
var
|
|
2785
|
+
var import_react_core11 = require("@copilotkit/react-core");
|
|
2783
2786
|
var import_shared4 = require("@copilotkit/shared");
|
|
2784
2787
|
function useCopilotChatSuggestions({
|
|
2785
2788
|
available = "enabled",
|
|
@@ -2788,7 +2791,7 @@ function useCopilotChatSuggestions({
|
|
|
2788
2791
|
minSuggestions = 1,
|
|
2789
2792
|
maxSuggestions = 3
|
|
2790
2793
|
}, dependencies = []) {
|
|
2791
|
-
const context = (0,
|
|
2794
|
+
const context = (0, import_react_core11.useCopilotContext)();
|
|
2792
2795
|
(0, import_react15.useEffect)(() => {
|
|
2793
2796
|
if (available === "disabled")
|
|
2794
2797
|
return;
|