This commit is contained in:
Deleted user 2026-05-27 10:08:13 +08:00 committed by GitHub
commit 90388eb818
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 46 additions and 2 deletions

View file

@ -140,6 +140,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>>({})
@ -369,6 +370,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)
@ -423,6 +427,7 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
setEnableButtons(false)
setPrimaryButtonText(undefined)
setSecondaryButtonText(undefined)
setShowSeeAllChangesButton(false)
break
case "api_req_finished":
case "error":
@ -829,6 +834,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" }), [])
@ -1545,7 +1570,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
@ -1696,12 +1721,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={

View file

@ -34,6 +34,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"