From a16accf44357ca39255f8ca5a89dab2d5451f7eb Mon Sep 17 00:00:00 2001 From: Masahiko AMANO Date: Mon, 22 Jun 2026 22:42:14 +0300 Subject: [PATCH] feat(frontend): show keep-to-other distance in the duplicates view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Each action row now shows the perceptual distance (Δn) between the kept file and that file, read from the new per-cluster distances; recomputed live when the survivor pick changes. A transitively-linked pair with no stored distance shows a muted Δ—. --- frontend/src/lib/api/duplicates.ts | 12 ++++- .../src/routes/files/duplicates/+page.svelte | 46 ++++++++++++++++++- 2 files changed, 55 insertions(+), 3 deletions(-) diff --git a/frontend/src/lib/api/duplicates.ts b/frontend/src/lib/api/duplicates.ts index e8753b3..8c3f7d5 100644 --- a/frontend/src/lib/api/duplicates.ts +++ b/frontend/src/lib/api/duplicates.ts @@ -1,9 +1,19 @@ import { api } from '$lib/api/client'; import type { File } from '$lib/api/types'; -/** A group of mutually similar files. */ +/** A stored perceptual-hash (Hamming) distance between two files of a cluster. */ +export interface DuplicatePairDistance { + a: string; + b: string; + distance: number; +} + +/** A group of mutually similar files, with the pairwise distances known between + * them. A file linked into the cluster only transitively may lack a direct + * distance to some others, so that pair is absent. */ export interface DuplicateCluster { files: File[]; + distances?: DuplicatePairDistance[]; } export interface DuplicateClusterPage { diff --git a/frontend/src/routes/files/duplicates/+page.svelte b/frontend/src/routes/files/duplicates/+page.svelte index 3b6eeed..02594b1 100644 --- a/frontend/src/routes/files/duplicates/+page.svelte +++ b/frontend/src/routes/files/duplicates/+page.svelte @@ -1,7 +1,11 @@