diff --git a/frontend/src/components/features/chat/messages.tsx b/frontend/src/components/features/chat/messages.tsx index 74439e17a604..03321d14c929 100644 --- a/frontend/src/components/features/chat/messages.tsx +++ b/frontend/src/components/features/chat/messages.tsx @@ -12,15 +12,22 @@ interface MessagesProps { export const Messages: React.FC = React.memo( ({ messages, isAwaitingUserConfirmation }) => messages.map((message, index) => { + const shouldShowConfirmationButtons = + messages.length - 1 === index && + message.sender === "assistant" && + isAwaitingUserConfirmation; + if (message.type === "error" || message.type === "action") { return ( - +
+ + {shouldShowConfirmationButtons && } +
); } @@ -33,9 +40,7 @@ export const Messages: React.FC = React.memo( {message.imageUrls && message.imageUrls.length > 0 && ( )} - {messages.length - 1 === index && - message.sender === "assistant" && - isAwaitingUserConfirmation && } + {shouldShowConfirmationButtons && } ); }),