@copilotkit/react-core 1.10.5-next.0 → 1.10.5-next.10
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 +74 -0
- package/dist/{chunk-6INCKUL6.mjs → chunk-3N4MVKFZ.mjs} +32 -18
- package/dist/chunk-3N4MVKFZ.mjs.map +1 -0
- package/dist/{chunk-CLQLVMW4.mjs → chunk-3WUDRJTT.mjs} +2 -2
- package/dist/{chunk-AGP7SAEE.mjs → chunk-7LTRT3IV.mjs} +4 -4
- package/dist/{chunk-CXDK6XA5.mjs → chunk-BBUQMG45.mjs} +2 -2
- package/dist/{chunk-G2GQX4FI.mjs → chunk-CUWOXXM5.mjs} +3 -3
- package/dist/{chunk-YHT6CWIY.mjs → chunk-EUX2P2E7.mjs} +5 -3
- package/dist/{chunk-YHT6CWIY.mjs.map → chunk-EUX2P2E7.mjs.map} +1 -1
- package/dist/{chunk-4JBVPOHK.mjs → chunk-GIGUZ2OK.mjs} +3 -3
- package/dist/{chunk-36FJAVOF.mjs → chunk-HDOG2RTM.mjs} +2 -2
- package/dist/{chunk-AR7HJPGU.mjs → chunk-HI6SPUOX.mjs} +2 -2
- package/dist/{chunk-FCRODLLL.mjs → chunk-HYJUBYMU.mjs} +5 -5
- package/dist/{chunk-7D4OASUM.mjs → chunk-IHV5PTID.mjs} +2 -2
- package/dist/{chunk-7LZXD5RJ.mjs → chunk-ITDKIB5E.mjs} +30 -23
- package/dist/chunk-ITDKIB5E.mjs.map +1 -0
- package/dist/{chunk-KA3NCZEJ.mjs → chunk-JBACWIFW.mjs} +2 -2
- package/dist/{chunk-HHLBUGRA.mjs → chunk-JCHRWCYH.mjs} +3 -3
- package/dist/{chunk-NALRM7KT.mjs → chunk-L5MS4UDD.mjs} +11 -5
- package/dist/chunk-L5MS4UDD.mjs.map +1 -0
- package/dist/{chunk-MY2BUA6F.mjs → chunk-M37URBJS.mjs} +2 -2
- package/dist/{chunk-MZ37BAAE.mjs → chunk-MGWRDFBE.mjs} +2 -2
- package/dist/{chunk-23SOG4FI.mjs → chunk-TUTNHDM3.mjs} +2 -2
- package/dist/{chunk-QF3Q5LUN.mjs → chunk-ZVOLWJCY.mjs} +5 -5
- package/dist/chunk-ZVOLWJCY.mjs.map +1 -0
- package/dist/components/copilot-provider/copilot-messages.js +4 -2
- package/dist/components/copilot-provider/copilot-messages.js.map +1 -1
- package/dist/components/copilot-provider/copilot-messages.mjs +2 -2
- package/dist/components/copilot-provider/copilotkit-props.d.ts +1 -1
- package/dist/components/copilot-provider/copilotkit.d.ts +1 -1
- package/dist/components/copilot-provider/copilotkit.js +30 -21
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +5 -5
- package/dist/components/copilot-provider/index.d.ts +1 -1
- package/dist/components/copilot-provider/index.js +30 -21
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +5 -5
- package/dist/components/dev-console/console-trigger.js +4 -2
- package/dist/components/dev-console/console-trigger.js.map +1 -1
- package/dist/components/dev-console/console-trigger.mjs +3 -3
- package/dist/components/dev-console/developer-console-modal.js +4 -2
- package/dist/components/dev-console/developer-console-modal.js.map +1 -1
- package/dist/components/dev-console/developer-console-modal.mjs +2 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +30 -21
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +5 -5
- package/dist/context/copilot-context.d.ts +1 -1
- package/dist/context/copilot-context.js +4 -2
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/copilot-messages-context.d.ts +2 -2
- package/dist/context/index.d.ts +2 -2
- package/dist/context/index.js +4 -2
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/{copilot-context-59740e82.d.ts → copilot-context-cf9de848.d.ts} +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +44 -22
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +18 -18
- package/dist/hooks/use-chat.d.ts +1 -1
- package/dist/hooks/use-chat.js +33 -17
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +2 -2
- package/dist/hooks/use-coagent-state-render.js +4 -2
- package/dist/hooks/use-coagent-state-render.js.map +1 -1
- package/dist/hooks/use-coagent-state-render.mjs +2 -2
- package/dist/hooks/use-coagent.d.ts +1 -1
- package/dist/hooks/use-coagent.js +36 -20
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +9 -9
- package/dist/hooks/use-copilot-action.js +4 -2
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +2 -2
- package/dist/hooks/use-copilot-additional-instructions.js +4 -2
- package/dist/hooks/use-copilot-additional-instructions.js.map +1 -1
- package/dist/hooks/use-copilot-additional-instructions.mjs +2 -2
- package/dist/hooks/use-copilot-authenticated-action.js +4 -2
- package/dist/hooks/use-copilot-authenticated-action.js.map +1 -1
- package/dist/hooks/use-copilot-authenticated-action.mjs +3 -3
- package/dist/hooks/use-copilot-chat-headless_c.d.ts +2 -2
- package/dist/hooks/use-copilot-chat-headless_c.js +36 -20
- package/dist/hooks/use-copilot-chat-headless_c.js.map +1 -1
- package/dist/hooks/use-copilot-chat-headless_c.mjs +9 -9
- package/dist/hooks/use-copilot-chat.d.ts +2 -2
- package/dist/hooks/use-copilot-chat.js +36 -20
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +9 -9
- package/dist/hooks/use-copilot-chat_internal.d.ts +2 -2
- package/dist/hooks/use-copilot-chat_internal.js +36 -20
- package/dist/hooks/use-copilot-chat_internal.js.map +1 -1
- package/dist/hooks/use-copilot-chat_internal.mjs +8 -8
- package/dist/hooks/use-copilot-readable.js +4 -2
- package/dist/hooks/use-copilot-readable.js.map +1 -1
- package/dist/hooks/use-copilot-readable.mjs +2 -2
- package/dist/hooks/use-langgraph-interrupt-render.js +7 -5
- package/dist/hooks/use-langgraph-interrupt-render.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt-render.mjs +2 -2
- package/dist/hooks/use-langgraph-interrupt.d.ts +1 -1
- package/dist/hooks/use-langgraph-interrupt.js +44 -22
- package/dist/hooks/use-langgraph-interrupt.js.map +1 -1
- package/dist/hooks/use-langgraph-interrupt.mjs +9 -9
- package/dist/hooks/use-make-copilot-document-readable.js +4 -2
- package/dist/hooks/use-make-copilot-document-readable.js.map +1 -1
- package/dist/hooks/use-make-copilot-document-readable.mjs +2 -2
- package/dist/{index-d1743abe.d.ts → index-1f5b66ac.d.ts} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +70 -41
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -19
- package/dist/lib/copilot-task.d.ts +1 -1
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +6 -6
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +6 -6
- package/dist/types/interrupt-action.d.ts +1 -1
- package/dist/types/interrupt-action.js.map +1 -1
- package/dist/utils/extract.d.ts +2 -2
- package/dist/utils/extract.js.map +1 -1
- package/dist/utils/extract.mjs +5 -5
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +5 -5
- package/dist/utils/suggestions.d.ts +2 -2
- package/dist/utils/suggestions.js.map +1 -1
- package/dist/utils/suggestions.mjs +5 -5
- package/package.json +3 -3
- package/src/components/copilot-provider/copilotkit.tsx +27 -17
- package/src/context/copilot-context.tsx +3 -3
- package/src/hooks/use-chat.ts +27 -11
- package/src/hooks/use-langgraph-interrupt-render.ts +4 -3
- package/src/hooks/use-langgraph-interrupt.ts +8 -3
- package/src/types/interrupt-action.ts +4 -1
- package/dist/chunk-6INCKUL6.mjs.map +0 -1
- package/dist/chunk-7LZXD5RJ.mjs.map +0 -1
- package/dist/chunk-NALRM7KT.mjs.map +0 -1
- package/dist/chunk-QF3Q5LUN.mjs.map +0 -1
- /package/dist/{chunk-CLQLVMW4.mjs.map → chunk-3WUDRJTT.mjs.map} +0 -0
- /package/dist/{chunk-AGP7SAEE.mjs.map → chunk-7LTRT3IV.mjs.map} +0 -0
- /package/dist/{chunk-CXDK6XA5.mjs.map → chunk-BBUQMG45.mjs.map} +0 -0
- /package/dist/{chunk-G2GQX4FI.mjs.map → chunk-CUWOXXM5.mjs.map} +0 -0
- /package/dist/{chunk-4JBVPOHK.mjs.map → chunk-GIGUZ2OK.mjs.map} +0 -0
- /package/dist/{chunk-36FJAVOF.mjs.map → chunk-HDOG2RTM.mjs.map} +0 -0
- /package/dist/{chunk-AR7HJPGU.mjs.map → chunk-HI6SPUOX.mjs.map} +0 -0
- /package/dist/{chunk-FCRODLLL.mjs.map → chunk-HYJUBYMU.mjs.map} +0 -0
- /package/dist/{chunk-7D4OASUM.mjs.map → chunk-IHV5PTID.mjs.map} +0 -0
- /package/dist/{chunk-KA3NCZEJ.mjs.map → chunk-JBACWIFW.mjs.map} +0 -0
- /package/dist/{chunk-HHLBUGRA.mjs.map → chunk-JCHRWCYH.mjs.map} +0 -0
- /package/dist/{chunk-MY2BUA6F.mjs.map → chunk-M37URBJS.mjs.map} +0 -0
- /package/dist/{chunk-MZ37BAAE.mjs.map → chunk-MGWRDFBE.mjs.map} +0 -0
- /package/dist/{chunk-23SOG4FI.mjs.map → chunk-TUTNHDM3.mjs.map} +0 -0
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,49 +1,49 @@
|
|
|
1
1
|
import "../chunk-KDAZGZ24.mjs";
|
|
2
2
|
import {
|
|
3
3
|
useLangGraphInterrupt
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-L5MS4UDD.mjs";
|
|
5
5
|
import {
|
|
6
6
|
useMakeCopilotDocumentReadable
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-BBUQMG45.mjs";
|
|
8
8
|
import {
|
|
9
9
|
useCopilotAdditionalInstructions
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-MGWRDFBE.mjs";
|
|
11
11
|
import {
|
|
12
12
|
useCopilotAuthenticatedAction_c
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-GIGUZ2OK.mjs";
|
|
14
14
|
import {
|
|
15
15
|
useCopilotAction
|
|
16
|
-
} from "../chunk-
|
|
16
|
+
} from "../chunk-HI6SPUOX.mjs";
|
|
17
17
|
import {
|
|
18
18
|
useCopilotChatHeadless_c
|
|
19
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-JCHRWCYH.mjs";
|
|
20
20
|
import {
|
|
21
21
|
useCopilotChat as useCopilotChat2
|
|
22
|
-
} from "../chunk-
|
|
22
|
+
} from "../chunk-JBACWIFW.mjs";
|
|
23
23
|
import {
|
|
24
24
|
useCopilotReadable
|
|
25
|
-
} from "../chunk-
|
|
25
|
+
} from "../chunk-HDOG2RTM.mjs";
|
|
26
26
|
import {
|
|
27
27
|
useCoAgentStateRender
|
|
28
|
-
} from "../chunk-
|
|
28
|
+
} from "../chunk-3WUDRJTT.mjs";
|
|
29
29
|
import {
|
|
30
30
|
runAgent,
|
|
31
31
|
startAgent,
|
|
32
32
|
stopAgent,
|
|
33
33
|
useCoAgent
|
|
34
|
-
} from "../chunk-
|
|
34
|
+
} from "../chunk-7LTRT3IV.mjs";
|
|
35
35
|
import {
|
|
36
36
|
useCopilotChat
|
|
37
|
-
} from "../chunk-
|
|
37
|
+
} from "../chunk-HYJUBYMU.mjs";
|
|
38
38
|
import {
|
|
39
39
|
useLangGraphInterruptRender
|
|
40
|
-
} from "../chunk-
|
|
40
|
+
} from "../chunk-ZVOLWJCY.mjs";
|
|
41
41
|
import "../chunk-YPSGKPDA.mjs";
|
|
42
|
-
import "../chunk-
|
|
42
|
+
import "../chunk-ITDKIB5E.mjs";
|
|
43
43
|
import "../chunk-L3I57GMV.mjs";
|
|
44
|
-
import "../chunk-
|
|
45
|
-
import "../chunk-
|
|
46
|
-
import "../chunk-
|
|
44
|
+
import "../chunk-M37URBJS.mjs";
|
|
45
|
+
import "../chunk-CUWOXXM5.mjs";
|
|
46
|
+
import "../chunk-TUTNHDM3.mjs";
|
|
47
47
|
import "../chunk-PIF5KJYI.mjs";
|
|
48
48
|
import "../chunk-2IDV5OHF.mjs";
|
|
49
49
|
import "../chunk-PMAFHQ7P.mjs";
|
|
@@ -51,7 +51,7 @@ import "../chunk-5FHSUKQL.mjs";
|
|
|
51
51
|
import "../chunk-RKTVJRK7.mjs";
|
|
52
52
|
import "../chunk-ZLQVRPDS.mjs";
|
|
53
53
|
import "../chunk-6ZLPNY7X.mjs";
|
|
54
|
-
import "../chunk-
|
|
54
|
+
import "../chunk-3N4MVKFZ.mjs";
|
|
55
55
|
import "../chunk-4CEQJ2X6.mjs";
|
|
56
56
|
import "../chunk-N4WEHORG.mjs";
|
|
57
57
|
import "../chunk-O7ARI5CV.mjs";
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
useCopilotRuntimeClient
|
|
60
60
|
} from "../chunk-Q3MCVRO3.mjs";
|
|
61
61
|
import "../chunk-ICIK2BSB.mjs";
|
|
62
|
-
import "../chunk-
|
|
62
|
+
import "../chunk-EUX2P2E7.mjs";
|
|
63
63
|
import "../chunk-EFL5OBKN.mjs";
|
|
64
64
|
import "../chunk-SKC7AJIV.mjs";
|
|
65
65
|
export {
|
package/dist/hooks/use-chat.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FunctionCallHandler, CoAgentStateRenderHandler } from '@copilotkit/shared';
|
|
3
3
|
import { Message, TextMessage, ForwardedParametersInput, ExtensionsInput } from '@copilotkit/runtime-client-gql';
|
|
4
|
-
import { c as CopilotApiConfig, A as AgentSession, L as LangGraphInterruptAction, d as LangGraphInterruptActionSetter } from '../copilot-context-
|
|
4
|
+
import { c as CopilotApiConfig, A as AgentSession, L as LangGraphInterruptAction, d as LangGraphInterruptActionSetter } from '../copilot-context-cf9de848.js';
|
|
5
5
|
import { FrontendAction } from '../types/frontend-action.js';
|
|
6
6
|
import { CoagentState } from '../types/coagent-state.js';
|
|
7
7
|
import './use-tree.js';
|
package/dist/hooks/use-chat.js
CHANGED
|
@@ -184,8 +184,10 @@ var emptyCopilotContext = {
|
|
|
184
184
|
setExtensions: () => {
|
|
185
185
|
},
|
|
186
186
|
langGraphInterruptAction: null,
|
|
187
|
-
setLangGraphInterruptAction: () =>
|
|
188
|
-
|
|
187
|
+
setLangGraphInterruptAction: () => {
|
|
188
|
+
},
|
|
189
|
+
removeLangGraphInterruptAction: () => {
|
|
190
|
+
},
|
|
189
191
|
onError: () => {
|
|
190
192
|
},
|
|
191
193
|
bannerError: null,
|
|
@@ -507,7 +509,18 @@ function useChat(options) {
|
|
|
507
509
|
const runChatCompletionRef = (0, import_react5.useRef)();
|
|
508
510
|
const addErrorToast = useErrorToast();
|
|
509
511
|
const { setBannerError } = useToast();
|
|
510
|
-
const { onError } = useCopilotContext();
|
|
512
|
+
const { onError, showDevConsole, getAllContext } = useCopilotContext();
|
|
513
|
+
const copilotReadableContext = getAllContext();
|
|
514
|
+
const context = (0, import_react5.useMemo)(
|
|
515
|
+
() => copilotReadableContext.map((contextItem) => {
|
|
516
|
+
const [description, ...valueParts] = contextItem.value.split(":");
|
|
517
|
+
return {
|
|
518
|
+
description: description.trim(),
|
|
519
|
+
value: valueParts.join(":").trim()
|
|
520
|
+
};
|
|
521
|
+
}),
|
|
522
|
+
[copilotReadableContext]
|
|
523
|
+
);
|
|
511
524
|
const traceUIError = (error, originalError) => __async(this, null, function* () {
|
|
512
525
|
try {
|
|
513
526
|
const traceEvent = {
|
|
@@ -541,7 +554,6 @@ function useChat(options) {
|
|
|
541
554
|
extensionsRef.current = extensions;
|
|
542
555
|
const publicApiKey = copilotConfig.publicApiKey;
|
|
543
556
|
const headers = __spreadValues(__spreadValues({}, copilotConfig.headers || {}), publicApiKey ? { [import_shared4.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey } : {});
|
|
544
|
-
const { showDevConsole } = useCopilotContext();
|
|
545
557
|
const runtimeClient = useCopilotRuntimeClient({
|
|
546
558
|
url: copilotConfig.chatApiEndpoint,
|
|
547
559
|
publicApiKey: copilotConfig.publicApiKey,
|
|
@@ -622,7 +634,8 @@ function useChat(options) {
|
|
|
622
634
|
}
|
|
623
635
|
return stateObject;
|
|
624
636
|
}),
|
|
625
|
-
forwardedParameters: options.forwardedParameters || {}
|
|
637
|
+
forwardedParameters: options.forwardedParameters || {},
|
|
638
|
+
context
|
|
626
639
|
}),
|
|
627
640
|
properties: finalProperties,
|
|
628
641
|
signal: (_e = chatAbortControllerRef.current) == null ? void 0 : _e.signal
|
|
@@ -666,7 +679,7 @@ function useChat(options) {
|
|
|
666
679
|
if (ev.name === import_runtime_client_gql3.MetaEventName.LangGraphInterruptEvent) {
|
|
667
680
|
let eventValue = (0, import_runtime_client_gql3.langGraphInterruptEvent)(ev).value;
|
|
668
681
|
eventValue = (0, import_shared4.parseJson)(eventValue, eventValue);
|
|
669
|
-
setLangGraphInterruptAction({
|
|
682
|
+
setLangGraphInterruptAction(threadId, {
|
|
670
683
|
event: __spreadProps(__spreadValues({}, (0, import_runtime_client_gql3.langGraphInterruptEvent)(ev)), {
|
|
671
684
|
value: eventValue
|
|
672
685
|
})
|
|
@@ -729,7 +742,7 @@ function useChat(options) {
|
|
|
729
742
|
preservedStructure: !!originalCode
|
|
730
743
|
});
|
|
731
744
|
setIsLoading(false);
|
|
732
|
-
|
|
745
|
+
throw new Error(structuredError.message);
|
|
733
746
|
} else if (messages2.length > 0) {
|
|
734
747
|
newMessages = [...messages2];
|
|
735
748
|
for (const message of messages2) {
|
|
@@ -850,8 +863,8 @@ function useChat(options) {
|
|
|
850
863
|
}
|
|
851
864
|
const currentResultMessagePairedFeAction = message.isResultMessage() ? getPairedFeAction(actions, message) : null;
|
|
852
865
|
if (action && message.isActionExecutionMessage()) {
|
|
853
|
-
const
|
|
854
|
-
const alreadyProcessed =
|
|
866
|
+
const pairedFeAction = getPairedFeAction(actions, message);
|
|
867
|
+
const alreadyProcessed = !pairedFeAction && finalMessages.some(
|
|
855
868
|
(fm) => fm.isResultMessage() && fm.actionExecutionId === message.id
|
|
856
869
|
);
|
|
857
870
|
if (alreadyProcessed) {
|
|
@@ -860,16 +873,16 @@ function useChat(options) {
|
|
|
860
873
|
action,
|
|
861
874
|
message
|
|
862
875
|
);
|
|
863
|
-
const
|
|
864
|
-
if (
|
|
876
|
+
const pairedFeAction2 = getPairedFeAction(actions, resultMessage);
|
|
877
|
+
if (pairedFeAction2) {
|
|
865
878
|
const newExecutionMessage = new import_runtime_client_gql3.ActionExecutionMessage({
|
|
866
|
-
name:
|
|
879
|
+
name: pairedFeAction2.name,
|
|
867
880
|
arguments: (0, import_shared4.parseJson)(resultMessage.result, resultMessage.result),
|
|
868
881
|
status: message.status,
|
|
869
882
|
createdAt: message.createdAt,
|
|
870
883
|
parentMessageId: message.parentMessageId
|
|
871
884
|
});
|
|
872
|
-
yield executeActionFromMessage(
|
|
885
|
+
yield executeActionFromMessage(pairedFeAction2, newExecutionMessage);
|
|
873
886
|
}
|
|
874
887
|
}
|
|
875
888
|
} else if (message.isResultMessage() && currentResultMessagePairedFeAction) {
|
|
@@ -934,7 +947,8 @@ function useChat(options) {
|
|
|
934
947
|
coagentStatesRef,
|
|
935
948
|
agentSession,
|
|
936
949
|
setAgentSession,
|
|
937
|
-
disableSystemMessage
|
|
950
|
+
disableSystemMessage,
|
|
951
|
+
context
|
|
938
952
|
]
|
|
939
953
|
);
|
|
940
954
|
runChatCompletionRef.current = runChatCompletion;
|
|
@@ -963,7 +977,7 @@ function useChat(options) {
|
|
|
963
977
|
switch (event.name) {
|
|
964
978
|
case import_runtime_client_gql3.MetaEventName.LangGraphInterruptEvent:
|
|
965
979
|
if (event.response) {
|
|
966
|
-
setLangGraphInterruptAction(null);
|
|
980
|
+
setLangGraphInterruptAction(threadId, null);
|
|
967
981
|
const value = event.value;
|
|
968
982
|
return [
|
|
969
983
|
...acc,
|
|
@@ -1013,8 +1027,8 @@ function useChat(options) {
|
|
|
1013
1027
|
console.warn(`Regenerate cannot be performed on ${reloadMessageRole} role`);
|
|
1014
1028
|
return;
|
|
1015
1029
|
}
|
|
1016
|
-
let historyCutoff = [];
|
|
1017
|
-
if (messages.length > 2) {
|
|
1030
|
+
let historyCutoff = [messages[0]];
|
|
1031
|
+
if (messages.length > 2 && reloadMessageIndex !== 0) {
|
|
1018
1032
|
const lastUserMessageBeforeRegenerate = messages.slice(0, reloadMessageIndex).reverse().find(
|
|
1019
1033
|
(msg) => (
|
|
1020
1034
|
// @ts-expect-error -- message has role
|
|
@@ -1025,6 +1039,8 @@ function useChat(options) {
|
|
|
1025
1039
|
(msg) => msg.id === lastUserMessageBeforeRegenerate.id
|
|
1026
1040
|
);
|
|
1027
1041
|
historyCutoff = messages.slice(0, indexOfLastUserMessageBeforeRegenerate + 1);
|
|
1042
|
+
} else if (messages.length > 2 && reloadMessageIndex === 0) {
|
|
1043
|
+
historyCutoff = [messages[0], messages[1]];
|
|
1028
1044
|
}
|
|
1029
1045
|
setMessages(historyCutoff);
|
|
1030
1046
|
return runChatCompletionAndHandleFunctionCall(historyCutoff);
|