From d9b2b775ecd425b085d36d9794b905c782459faa Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 4 Sep 2024 10:09:21 +0800 Subject: [PATCH 1/2] fix sort messages --- packages/jupyter-ai/src/components/chat-messages.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/jupyter-ai/src/components/chat-messages.tsx b/packages/jupyter-ai/src/components/chat-messages.tsx index c3fc0921a..9fb0525da 100644 --- a/packages/jupyter-ai/src/components/chat-messages.tsx +++ b/packages/jupyter-ai/src/components/chat-messages.tsx @@ -49,11 +49,11 @@ function sortMessages( */ const aOriginTimestamp = - a.type === 'agent' && a.reply_to in timestampsById + "reply_to" in a && a.reply_to in timestampsById ? timestampsById[a.reply_to] : a.time; const bOriginTimestamp = - b.type === 'agent' && b.reply_to in timestampsById + "reply_to" in b && b.reply_to in timestampsById ? timestampsById[b.reply_to] : b.time; From 394d002bdd49614868b5615c5c82ae56f275a766 Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 4 Sep 2024 10:25:39 +0800 Subject: [PATCH 2/2] prettier --- packages/jupyter-ai/src/components/chat-messages.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/jupyter-ai/src/components/chat-messages.tsx b/packages/jupyter-ai/src/components/chat-messages.tsx index 9fb0525da..aaae93a18 100644 --- a/packages/jupyter-ai/src/components/chat-messages.tsx +++ b/packages/jupyter-ai/src/components/chat-messages.tsx @@ -49,11 +49,11 @@ function sortMessages( */ const aOriginTimestamp = - "reply_to" in a && a.reply_to in timestampsById + 'reply_to' in a && a.reply_to in timestampsById ? timestampsById[a.reply_to] : a.time; const bOriginTimestamp = - "reply_to" in b && b.reply_to in timestampsById + 'reply_to' in b && b.reply_to in timestampsById ? timestampsById[b.reply_to] : b.time;