Merge pull request #7677 from continuedev/dallin/con-3851-persist-response-actions-space
fix: HOTFIX response actions disappearing and causing jumping while streaming
This commit is contained in:
commit
28b3491191
1 changed files with 8 additions and 21 deletions
|
|
@ -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 && <ThinkingIndicator historyItem={props.item} />}
|
||||
</div>
|
||||
|
||||
{shouldRenderResponseAction() && !isStreaming && (
|
||||
{showResponseActions && (
|
||||
<div
|
||||
className={`mt-2 h-7 transition-opacity duration-300 ease-in-out ${isBeforeLatestSummary ? "opacity-35" : ""}`}
|
||||
className={`mt-2 h-7 transition-opacity duration-300 ease-in-out ${isBeforeLatestSummary || isStreaming ? "opacity-35" : ""} ${isStreaming && "pointer-events-none cursor-not-allowed"}`}
|
||||
>
|
||||
<ResponseActions
|
||||
isTruncated={isTruncated}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue