diff --git a/gui/src/components/StepContainer/StepContainer.tsx b/gui/src/components/StepContainer/StepContainer.tsx index d83d7d9e8..49ae28128 100644 --- a/gui/src/components/StepContainer/StepContainer.tsx +++ b/gui/src/components/StepContainer/StepContainer.tsx @@ -22,9 +22,6 @@ export default function StepContainer(props: StepContainerProps) { const dispatch = useDispatch(); const [isTruncated, setIsTruncated] = useState(false); const isStreaming = useAppSelector((state) => state.session.isStreaming); - const historyItemAfterThis = useAppSelector( - (state) => state.session.history[props.index + 1], - ); const uiConfig = useAppSelector(selectUIConfig); // Calculate dimming and indicator state based on latest summary index @@ -34,22 +31,12 @@ export default function StepContainer(props: StepContainerProps) { const isLatestSummary = latestSummaryIndex !== -1 && props.index === latestSummaryIndex; - const isNextMsgAssistantOrThinking = - historyItemAfterThis?.message.role === "assistant" || - historyItemAfterThis?.message.role === "thinking" || - historyItemAfterThis?.message.role === "tool"; - - const shouldRenderResponseAction = () => { - if (isNextMsgAssistantOrThinking) { - return false; - } - - if (!historyItemAfterThis) { - return !props.item.toolCallStates; - } - - return true; - }; + const historyItemAfterThis = useAppSelector( + (state) => state.session.history[props.index + 1], + ); + const showResponseActions = + (props.isLast || historyItemAfterThis?.message.role === "user") && + !(props.isLast && (isStreaming || props.item.toolCallStates)); useEffect(() => { if (!isStreaming) { @@ -110,9 +97,9 @@ export default function StepContainer(props: StepContainerProps) { {props.isLast && } - {shouldRenderResponseAction() && !isStreaming && ( + {showResponseActions && (