-
[OPIK-7040] [FE] feat: shared PromptComparison (Compare against baseline/parent) + Optimization runs rename (#7221)
发布于
2026-06-25 12:33:20 +00:00 - [OPIK-7040] [FE] feat: shared PromptComparison wrapper + finish Optimization runs rename
Add a shared PromptComparison component (PromptDiff + a "Compare against:
Baseline / Parent" selector) and the pure buildPromptComparisonTargets
helper, the one missing piece of the Optimization Runs shared kit; the
card/table/sidebar/PromptDiff primitives already exist and are shared, so
later PRs import those directly. Also finish the v2 user-facing
"Optimization studio" -> "Optimization runs" rename. v2 only; the new
component is not wired into any screen yet.Implements OPIK-7040 (part of OPIK_6528).
Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
- fix(optimizations): align PromptComparison target labels with Figma
The compare-against dropdown in Figma (node 705:69927) labels options
"Baseline" / "Parent" (plain). Use "Parent" for a single parent and only
disambiguate to "Parent (Trial #N)" when a candidate has multiple parents
(evolutionary crossover), which the data model allows but the mock omits.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
- feat(optimizations): rebuild PromptComparison 1:1 with Figma diff view
Replace the placeholder Select+PromptDiff wrapper with a Figma-faithful
prompt-diff surface (trial-details design, nodes 705:69927 / 705:70751):- "[target] -> Trial" control: underlined Baseline/Parent dropdown +
Hide/Show diff toggle (git-compare icon) - per-role cards (bg-primary-foreground / border / rounded-md / px-3 py-2),
muted-slate role label, foreground body - line-level diff via the
difflib: unchanged stays full foreground,
added = diff-added-* green band, removed = diff-removed-* struck red
(no word-level pills); reuses the design-system diff tokens which match
the Figma hex exactly and are dark-mode aware
Does NOT touch the shared v1 PromptDiff/TextDiff. New pure helper
promptMessageDiff.ts (role grouping + diff rows) is unit-tested.Built to the Figma spec/tokens; not pixel-verified in a render (no
Storybook, component not yet mounted on a screen).Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
- fix(optimizations): placeholder for media-only prompt blocks
extractMessageContent only returns text blocks, so a media-only message
(image/audio/video) collapsed to "" and rendered a blank role card.
groupMessageContentByRole now falls back to a "[type]" placeholder per
non-text block; text-bearing messages are unchanged. Addresses PR review.Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com
Co-authored-by: Claude Opus 4.8 (1M context) noreply@anthropic.com
下载附件