Files
genshin-assistant/src/lib/ikScanCapabilities.ts
T
AzuTear 639b0b7f59 feat(scanner): add native artifact pipeline
Add native IK-style capture processing, Artifact Inventory, explicit promotion and single-result review. Confirm the three live OCR corrections in the eval corpus and preserve extraction/value separation.
2026-07-09 23:30:42 +02:00

101 lines
3.3 KiB
TypeScript

import type { NativeScannerDataStatus } from "../types/global";
export type IkScanCapabilityId = "artifacts" | "weapons" | "characters" | "materials";
export type IkScanCapabilityStatus = "native_capture" | "catalog_only" | "missing_data";
export interface IkScanCapabilityRow {
id: IkScanCapabilityId;
label: string;
countLabel: string;
status: IkScanCapabilityStatus;
statusLabel: string;
className: "ok" | "warn" | "muted";
detail: string;
}
export function buildIkScanCapabilityRows(data: NativeScannerDataStatus | null | undefined): IkScanCapabilityRow[] {
const valid = Boolean(data?.valid);
return [
capability({
id: "artifacts",
label: "Artifacts",
countLabel: data ? `${data.artifactSets}/${data.artifactPieces}` : "0/0",
valid,
catalogAvailable: Boolean(data?.categories.artifacts.catalogAvailable ?? data?.valid),
nativeCapture: Boolean(data?.categories.artifacts.nativeCaptureSupported ?? data?.categories.artifacts.supported),
detail: "Native 16:9 visible-inventory capture path is implemented for artifact card crops.",
}),
capability({
id: "weapons",
label: "Weapons",
countLabel: String(data?.weapons ?? 0),
valid,
catalogAvailable: Boolean(data?.categories.weapons.catalogAvailable ?? data?.valid),
nativeCapture: Boolean(data?.categories.weapons.nativeCaptureSupported ?? false),
detail: "IK weapon names and GOOD keys are loaded; weapon capture flow still needs category-specific evidence.",
}),
capability({
id: "characters",
label: "Characters",
countLabel: String(data?.characters ?? 0),
valid,
catalogAvailable: Boolean(data?.categories.characters.catalogAvailable ?? data?.valid),
nativeCapture: Boolean(data?.categories.characters.nativeCaptureSupported ?? false),
detail: "IK character names and GOOD keys are loaded; character capture flow still needs category-specific evidence.",
}),
capability({
id: "materials",
label: "Materials",
countLabel: String(data?.materials ?? 0),
valid,
catalogAvailable: Boolean(data?.categories.materials.catalogAvailable ?? data?.valid),
nativeCapture: Boolean(data?.categories.materials.nativeCaptureSupported ?? false),
detail: "IK material names and GOOD keys are loaded; material capture flow still needs category-specific evidence.",
}),
];
}
function capability(input: {
id: IkScanCapabilityId;
label: string;
countLabel: string;
valid: boolean;
catalogAvailable: boolean;
nativeCapture: boolean;
detail: string;
}): IkScanCapabilityRow {
if (!input.valid || !input.catalogAvailable) {
return {
id: input.id,
label: input.label,
countLabel: input.countLabel,
status: "missing_data",
statusLabel: "Daten fehlen",
className: "warn",
detail: "IK inventorylists are incomplete or unavailable.",
};
}
if (input.nativeCapture) {
return {
id: input.id,
label: input.label,
countLabel: input.countLabel,
status: "native_capture",
statusLabel: "Native Capture",
className: "ok",
detail: input.detail,
};
}
return {
id: input.id,
label: input.label,
countLabel: input.countLabel,
status: "catalog_only",
statusLabel: "Katalog bereit",
className: "muted",
detail: input.detail,
};
}