@copilotkit/react-core 1.8.13-next.3 → 1.8.14-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 +19 -0
- package/dist/{chunk-AW2AIX74.mjs → chunk-74AJEJTV.mjs} +16 -3
- package/dist/chunk-74AJEJTV.mjs.map +1 -0
- package/dist/{chunk-KQPKROYS.mjs → chunk-ECHQLIE4.mjs} +2 -2
- package/dist/{chunk-YXPFUKGZ.mjs → chunk-VMHPQFFM.mjs} +2 -2
- package/dist/{chunk-D5NLDVW2.mjs → chunk-XKRHRYIF.mjs} +2 -2
- package/dist/hooks/index.js +14 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +4 -4
- package/dist/hooks/use-chat.js +14 -1
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +1 -1
- package/dist/hooks/use-coagent.js +14 -1
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +3 -3
- package/dist/hooks/use-copilot-chat.js +14 -1
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +2 -2
- package/dist/hooks/use-langgraph-interrupt.js +14 -1
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +3 -3
- package/dist/index.js +14 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/package.json +3 -3
- package/src/hooks/use-chat.ts +17 -2
- package/dist/chunk-AW2AIX74.mjs.map +0 -1
- /package/dist/{chunk-KQPKROYS.mjs.map → chunk-ECHQLIE4.mjs.map} +0 -0
- /package/dist/{chunk-YXPFUKGZ.mjs.map → chunk-VMHPQFFM.mjs.map} +0 -0
- /package/dist/{chunk-D5NLDVW2.mjs.map → chunk-XKRHRYIF.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -1648,6 +1648,7 @@ function useChat(options) {
|
|
|
1648
1648
|
headers,
|
|
1649
1649
|
credentials: copilotConfig.credentials
|
|
1650
1650
|
});
|
|
1651
|
+
const pendingAppendsRef = (0, import_react11.useRef)([]);
|
|
1651
1652
|
const runChatCompletion = useAsyncCallback(
|
|
1652
1653
|
(previousMessages) => __async(this, null, function* () {
|
|
1653
1654
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o;
|
|
@@ -1980,6 +1981,17 @@ function useChat(options) {
|
|
|
1980
1981
|
}),
|
|
1981
1982
|
[messages]
|
|
1982
1983
|
);
|
|
1984
|
+
(0, import_react11.useEffect)(() => {
|
|
1985
|
+
if (!isLoading && pendingAppendsRef.current.length > 0) {
|
|
1986
|
+
const pending = pendingAppendsRef.current.splice(0);
|
|
1987
|
+
const followUp = pending.some((p) => p.followUp);
|
|
1988
|
+
const newMessages = [...messages, ...pending.map((p) => p.message)];
|
|
1989
|
+
setMessages(newMessages);
|
|
1990
|
+
if (followUp) {
|
|
1991
|
+
runChatCompletionAndHandleFunctionCall(newMessages);
|
|
1992
|
+
}
|
|
1993
|
+
}
|
|
1994
|
+
}, [isLoading, messages, setMessages, runChatCompletionAndHandleFunctionCall]);
|
|
1983
1995
|
const composeAndFlushMetaEventsInput = (0, import_react11.useCallback)(
|
|
1984
1996
|
(metaEvents) => {
|
|
1985
1997
|
return metaEvents.reduce((acc, event) => {
|
|
@@ -2010,12 +2022,13 @@ function useChat(options) {
|
|
|
2010
2022
|
const append = useAsyncCallback(
|
|
2011
2023
|
(message, options2) => __async(this, null, function* () {
|
|
2012
2024
|
var _a;
|
|
2025
|
+
const followUp = (_a = options2 == null ? void 0 : options2.followUp) != null ? _a : true;
|
|
2013
2026
|
if (isLoading) {
|
|
2027
|
+
pendingAppendsRef.current.push({ message, followUp });
|
|
2014
2028
|
return;
|
|
2015
2029
|
}
|
|
2016
2030
|
const newMessages = [...messages, message];
|
|
2017
2031
|
setMessages(newMessages);
|
|
2018
|
-
const followUp = (_a = options2 == null ? void 0 : options2.followUp) != null ? _a : true;
|
|
2019
2032
|
if (followUp) {
|
|
2020
2033
|
return runChatCompletionAndHandleFunctionCall(newMessages);
|
|
2021
2034
|
}
|