classifyFieldViaProxy function exported ✓ 100.0%
Last updated: 2026-03-03T11:48:01.810Z
Location
Metrics
LOC: 22
Complexity: 6
Params: 2
Coverage: 100.0% (8/8 lines, 8x executed)
Signature
classifyFieldViaProxy(
input: FieldClassifierInput,
): : Promise<FieldClassifierOutput | null>
Summary
Classifies a form field by sending its extracted HTML context to the background service worker for Chrome AI classification.
Source Code
export async function classifyFieldViaProxy(
input: FieldClassifierInput,
): Promise<FieldClassifierOutput | null> {
try {
const result = await chrome.runtime.sendMessage({
type: "AI_CLASSIFY_FIELD",
payload: input,
});
if (result && typeof result === "object" && "fieldType" in result) {
log.debug(
`AI_CLASSIFY_FIELD → ${result.fieldType} (${((result.confidence ?? 0) * 100).toFixed(0)}%)`,
);
return result as FieldClassifierOutput;
}
return null;
} catch (err) {
log.warn("Erro ao classificar campo via proxy:", err);
return null;
}
}
No outgoing dependencies.
Impact (Incoming)
| Source | Type |
|---|---|
| getContextHtml | uses |