Skip to content

Commit 52f4bdf

Browse files
committed
fix(ui): show tool diff as side-by-side before/after for changed tools
The quarantine panel previously rendered the current description as a plain paragraph and, below it, a single diff box that mixed added, removed, and same tokens — making it look like the same text was being shown twice with random green highlights. Split the diff into two labelled boxes so each side only renders its own words: the "Before (approved)" box shows the previous description (with any removed words highlighted red), and the "After (current)" box shows the new description (with added words highlighted green). The plain paragraph is suppressed when a diff is available so the current text is not duplicated above the "After" box. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b85e7db commit 52f4bdf

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

frontend/src/views/ServerDetail.vue

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -347,15 +347,29 @@
347347
{{ tool.status }}
348348
</span>
349349
</div>
350-
<p class="text-sm text-base-content/70 mt-1">{{ tool.description }}</p>
351-
<!-- Show word-level diff for changed tools -->
352-
<div v-if="tool.status === 'changed' && tool.previous_description" class="mt-2 text-xs">
353-
<div class="bg-base-300/50 px-2 py-1.5 rounded font-mono leading-relaxed">
354-
<template v-for="(part, i) in computeWordDiff(tool.previous_description, tool.current_description || tool.description)" :key="i">
355-
<span v-if="part.type === 'removed'" class="bg-error/20 text-error line-through px-0.5 rounded">{{ part.text }}</span>
356-
<span v-else-if="part.type === 'added'" class="bg-success/20 text-success font-semibold px-0.5 rounded">{{ part.text }}</span>
357-
<span v-else>{{ part.text }}</span>
358-
</template>
350+
<p
351+
v-if="tool.status !== 'changed' || !tool.previous_description"
352+
class="text-sm text-base-content/70 mt-1"
353+
>{{ tool.description }}</p>
354+
<!-- Show before/after diff for changed tools -->
355+
<div v-if="tool.status === 'changed' && tool.previous_description" class="mt-2 space-y-2 text-xs">
356+
<div>
357+
<div class="text-[10px] font-semibold uppercase tracking-wide text-base-content/60 mb-1">Before (approved)</div>
358+
<div class="bg-error/5 border border-error/20 px-2 py-1.5 rounded font-mono leading-relaxed">
359+
<template v-for="(part, i) in computeWordDiff(tool.previous_description, tool.current_description || tool.description)" :key="'b'+i">
360+
<span v-if="part.type === 'removed'" class="bg-error/20 text-error font-semibold px-0.5 rounded">{{ part.text }}</span>
361+
<span v-else-if="part.type === 'same'">{{ part.text }}</span>
362+
</template>
363+
</div>
364+
</div>
365+
<div>
366+
<div class="text-[10px] font-semibold uppercase tracking-wide text-base-content/60 mb-1">After (current)</div>
367+
<div class="bg-success/5 border border-success/20 px-2 py-1.5 rounded font-mono leading-relaxed">
368+
<template v-for="(part, i) in computeWordDiff(tool.previous_description, tool.current_description || tool.description)" :key="'a'+i">
369+
<span v-if="part.type === 'added'" class="bg-success/20 text-success font-semibold px-0.5 rounded">{{ part.text }}</span>
370+
<span v-else-if="part.type === 'same'">{{ part.text }}</span>
371+
</template>
372+
</div>
359373
</div>
360374
</div>
361375
</div>

0 commit comments

Comments
 (0)