Skip to content

Commit 4fc9982

Browse files
committed
fix: prevent countdown timer from showing in history for answered follow-up questions
- Check if follow-up question has been answered by looking for subsequent messages - For current session, use existing currentFollowUpTs check - For history, check if there are messages after the follow-up question - Fixes #7624
1 parent bcb71db commit 4fc9982

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,26 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
14851485
}
14861486

14871487
// regular message
1488+
// Check if this follow-up question has been answered
1489+
// For current session: check if it matches currentFollowUpTs
1490+
// For history: check if there's a message after this follow-up question
1491+
const isFollowUpAnswered = (() => {
1492+
if (messageOrGroup.ask === "followup") {
1493+
// First check if it's the current follow-up that was just answered
1494+
if (messageOrGroup.ts === currentFollowUpTs) {
1495+
return true
1496+
}
1497+
// For historical messages, check if there's a message after this follow-up
1498+
// If there is, it means the follow-up was answered
1499+
const messageIndex = modifiedMessages.findIndex((msg) => msg.ts === messageOrGroup.ts)
1500+
if (messageIndex !== -1 && messageIndex < modifiedMessages.length - 1) {
1501+
// There's at least one message after this follow-up, so it was answered
1502+
return true
1503+
}
1504+
}
1505+
return false
1506+
})()
1507+
14881508
return (
14891509
<ChatRow
14901510
key={messageOrGroup.ts}
@@ -1498,7 +1518,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
14981518
onSuggestionClick={handleSuggestionClickInRow} // This was already stabilized
14991519
onBatchFileResponse={handleBatchFileResponse}
15001520
onFollowUpUnmount={handleFollowUpUnmount}
1501-
isFollowUpAnswered={messageOrGroup.ts === currentFollowUpTs}
1521+
isFollowUpAnswered={isFollowUpAnswered}
15021522
editable={
15031523
messageOrGroup.type === "ask" &&
15041524
messageOrGroup.ask === "tool" &&

0 commit comments

Comments
 (0)