fix(sonar): share status setter between LLM and OCR panels (javascript:S4144)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
544db8883c
commit
7df275b378
@ -307,6 +307,14 @@
|
|||||||
new MutationObserver(() => picker.syncFromSelect(id)).observe(sel, { childList: true });
|
new MutationObserver(() => picker.syncFromSelect(id)).observe(sel, { childList: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function makeStatusSetter(statusEl) {
|
||||||
|
return function setStatus(msg, cls) {
|
||||||
|
if (!statusEl) return;
|
||||||
|
statusEl.textContent = msg || '';
|
||||||
|
statusEl.className = 'llm-active-status' + (cls ? ' ' + cls : '');
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// ── Active Language Model (global picker) ───────────────────────────────
|
// ── Active Language Model (global picker) ───────────────────────────────
|
||||||
(function initActiveLlmPanel() {
|
(function initActiveLlmPanel() {
|
||||||
upgradeModelSelect('llm-active-model');
|
upgradeModelSelect('llm-active-model');
|
||||||
@ -316,11 +324,7 @@
|
|||||||
const statusEl = $('llm-active-status');
|
const statusEl = $('llm-active-status');
|
||||||
if (!urlInp || !modelSel) return;
|
if (!urlInp || !modelSel) return;
|
||||||
|
|
||||||
function setStatus(msg, cls) {
|
const setStatus = makeStatusSetter(statusEl);
|
||||||
if (!statusEl) return;
|
|
||||||
statusEl.textContent = msg || '';
|
|
||||||
statusEl.className = 'llm-active-status' + (cls ? ' ' + cls : '');
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fetchModels(url, apiKey) {
|
async function fetchModels(url, apiKey) {
|
||||||
url = (url || urlInp.value.trim());
|
url = (url || urlInp.value.trim());
|
||||||
@ -459,11 +463,7 @@
|
|||||||
const enabledCb = $('ocr-active-enabled');
|
const enabledCb = $('ocr-active-enabled');
|
||||||
if (!urlInp || !modelSel) return;
|
if (!urlInp || !modelSel) return;
|
||||||
|
|
||||||
function setStatus(msg, cls) {
|
const setStatus = makeStatusSetter(statusEl);
|
||||||
if (!statusEl) return;
|
|
||||||
statusEl.textContent = msg || '';
|
|
||||||
statusEl.className = 'llm-active-status' + (cls ? ' ' + cls : '');
|
|
||||||
}
|
|
||||||
|
|
||||||
async function fetchModels(url) {
|
async function fetchModels(url) {
|
||||||
url = (url || urlInp.value.trim());
|
url = (url || urlInp.value.trim());
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user