diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx index 58754e88eb..8964da91fd 100644 --- a/apps/web/src/components/ChatView.tsx +++ b/apps/web/src/components/ChatView.tsx @@ -71,6 +71,7 @@ import { useTheme } from "../hooks/useTheme"; import { useTurnDiffSummaries } from "../hooks/useTurnDiffSummaries"; import { buildTurnDiffTree, + normalizeFilePath, summarizeTurnDiffStats, type TurnDiffTreeNode, } from "../lib/turnDiffTree"; @@ -3141,16 +3142,13 @@ function hasNonZeroStat(stat: { additions: number; deletions: number }): boolean const DiffStatLabel = memo(function DiffStatLabel(props: { additions: number; deletions: number; - showParentheses?: boolean; }) { - const { additions, deletions, showParentheses = false } = props; + const { additions, deletions } = props; return ( <> - {showParentheses && (} +{additions} / -{deletions} - {showParentheses && )} ); }); @@ -3708,9 +3706,13 @@ const MessagesTimeline = memo(function MessagesTimeline({ type="button" size="xs" variant="outline" - onClick={() => - onOpenTurnDiff(turnSummary.turnId, checkpointFiles[0]?.path) - } + onClick={() => { + const rawPath = checkpointFiles[0]?.path; + onOpenTurnDiff( + turnSummary.turnId, + rawPath ? normalizeFilePath(rawPath) : undefined, + ); + }} > View diff diff --git a/apps/web/src/lib/turnDiffTree.ts b/apps/web/src/lib/turnDiffTree.ts index cd9bfc831f..a7c40176b0 100644 --- a/apps/web/src/lib/turnDiffTree.ts +++ b/apps/web/src/lib/turnDiffTree.ts @@ -39,6 +39,10 @@ function normalizePathSegments(pathValue: string): string[] { .filter((segment) => segment.length > 0); } +export function normalizeFilePath(pathValue: string): string { + return normalizePathSegments(pathValue).join("/"); +} + function compareByName(a: { name: string }, b: { name: string }): number { return a.name.localeCompare(b.name, undefined, SORT_LOCALE_OPTIONS); }