Implement classification redesign

This commit is contained in:
Lars Nolden
2026-09-11 22:46:17 +02:00
parent cc43a2f9a7
commit 87f052a3ea
23 changed files with 1602 additions and 296 deletions
+29 -6
View File
@@ -69,11 +69,11 @@ export function Classification({
<div>
<strong>Review first. Apply only what you choose.</strong>
<p>
Only allowlisted, sanitized fields are sent to the classification
provider. Known identifiers and counterparty names are removed; free
text can still contain sensitive information. Amount sharing is{" "}
{state.settings.include_amount ? "enabled" : "disabled"} in
Settings. AI requests may incur provider charges.
Only identifier-shaped values are redacted before sending. Merchant
and counterparty text, amount, date and currency are sent so the
provider can classify the row. Your own account IBAN, account IDs,
transaction IDs, references and configured private names are never
sent. AI requests may incur provider charges.
</p>
</div>
</div>
@@ -128,8 +128,27 @@ export function Classification({
change.before.tag_ids ??= [];
change.after.tag_ids ??= [];
}
const confidenceRank: Record<string, number> = {
low: 0,
medium: 1,
high: 2,
};
result.changes.sort(
(a, b) =>
(confidenceRank[a.after.classification.confidence || "low"] ??
0) -
(confidenceRank[b.after.classification.confidence || "low"] ??
0),
);
setPreview(result);
setSelected(result.changes.map((c) => c.id));
setSelected(
result.changes
.filter(
(change) =>
change.after.classification.confidence !== "low",
)
.map((change) => change.id),
);
} catch (err) {
setError(err instanceof Error ? err.message : String(err));
} finally {
@@ -286,6 +305,10 @@ export function Classification({
<div>
<strong>{change.description || change.id}</strong>
<small className="muted">{change.id}</small>
<span className="badge neutral">
Confidence:{" "}
{change.after.classification.confidence || "unknown"}
</span>
<div className="diff">
<EnrichmentView
data={state.data}