loadModelStatus function domain
Last updated: 2026-03-04T23:21:38.430Z
Location
Metrics
LOC: 35
Complexity: 6
Params: 0
Signature
loadModelStatus(): : Promise<void>
Source Code
async function loadModelStatus(): Promise<void> {
const statusText = document.getElementById("model-status-text");
const deleteBtn = document.getElementById(
"btn-delete-model",
) as HTMLButtonElement | null;
if (!statusText) return;
const result = (await chrome.runtime.sendMessage({
type: "GET_RUNTIME_MODEL_META",
})) as { exists: boolean; meta: TrainingMeta | null } | null;
if (!result?.exists || !result.meta) {
statusText.innerHTML = `
<strong style="color: var(--text-muted)">${t("noRuntimeModel")}</strong><br>
${t("noRuntimeModelDesc")}
`;
if (deleteBtn) deleteBtn.style.display = "none";
return;
}
const m = result.meta;
const dateStr = new Date(m.trainedAt).toLocaleString();
const acc = (m.finalAccuracy * 100).toFixed(1);
statusText.innerHTML = `
<span style="color:#4ade80; font-weight:600;">✅ ${t("runtimeModelActiveTitle")}</span><br>
${t("trainedOnLabel")}: <strong>${dateStr}</strong> |
${t("accuracyLabel")}: <strong>${acc}%</strong> |
${t("epochsLabel")}: <strong>${m.epochs}</strong><br>
${t("samplesUsedLabel")}: <strong>${m.entriesUsed}</strong> |
${t("vocabLabel")}: <strong>${m.vocabSize}</strong> ${t("ngramsLabel")} |
${t("classesLabel")}: <strong>${m.numClasses}</strong> |
${t("durationLabel")}: <strong>${m.durationMs}ms</strong>
`;
if (deleteBtn) deleteBtn.style.display = "";
}
Dependencies (Outgoing)
| Target | Type |
|---|---|
| FieldType | uses |
| DatasetEntry | uses |
| TrainingProgress | uses |
| TrainingResult | uses |
| TrainingMeta | uses |
| trainModelFromDataset | uses |
| t | uses |
| escapeHtml | uses |
| showToast | uses |
Impact (Incoming)
| Source | Type |
|---|---|
| loadDatasetTab | calls |
| bindDatasetEvents | calls |