import { DIMENSION_LIMITS } from '../domain/classifier'; import type { SimulationState } from '../domain/types'; function Verdict({ pass, skipped = false }: { pass?: boolean; skipped?: boolean }) { if (skipped) { return SKIPPED; } if (pass === undefined) { return PENDING; } return {pass ? 'PASS' : 'FAIL'}; } export default function ClassificationPanel({ simulation }: { simulation: SimulationState }) { const current = simulation.currentItem; const result = current?.classification; const item = current?.item; const dimensions = item?.dimensionsMm; const isOversizedAndRound = Boolean(result && !result.dimensionsPass && !result.roundnessPass); const lowConfidence = Boolean(item && item.confidence < 0.65); return (

Classification rules

Decision proof

Step 1: Dimensions check

Allowed: W {DIMENSION_LIMITS.min.width}-{DIMENSION_LIMITS.max.width} mm, D {DIMENSION_LIMITS.min.depth}-{DIMENSION_LIMITS.max.depth} mm, H {DIMENSION_LIMITS.min.height}-{DIMENSION_LIMITS.max.height} mm.

Actual: {dimensions ? `${dimensions.width} x ${dimensions.depth} x ${dimensions.height} mm` : 'waiting for item'}

Step 2: Roundness check

Roundness threshold for D: value >= {DIMENSION_LIMITS.roundnessThreshold}.

Actual roundness: {item ? item.roundness.toFixed(2) : 'waiting for item'}

Step 3: Category decision{result ? result.category : '-'}

{result ? result.reason : 'Run a scenario to classify the current item.'}

{isOversizedAndRound ?

Приоритет: C, потому что габариты проверяются первыми.

: null} {lowConfidence ?

CV confidence низкий, решение подтверждено rule-based fallback.

: null}
); }