Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/web-ui/src/flow_chat/components/modern/VirtualMessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1553,15 +1553,15 @@ export const VirtualMessageList = forwardRef<VirtualMessageListRef>((_, ref) =>
}, [activeSession, isProcessing]);

const scrollToLatestEndPositionInternal = useCallback((behavior: 'auto' | 'smooth') => {
if (virtuosoRef.current && virtualItems.length > 0) {
const scroller = scrollerElementRef.current;
if (scroller) {
clearAllBottomReservationsForUserNavigation();
virtuosoRef.current.scrollToIndex({
index: virtualItems.length - 1,
align: 'end',
scroller.scrollTo({
top: Math.max(0, scroller.scrollHeight - scroller.clientHeight),
behavior,
});
}
}, [clearAllBottomReservationsForUserNavigation, virtualItems.length]);
}, [clearAllBottomReservationsForUserNavigation]);

const requestTurnPinToTop = useCallback((turnId: string, options?: { behavior?: ScrollBehavior; pinMode?: FlowChatPinTurnToTopMode }) => {
const requestedPinMode = options?.pinMode ?? 'transient';
Expand Down Expand Up @@ -1896,15 +1896,15 @@ export const VirtualMessageList = forwardRef<VirtualMessageListRef>((_, ref) =>
});

const scrollToPhysicalBottomAndClearPin = useCallback(() => {
if (virtuosoRef.current && virtualItems.length > 0) {
const scroller = scrollerElementRef.current;
if (scroller) {
clearAllBottomReservationsForUserNavigation();
virtuosoRef.current.scrollToIndex({
index: virtualItems.length - 1,
align: 'end',
scroller.scrollTo({
top: Math.max(0, scroller.scrollHeight - scroller.clientHeight),
behavior: 'smooth',
});
}
}, [clearAllBottomReservationsForUserNavigation, virtualItems.length]);
}, [clearAllBottomReservationsForUserNavigation]);

const scrollToLatestEndPosition = useCallback(() => {
enterFollowOutput('jump-to-latest');
Expand Down
13 changes: 7 additions & 6 deletions src/web-ui/src/flow_chat/utils/flowChatScrollLayout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const SCROLL_TO_LATEST_INPUT_CLEARANCE_PX = 6;

const FALLBACK_INPUT_BLOCK_ACTIVE_PX = 96;
const FALLBACK_INPUT_BLOCK_COLLAPSED_PX = 54;
const NORMAL_INPUT_BLOCK_SAFE_PX = 96;

/**
* Height of the Virtuoso footer spacer needed so the last message clears the floating input.
Expand All @@ -23,11 +24,11 @@ export function computeFlowChatInputStackFooterPx(
measuredInputHeight: number,
isInputActive: boolean,
): number {
const inputBlock =
measuredInputHeight > 0
? measuredInputHeight
: isInputActive
? FALLBACK_INPUT_BLOCK_ACTIVE_PX
: FALLBACK_INPUT_BLOCK_COLLAPSED_PX;
const measuredInputBlock = measuredInputHeight > 0
? measuredInputHeight
: isInputActive
? FALLBACK_INPUT_BLOCK_ACTIVE_PX
: FALLBACK_INPUT_BLOCK_COLLAPSED_PX;
const inputBlock = Math.max(measuredInputBlock, NORMAL_INPUT_BLOCK_SAFE_PX);
return inputBlock + CHAT_INPUT_DROP_ZONE_BOTTOM_PX + FLOWCHAT_MESSAGE_TAIL_CLEARANCE_PX;
}
Loading