@copilotkit/react-core 1.3.16-mme-reset-chat.3 → 1.4.0-feat-langgraph-cloud.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 +5 -29
- package/dist/{chunk-UO527OAF.mjs → chunk-2MPUQRAY.mjs} +1 -8
- package/dist/{chunk-UO527OAF.mjs.map → chunk-2MPUQRAY.mjs.map} +1 -1
- package/dist/{chunk-7PBUNYGJ.mjs → chunk-6YEMNWKE.mjs} +3 -10
- package/dist/{chunk-7PBUNYGJ.mjs.map → chunk-6YEMNWKE.mjs.map} +1 -1
- package/dist/{chunk-DA2PE4TI.mjs → chunk-7DFHFZJT.mjs} +2 -2
- package/dist/{chunk-NV6FEDPI.mjs → chunk-ANOG3W5S.mjs} +2 -2
- package/dist/{chunk-IQ32YPV5.mjs → chunk-CQ23Q555.mjs} +2 -2
- package/dist/{chunk-NTADUCPY.mjs → chunk-G2K6T2QU.mjs} +4 -12
- package/dist/chunk-G2K6T2QU.mjs.map +1 -0
- package/dist/{chunk-P4BUM2FG.mjs → chunk-MX2OYLRS.mjs} +6 -33
- package/dist/chunk-MX2OYLRS.mjs.map +1 -0
- package/dist/{chunk-3LGVOOTH.mjs → chunk-QL23NJ57.mjs} +3 -3
- package/dist/{chunk-YEBQV2YJ.mjs → chunk-RYDEG77L.mjs} +2 -2
- package/dist/{chunk-AB6GYTGE.mjs → chunk-TRXKPXDE.mjs} +2 -2
- package/dist/{chunk-KEUH7BJV.mjs → chunk-ZM6HV22S.mjs} +2 -2
- package/dist/components/copilot-provider/copilotkit.js +1 -15
- package/dist/components/copilot-provider/copilotkit.js.map +1 -1
- package/dist/components/copilot-provider/copilotkit.mjs +2 -2
- package/dist/components/copilot-provider/index.js +1 -15
- package/dist/components/copilot-provider/index.js.map +1 -1
- package/dist/components/copilot-provider/index.mjs +2 -2
- package/dist/components/index.js +1 -15
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/context/copilot-context.d.ts +0 -5
- package/dist/context/copilot-context.js +0 -7
- package/dist/context/copilot-context.js.map +1 -1
- package/dist/context/copilot-context.mjs +1 -1
- package/dist/context/index.js +0 -7
- package/dist/context/index.js.map +1 -1
- package/dist/context/index.mjs +1 -1
- package/dist/hooks/index.js +5 -47
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +16 -16
- package/dist/hooks/use-chat.d.ts +0 -16
- package/dist/hooks/use-chat.js +3 -11
- package/dist/hooks/use-chat.js.map +1 -1
- package/dist/hooks/use-chat.mjs +1 -1
- package/dist/hooks/use-coagent-state-render.js +0 -7
- 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.js +5 -47
- package/dist/hooks/use-coagent.js.map +1 -1
- package/dist/hooks/use-coagent.mjs +6 -6
- package/dist/hooks/use-copilot-action.js +0 -7
- package/dist/hooks/use-copilot-action.js.map +1 -1
- package/dist/hooks/use-copilot-action.mjs +2 -2
- package/dist/hooks/use-copilot-chat.d.ts +0 -1
- package/dist/hooks/use-copilot-chat.js +5 -47
- package/dist/hooks/use-copilot-chat.js.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +5 -5
- package/dist/hooks/use-copilot-readable.js +0 -7
- package/dist/hooks/use-copilot-readable.js.map +1 -1
- package/dist/hooks/use-copilot-readable.mjs +2 -2
- package/dist/hooks/use-make-copilot-document-readable.js +0 -7
- 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.js +6 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -18
- package/dist/lib/copilot-task.js.map +1 -1
- package/dist/lib/copilot-task.mjs +3 -3
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/index.mjs +3 -3
- package/dist/utils/extract.js.map +1 -1
- package/dist/utils/extract.mjs +3 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.mjs +3 -3
- package/package.json +5 -5
- package/src/components/copilot-provider/copilotkit.tsx +0 -7
- package/src/context/copilot-context.tsx +0 -15
- package/src/hooks/use-chat.ts +2 -31
- package/src/hooks/use-copilot-chat.ts +3 -32
- package/dist/chunk-NTADUCPY.mjs.map +0 -1
- package/dist/chunk-P4BUM2FG.mjs.map +0 -1
- /package/dist/{chunk-DA2PE4TI.mjs.map → chunk-7DFHFZJT.mjs.map} +0 -0
- /package/dist/{chunk-NV6FEDPI.mjs.map → chunk-ANOG3W5S.mjs.map} +0 -0
- /package/dist/{chunk-IQ32YPV5.mjs.map → chunk-CQ23Q555.mjs.map} +0 -0
- /package/dist/{chunk-3LGVOOTH.mjs.map → chunk-QL23NJ57.mjs.map} +0 -0
- /package/dist/{chunk-YEBQV2YJ.mjs.map → chunk-RYDEG77L.mjs.map} +0 -0
- /package/dist/{chunk-AB6GYTGE.mjs.map → chunk-TRXKPXDE.mjs.map} +0 -0
- /package/dist/{chunk-KEUH7BJV.mjs.map → chunk-ZM6HV22S.mjs.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -151,13 +151,6 @@ var emptyCopilotContext = {
|
|
|
151
151
|
},
|
|
152
152
|
agentSession: null,
|
|
153
153
|
setAgentSession: () => {
|
|
154
|
-
},
|
|
155
|
-
agentLock: null,
|
|
156
|
-
threadId: null,
|
|
157
|
-
setThreadId: () => {
|
|
158
|
-
},
|
|
159
|
-
runId: null,
|
|
160
|
-
setRunId: () => {
|
|
161
154
|
}
|
|
162
155
|
};
|
|
163
156
|
var CopilotContext = import_react.default.createContext(emptyCopilotContext);
|
|
@@ -572,8 +565,6 @@ ${nonDocumentStrings}`;
|
|
|
572
565
|
};
|
|
573
566
|
}
|
|
574
567
|
const [agentSession, setAgentSession] = (0, import_react6.useState)(initialAgentSession);
|
|
575
|
-
const [threadId, setThreadId] = (0, import_react6.useState)(null);
|
|
576
|
-
const [runId, setRunId] = (0, import_react6.useState)(null);
|
|
577
568
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
578
569
|
CopilotContext.Provider,
|
|
579
570
|
{
|
|
@@ -604,12 +595,7 @@ ${nonDocumentStrings}`;
|
|
|
604
595
|
coagentStates,
|
|
605
596
|
setCoagentStates,
|
|
606
597
|
agentSession,
|
|
607
|
-
setAgentSession
|
|
608
|
-
agentLock: props.agent || null,
|
|
609
|
-
threadId,
|
|
610
|
-
setThreadId,
|
|
611
|
-
runId,
|
|
612
|
-
setRunId
|
|
598
|
+
setAgentSession
|
|
613
599
|
},
|
|
614
600
|
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(CopilotMessages, { children })
|
|
615
601
|
}
|
|
@@ -665,22 +651,16 @@ function useChat(options) {
|
|
|
665
651
|
setCoagentStates,
|
|
666
652
|
coagentStates,
|
|
667
653
|
agentSession,
|
|
668
|
-
setAgentSession
|
|
669
|
-
threadId,
|
|
670
|
-
setThreadId,
|
|
671
|
-
runId,
|
|
672
|
-
setRunId
|
|
654
|
+
setAgentSession
|
|
673
655
|
} = options;
|
|
674
656
|
const abortControllerRef = (0, import_react7.useRef)();
|
|
657
|
+
const threadIdRef = (0, import_react7.useRef)(null);
|
|
658
|
+
const runIdRef = (0, import_react7.useRef)(null);
|
|
675
659
|
const runChatCompletionRef = (0, import_react7.useRef)();
|
|
676
660
|
const coagentStatesRef = (0, import_react7.useRef)(coagentStates);
|
|
677
661
|
coagentStatesRef.current = coagentStates;
|
|
678
662
|
const agentSessionRef = (0, import_react7.useRef)(agentSession);
|
|
679
663
|
agentSessionRef.current = agentSession;
|
|
680
|
-
const threadIdRef = (0, import_react7.useRef)(threadId);
|
|
681
|
-
threadIdRef.current = threadId;
|
|
682
|
-
const runIdRef = (0, import_react7.useRef)(runId);
|
|
683
|
-
runIdRef.current = runId;
|
|
684
664
|
const publicApiKey = copilotConfig.publicApiKey;
|
|
685
665
|
const headers = __spreadValues(__spreadValues({}, copilotConfig.headers || {}), publicApiKey ? { [import_shared4.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey } : {});
|
|
686
666
|
const runtimeClient = new import_runtime_client_gql.CopilotRuntimeClient({
|
|
@@ -758,8 +738,6 @@ function useChat(options) {
|
|
|
758
738
|
}
|
|
759
739
|
threadIdRef.current = value.generateCopilotResponse.threadId || null;
|
|
760
740
|
runIdRef.current = value.generateCopilotResponse.runId || null;
|
|
761
|
-
setThreadId(threadIdRef.current);
|
|
762
|
-
setRunId(runIdRef.current);
|
|
763
741
|
const messages2 = (0, import_runtime_client_gql.convertGqlOutputToMessages)(
|
|
764
742
|
(0, import_runtime_client_gql.filterAdjacentAgentStateMessages)(value.generateCopilotResponse.messages)
|
|
765
743
|
);
|
|
@@ -916,12 +894,7 @@ function useCopilotChat(_a = {}) {
|
|
|
916
894
|
setCoagentStates,
|
|
917
895
|
coAgentStateRenders,
|
|
918
896
|
agentSession,
|
|
919
|
-
setAgentSession
|
|
920
|
-
agentLock,
|
|
921
|
-
threadId,
|
|
922
|
-
setThreadId,
|
|
923
|
-
runId,
|
|
924
|
-
setRunId
|
|
897
|
+
setAgentSession
|
|
925
898
|
} = useCopilotContext();
|
|
926
899
|
const { messages, setMessages } = useCopilotMessagesContext();
|
|
927
900
|
const latestGetContextString = useUpdatedRef(getContextString);
|
|
@@ -971,11 +944,7 @@ function useCopilotChat(_a = {}) {
|
|
|
971
944
|
coagentStates,
|
|
972
945
|
setCoagentStates,
|
|
973
946
|
agentSession,
|
|
974
|
-
setAgentSession
|
|
975
|
-
threadId,
|
|
976
|
-
setThreadId,
|
|
977
|
-
runId,
|
|
978
|
-
setRunId
|
|
947
|
+
setAgentSession
|
|
979
948
|
}));
|
|
980
949
|
const latestAppend = useUpdatedRef(append);
|
|
981
950
|
const latestAppendFunc = (0, import_react8.useCallback)(
|
|
@@ -1006,23 +975,6 @@ function useCopilotChat(_a = {}) {
|
|
|
1006
975
|
},
|
|
1007
976
|
[latestSetMessages]
|
|
1008
977
|
);
|
|
1009
|
-
const reset = (0, import_react8.useCallback)(() => {
|
|
1010
|
-
latestStopFunc();
|
|
1011
|
-
setMessages([]);
|
|
1012
|
-
setThreadId(null);
|
|
1013
|
-
setCoagentStates({});
|
|
1014
|
-
let initialAgentSession = null;
|
|
1015
|
-
if (agentLock) {
|
|
1016
|
-
initialAgentSession = {
|
|
1017
|
-
agentName: agentLock
|
|
1018
|
-
};
|
|
1019
|
-
}
|
|
1020
|
-
setAgentSession(initialAgentSession);
|
|
1021
|
-
}, [latestStopFunc, setMessages, setThreadId, setCoagentStates, setAgentSession, agentLock]);
|
|
1022
|
-
const latestReset = useUpdatedRef(reset);
|
|
1023
|
-
const latestResetFunc = (0, import_react8.useCallback)(() => {
|
|
1024
|
-
return latestReset.current();
|
|
1025
|
-
}, [latestReset]);
|
|
1026
978
|
return {
|
|
1027
979
|
visibleMessages: messages,
|
|
1028
980
|
appendMessage: latestAppendFunc,
|
|
@@ -1030,7 +982,6 @@ function useCopilotChat(_a = {}) {
|
|
|
1030
982
|
reloadMessages: latestReloadFunc,
|
|
1031
983
|
stopGeneration: latestStopFunc,
|
|
1032
984
|
deleteMessage: latestDeleteFunc,
|
|
1033
|
-
reset: latestResetFunc,
|
|
1034
985
|
isLoading
|
|
1035
986
|
};
|
|
1036
987
|
}
|