Skip to content
Draft
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
44 changes: 42 additions & 2 deletions webview-ui/src/components/chat/ChatView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
const [enableButtons, setEnableButtons] = useState<boolean>(false)
const [primaryButtonText, setPrimaryButtonText] = useState<string | undefined>(undefined)
const [secondaryButtonText, setSecondaryButtonText] = useState<string | undefined>(undefined)
const [showSeeAllChangesButton, setShowSeeAllChangesButton] = useState<boolean>(false)
const [_didClickCancel, setDidClickCancel] = useState(false)
const virtuosoRef = useRef<VirtuosoHandle>(null)
const [expandedRows, setExpandedRows] = useState<Record<number, boolean>>({})
Expand Down Expand Up @@ -360,6 +361,9 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
setEnableButtons(!isPartial)
setPrimaryButtonText(t("chat:startNewTask.title"))
setSecondaryButtonText(undefined)
// Show "See All Changes" button if there are checkpoints
const hasCheckpoints = messages.some((msg) => msg.say === "checkpoint_saved")
setShowSeeAllChangesButton(!isPartial && hasCheckpoints)
break
case "resume_task":
setSendingDisabled(false)
Expand Down Expand Up @@ -410,6 +414,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
setEnableButtons(false)
setPrimaryButtonText(undefined)
setSecondaryButtonText(undefined)
setShowSeeAllChangesButton(false)
break
case "api_req_finished":
case "error":
Expand Down Expand Up @@ -811,6 +816,26 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
[clineAsk, startNewTask, isStreaming, setDidClickCancel],
)

// Handler for "See All Changes" button
const handleSeeAllChangesClick = useCallback(() => {
// Find the first checkpoint hash to use for the "full" diff
const checkpoints = messagesRef.current.filter((msg) => msg.say === "checkpoint_saved")
if (checkpoints.length > 0) {
// The checkpointDiff with mode "full" needs the first checkpoint's hash as commitHash
// It will compare from the first checkpoint to current workspace
const firstCheckpointHash = checkpoints[0].text
if (firstCheckpointHash) {
vscode.postMessage({
type: "checkpointDiff",
payload: {
commitHash: firstCheckpointHash,
mode: "full",
},
})
}
}
}, [])

const { info: model } = useSelectedModel(apiConfiguration)

const selectImages = useCallback(() => vscode.postMessage({ type: "selectImages" }), [])
Expand Down Expand Up @@ -1410,7 +1435,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
vscode.postMessage({ type: "condenseTaskContextRequest", text: taskId })
}

const areButtonsVisible = showScrollToBottom || primaryButtonText || secondaryButtonText
const areButtonsVisible = showScrollToBottom || primaryButtonText || secondaryButtonText || showSeeAllChangesButton

return (
<div
Expand Down Expand Up @@ -1559,12 +1584,27 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
<Button
variant="primary"
disabled={!enableButtons}
className={secondaryButtonText ? "flex-1 mr-[6px]" : "flex-[2] mr-0"}
className={
secondaryButtonText || showSeeAllChangesButton
? "flex-1 mr-[6px]"
: "flex-[2] mr-0"
}
onClick={() => handlePrimaryButtonClick(inputValue, selectedImages)}>
{primaryButtonText}
</Button>
</StandardTooltip>
)}
{showSeeAllChangesButton && (
<StandardTooltip content={t("chat:seeAllChanges.tooltip")}>
<Button
variant="secondary"
disabled={!enableButtons}
className="flex-1 ml-[6px]"
onClick={handleSeeAllChangesClick}>
{t("chat:seeAllChanges.title")}
</Button>
</StandardTooltip>
)}
{secondaryButtonText && (
<StandardTooltip
content={
Expand Down
4 changes: 4 additions & 0 deletions webview-ui/src/i18n/locales/en/chat.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@
"title": "Start New Task",
"tooltip": "Begin a new task"
},
"seeAllChanges": {
"title": "See All Changes",
"tooltip": "View a diff of all changes made during this task"
},
"proceedAnyways": {
"title": "Proceed Anyways",
"tooltip": "Continue while command executes"
Expand Down
Loading