@copilotkit/react-core 1.56.5-canary.1778052912 → 1.56.5-canary.1778068503
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/dist/copilotkit-BNlJq5UO.d.mts.map +1 -1
- package/dist/copilotkit-DgC5oCFO.d.cts.map +1 -1
- package/dist/{copilotkit-mJjSHUFd.mjs → copilotkit-DhuXdtE1.mjs} +3 -43
- package/dist/copilotkit-DhuXdtE1.mjs.map +1 -0
- package/dist/{copilotkit-CkhjqPU3.cjs → copilotkit-XGd8L2jL.cjs} +3 -43
- package/dist/copilotkit-XGd8L2jL.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/v2/index.cjs +1 -1
- package/dist/v2/index.mjs +1 -1
- package/dist/v2/index.umd.js +2 -45
- package/dist/v2/index.umd.js.map +1 -1
- package/package.json +6 -6
- package/src/v2/components/chat/CopilotChatMessageView.tsx +15 -111
- package/src/v2/components/chat/__tests__/CopilotChatActivityRendering.e2e.test.tsx +3 -3
- package/dist/copilotkit-CkhjqPU3.cjs.map +0 -1
- package/dist/copilotkit-mJjSHUFd.mjs.map +0 -1
|
@@ -5904,9 +5904,6 @@ const MemoizedCustomMessage = react.default.memo(function MemoizedCustomMessage(
|
|
|
5904
5904
|
if (prevProps.message.content !== nextProps.message.content) return false;
|
|
5905
5905
|
if (prevProps.message.role !== nextProps.message.role) return false;
|
|
5906
5906
|
if (JSON.stringify(prevProps.stateSnapshot) !== JSON.stringify(nextProps.stateSnapshot)) return false;
|
|
5907
|
-
if (prevProps.numberOfMessagesInRun !== nextProps.numberOfMessagesInRun) return false;
|
|
5908
|
-
if (prevProps.isInLatestRun !== nextProps.isInLatestRun) return false;
|
|
5909
|
-
if (nextProps.isInLatestRun && prevProps.isRunning !== nextProps.isRunning) return false;
|
|
5910
5907
|
return true;
|
|
5911
5908
|
});
|
|
5912
5909
|
/**
|
|
@@ -5962,34 +5959,6 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
5962
5959
|
} });
|
|
5963
5960
|
return () => subscription.unsubscribe();
|
|
5964
5961
|
}, [copilotkit]);
|
|
5965
|
-
const runMetadata = (0, react.useMemo)(() => {
|
|
5966
|
-
if (!config) return null;
|
|
5967
|
-
const runIdByMessageId = /* @__PURE__ */ new Map();
|
|
5968
|
-
for (const msg of messages) {
|
|
5969
|
-
const r = copilotkit.getRunIdForMessage(config.agentId, config.threadId, msg.id);
|
|
5970
|
-
if (r) runIdByMessageId.set(msg.id, r);
|
|
5971
|
-
}
|
|
5972
|
-
const countByRunId = /* @__PURE__ */ new Map();
|
|
5973
|
-
for (const r of runIdByMessageId.values()) countByRunId.set(r, (countByRunId.get(r) ?? 0) + 1);
|
|
5974
|
-
let latestRunId;
|
|
5975
|
-
for (let i = messages.length - 1; i >= 0; i--) {
|
|
5976
|
-
const r = runIdByMessageId.get(messages[i].id);
|
|
5977
|
-
if (r) {
|
|
5978
|
-
latestRunId = r;
|
|
5979
|
-
break;
|
|
5980
|
-
}
|
|
5981
|
-
}
|
|
5982
|
-
return {
|
|
5983
|
-
runIdByMessageId,
|
|
5984
|
-
countByRunId,
|
|
5985
|
-
latestRunId
|
|
5986
|
-
};
|
|
5987
|
-
}, [
|
|
5988
|
-
messages,
|
|
5989
|
-
config?.agentId,
|
|
5990
|
-
config?.threadId,
|
|
5991
|
-
copilotkit
|
|
5992
|
-
]);
|
|
5993
5962
|
const getStateSnapshotForMessage = (messageId) => {
|
|
5994
5963
|
if (!config) return void 0;
|
|
5995
5964
|
const resolvedRunId = copilotkit.getRunIdForMessage(config.agentId, config.threadId, messageId) ?? copilotkit.getRunIdsForThread(config.agentId, config.threadId).slice(-1)[0];
|
|
@@ -6026,17 +5995,11 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
6026
5995
|
const renderMessageBlock = (message) => {
|
|
6027
5996
|
const elements = [];
|
|
6028
5997
|
const stateSnapshot = getStateSnapshotForMessage(message.id);
|
|
6029
|
-
const messageRunId = runMetadata?.runIdByMessageId.get(message.id);
|
|
6030
|
-
const numberOfMessagesInRun = messageRunId ? runMetadata?.countByRunId.get(messageRunId) : void 0;
|
|
6031
|
-
const isInLatestRun = messageRunId === void 0 ? void 0 : messageRunId === runMetadata?.latestRunId;
|
|
6032
5998
|
if (renderCustomMessage) elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedCustomMessage, {
|
|
6033
5999
|
message,
|
|
6034
6000
|
position: "before",
|
|
6035
6001
|
renderCustomMessage,
|
|
6036
|
-
stateSnapshot
|
|
6037
|
-
numberOfMessagesInRun,
|
|
6038
|
-
isInLatestRun,
|
|
6039
|
-
isRunning
|
|
6002
|
+
stateSnapshot
|
|
6040
6003
|
}, `${message.id}-custom-before`));
|
|
6041
6004
|
if (message.role === "assistant") elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(MemoizedAssistantMessage, {
|
|
6042
6005
|
message,
|
|
@@ -6065,10 +6028,7 @@ function CopilotChatMessageView({ messages = [], assistantMessage, userMessage,
|
|
|
6065
6028
|
message,
|
|
6066
6029
|
position: "after",
|
|
6067
6030
|
renderCustomMessage,
|
|
6068
|
-
stateSnapshot
|
|
6069
|
-
numberOfMessagesInRun,
|
|
6070
|
-
isInLatestRun,
|
|
6071
|
-
isRunning
|
|
6031
|
+
stateSnapshot
|
|
6072
6032
|
}, `${message.id}-custom-after`));
|
|
6073
6033
|
if (copilotkit.intelligence !== void 0 && message.role === "assistant") elements.push(/* @__PURE__ */ (0, react_jsx_runtime.jsx)(IntelligenceIndicator, {
|
|
6074
6034
|
message,
|
|
@@ -10430,4 +10390,4 @@ Object.defineProperty(exports, 'useToast', {
|
|
|
10430
10390
|
return useToast;
|
|
10431
10391
|
}
|
|
10432
10392
|
});
|
|
10433
|
-
//# sourceMappingURL=copilotkit-
|
|
10393
|
+
//# sourceMappingURL=copilotkit-XGd8L2jL.cjs.map
|