Skip to content

Commit

Permalink
simplify unnecessary display logic (onyx-dot-app#2406)
Browse files Browse the repository at this point in the history
  • Loading branch information
pablonyx authored and rajiv chodisetti committed Oct 2, 2024
1 parent b2fda14 commit a3b7b66
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions web/src/app/chat/ChatPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1965,21 +1965,16 @@ export function ChatPage({
const parentMessage = message.parentMessageId
? messageMap.get(message.parentMessageId)
: null;

if (
(currentSessionRegenerationState?.regenerating &&
message.messageId >
currentSessionRegenerationState?.finalMessageIndex!) ||
(currentSessionChatState == "loading" &&
((i >= messageHistory.length - 2 &&
message.type == "user") ||
(i >= messageHistory.length - 1 &&
!currentSessionRegenerationState?.regenerating)))
) {
return <></>;
}

if (message.type === "user") {
if (
(currentSessionChatState == "loading" &&
i == messageHistory.length - 1) ||
(currentSessionRegenerationState?.regenerating &&
message.messageId >=
currentSessionRegenerationState?.finalMessageIndex!)
) {
return <></>;
}
return (
<div
id={`message-${message.messageId}`}
Expand Down Expand Up @@ -2052,10 +2047,11 @@ export function ChatPage({
: null;

if (
currentSessionRegenerationState?.regenerating &&
currentSessionChatState == "loading" &&
(i == messageHistory.length - 1 ||
currentSessionRegenerationState?.regenerating)
(currentSessionChatState == "loading" &&
i > messageHistory.length - 1) ||
(currentSessionRegenerationState?.regenerating &&
message.messageId >
currentSessionRegenerationState?.finalMessageIndex!)
) {
return <></>;
}
Expand Down

0 comments on commit a3b7b66

Please sign in to comment.