@copilotkit/react-core 1.9.2-next.10 → 1.9.2-next.12
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/dist/{chunk-EXU7GWLC.mjs → chunk-ENLPADPJ.mjs} +2 -2
- package/dist/{chunk-OF4SZTLL.mjs → chunk-GPCFFQHF.mjs} +2 -2
- package/dist/{chunk-G7LYGERN.mjs → chunk-IF2M6XIO.mjs} +24 -10
- package/dist/{chunk-G7LYGERN.mjs.map → chunk-IF2M6XIO.mjs.map} +1 -1
- package/dist/{chunk-ADIITPD2.mjs → chunk-UHEKBL6C.mjs} +2 -2
- package/dist/hooks/index.js +23 -9
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +4 -4
- package/dist/hooks/use-chat.js +23 -9
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +1 -1
- package/dist/hooks/use-coagent.js +23 -9
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +3 -3
- package/dist/hooks/use-copilot-chat.js +23 -9
- 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 +23 -9
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +3 -3
- package/dist/index.js +23 -9
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -4
- package/package.json +3 -3
- package/src/hooks/use-chat.ts +31 -9
- /package/dist/{chunk-EXU7GWLC.mjs.map → chunk-ENLPADPJ.mjs.map} +0 -0
- /package/dist/{chunk-OF4SZTLL.mjs.map → chunk-GPCFFQHF.mjs.map} +0 -0
- /package/dist/{chunk-ADIITPD2.mjs.map → chunk-UHEKBL6C.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
} from "./chunk-CMQV4XNY.mjs";
|
|
12
12
|
import {
|
|
13
13
|
useLangGraphInterrupt
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GPCFFQHF.mjs";
|
|
15
15
|
import {
|
|
16
16
|
useMakeCopilotDocumentReadable
|
|
17
17
|
} from "./chunk-ERXWDCY6.mjs";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
startAgent,
|
|
24
24
|
stopAgent,
|
|
25
25
|
useCoAgent
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-UHEKBL6C.mjs";
|
|
27
27
|
import {
|
|
28
28
|
useCopilotAdditionalInstructions
|
|
29
29
|
} from "./chunk-JPMIAGI6.mjs";
|
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
} from "./chunk-NQVCZQ5T.mjs";
|
|
36
36
|
import {
|
|
37
37
|
useCopilotChat
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-ENLPADPJ.mjs";
|
|
39
39
|
import {
|
|
40
40
|
useCopilotReadable
|
|
41
41
|
} from "./chunk-UBNRUXEK.mjs";
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
CopilotMessagesContext,
|
|
56
56
|
useCopilotMessagesContext
|
|
57
57
|
} from "./chunk-DCTJZ742.mjs";
|
|
58
|
-
import "./chunk-
|
|
58
|
+
import "./chunk-IF2M6XIO.mjs";
|
|
59
59
|
import "./chunk-4CEQJ2X6.mjs";
|
|
60
60
|
import "./chunk-3OQM3NEK.mjs";
|
|
61
61
|
import "./chunk-O7ARI5CV.mjs";
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
|
-
"version": "1.9.2-next.
|
|
12
|
+
"version": "1.9.2-next.12",
|
|
13
13
|
"sideEffects": false,
|
|
14
14
|
"main": "./dist/index.js",
|
|
15
15
|
"module": "./dist/index.mjs",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@scarf/scarf": "^1.3.0",
|
|
45
45
|
"react-markdown": "^8.0.7",
|
|
46
46
|
"untruncate-json": "^0.0.1",
|
|
47
|
-
"@copilotkit/runtime-client-gql": "1.9.2-next.
|
|
48
|
-
"@copilotkit/shared": "1.9.2-next.
|
|
47
|
+
"@copilotkit/runtime-client-gql": "1.9.2-next.12",
|
|
48
|
+
"@copilotkit/shared": "1.9.2-next.12"
|
|
49
49
|
},
|
|
50
50
|
"keywords": [
|
|
51
51
|
"copilotkit",
|
package/src/hooks/use-chat.ts
CHANGED
|
@@ -892,25 +892,47 @@ export function useChat(options: UseChatOptions): UseChatHelpers {
|
|
|
892
892
|
);
|
|
893
893
|
|
|
894
894
|
const reload = useAsyncCallback(
|
|
895
|
-
async (
|
|
895
|
+
async (reloadMessageId: string): Promise<void> => {
|
|
896
896
|
if (isLoading || messages.length === 0) {
|
|
897
897
|
return;
|
|
898
898
|
}
|
|
899
899
|
|
|
900
|
-
const
|
|
901
|
-
if (
|
|
902
|
-
console.warn(`Message with id ${
|
|
900
|
+
const reloadMessageIndex = messages.findIndex((msg) => msg.id === reloadMessageId);
|
|
901
|
+
if (reloadMessageIndex === -1) {
|
|
902
|
+
console.warn(`Message with id ${reloadMessageId} not found`);
|
|
903
903
|
return;
|
|
904
904
|
}
|
|
905
905
|
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
906
|
+
// @ts-expect-error -- message has role
|
|
907
|
+
const reloadMessageRole = messages[reloadMessageIndex].role;
|
|
908
|
+
if (reloadMessageRole !== MessageRole.Assistant) {
|
|
909
|
+
console.warn(`Regenerate cannot be performed on ${reloadMessageRole} role`);
|
|
910
|
+
return;
|
|
909
911
|
}
|
|
910
912
|
|
|
911
|
-
|
|
913
|
+
let historyCutoff: Message[] = [];
|
|
914
|
+
if (messages.length > 2) {
|
|
915
|
+
// message to regenerate from is now first.
|
|
916
|
+
// Work backwards to find the first the closest user message
|
|
917
|
+
const lastUserMessageBeforeRegenerate = messages
|
|
918
|
+
.slice(0, reloadMessageIndex)
|
|
919
|
+
.reverse()
|
|
920
|
+
.find(
|
|
921
|
+
(msg) =>
|
|
922
|
+
// @ts-expect-error -- message has role
|
|
923
|
+
msg.role === MessageRole.User,
|
|
924
|
+
);
|
|
925
|
+
const indexOfLastUserMessageBeforeRegenerate = messages.findIndex(
|
|
926
|
+
(msg) => msg.id === lastUserMessageBeforeRegenerate!.id,
|
|
927
|
+
);
|
|
928
|
+
|
|
929
|
+
// Include the user message, remove everything after it
|
|
930
|
+
historyCutoff = messages.slice(0, indexOfLastUserMessageBeforeRegenerate + 1);
|
|
931
|
+
}
|
|
932
|
+
|
|
933
|
+
setMessages(historyCutoff);
|
|
912
934
|
|
|
913
|
-
return runChatCompletionAndHandleFunctionCall(
|
|
935
|
+
return runChatCompletionAndHandleFunctionCall(historyCutoff);
|
|
914
936
|
},
|
|
915
937
|
[isLoading, messages, setMessages, runChatCompletionAndHandleFunctionCall],
|
|
916
938
|
);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|