From 32a740d0fee1ee24356ab0320dcf69d4f99f324d Mon Sep 17 00:00:00 2001 From: Vukasin Date: Tue, 3 Jun 2025 15:04:53 +0200 Subject: [PATCH] fix: remove redundancy in tool step control --- .../thread/tool-call-side-panel.tsx | 150 ++++++++---------- 1 file changed, 70 insertions(+), 80 deletions(-) diff --git a/frontend/src/components/thread/tool-call-side-panel.tsx b/frontend/src/components/thread/tool-call-side-panel.tsx index 1f268cd9..e932ae6b 100644 --- a/frontend/src/components/thread/tool-call-side-panel.tsx +++ b/frontend/src/components/thread/tool-call-side-panel.tsx @@ -299,6 +299,52 @@ export function ToolCallSidePanel({ internalNavigate(totalCalls - 1, 'user_explicit'); }, [totalCalls, internalNavigate]); + const renderStatusButton = React.useCallback(() => { + const baseClasses = "flex items-center justify-center gap-1.5 px-2 py-0.5 rounded-full w-[116px]"; + const dotClasses = "w-1.5 h-1.5 rounded-full"; + const textClasses = "text-xs font-medium"; + + if (isLiveMode) { + if (agentStatus === 'running') { + return ( +
+
+ Live Updates +
+ ); + } else { + return ( +
+
+ Latest Tool +
+ ); + } + } else { + if (agentStatus === 'running') { + return ( +
+
+ Jump to Live +
+ ); + } else { + return ( +
+
+ Jump to Latest +
+ ); + } + } + }, [isLiveMode, agentStatus, jumpToLive, jumpToLatest]); + const handleSliderChange = React.useCallback(([newValue]: [number]) => { const targetSnapshot = completedToolCalls[newValue]; if (targetSnapshot) { @@ -637,43 +683,9 @@ export function ToolCallSidePanel({
- {!isMobile && ( -
-
-
- -
- - {getUserFriendlyToolName(currentToolName)} {isStreaming && `(Running${dots})`} - -
- -
- {isLiveMode && agentStatus === 'running' && ( -
-
- Live -
- )} - {!isLiveMode && agentStatus !== 'running' && ( -
-
- Live -
- )} - - Step {displayIndex + 1} of {displayTotalCalls} - -
-
- )} - {isMobile ? (
-
- {isLiveMode && agentStatus === 'running' ? ( -
-
- Live -
- ) : ( -
-
- Live -
- )} - - - {displayIndex + 1} / {displayTotalCalls} - {isCurrentToolStreaming && totalCompletedCalls > 0 && ( - • Running - )} +
+ + {displayIndex + 1}/{displayTotalCalls} + {renderStatusButton()}
) : ( -
+
+ + {displayIndex + 1}/{displayTotalCalls} +
-
- {(showJumpToLive || showJumpToLatest) && ( -
- {showJumpToLive && ( - - )} - {showJumpToLatest && ( - - )} -
- )} - +
+ +
+ {renderStatusButton()} +
)}