feat(tools): converge two-tier Quick/Pro selector onto .no fork

Port the dobetterlegal-tools two-tier quality stack to dobetternorge.no:
QUALITY_TIERS registry + resolveTier (ToolModels), dbnToolsResolveToolRun
(bootstrap), tier read+charge in the 6 analytical endpoints, Quick/Pro
UI + payload.tier on the 6 tool pages/JS, and the bounded
corpusContextForSummarize RAG fix (per-passage trim + total budget +
reranker_enabled). Back-compat: requests without `tier` keep legacy
engine behavior.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-15 12:23:46 +02:00
parent b217f18118
commit a8b1bb87a6
21 changed files with 339 additions and 103 deletions
+9 -11
View File
@@ -55,7 +55,7 @@
roleCustom: document.getElementById('bvjRoleCustom'),
slices: Array.from(document.querySelectorAll('.adv-slice')),
langButtons: Array.from(document.querySelectorAll('#bvjLangSwitcher .lang-btn')),
engineRadios: Array.from(document.querySelectorAll('input[name="bvjEngine"]')),
tierRadios: Array.from(document.querySelectorAll('input[name="bvjTier"]')),
subQ: document.getElementById('bvjSubQ'),
subQVal: document.getElementById('bvjSubQValue'),
chunkLimit: document.getElementById('bvjChunkLimit'),
@@ -186,9 +186,9 @@
};
}
function getEngine() {
const checked = els.engineRadios.find((r) => r.checked);
return checked ? checked.value : 'azure_mini';
function getTier() {
const checked = els.tierRadios.find((r) => r.checked);
return checked ? checked.value : 'quick';
}
// ── File upload ────────────────────────────────────────────────────────────
@@ -385,13 +385,11 @@
return;
}
const engine = getEngine();
const tier = getTier();
const additionalNotes = (els.notes ? els.notes.value : '').trim();
const expectedDuration = engine === 'azure_full'
? '90180 seconds with Azure gpt-4o'
: (engine === 'gpu' ? '4590 seconds on GPU'
: (engine === 'dbn_legal' ? '60120 seconds with Norwegian specialist'
: '3060 seconds with Azure gpt-4o-mini'));
const expectedDuration = tier === 'pro'
? '90180 seconds with Claude Sonnet'
: '3060 seconds with Claude Haiku';
setStatus(`Analysing document for ${advocateRole}… (${expectedDuration})`, 'busy');
els.runButton.disabled = true;
@@ -403,7 +401,7 @@
const payload = {
advocate_role: advocateRole,
engine,
tier,
language: lang,
slices,
controls: getControls(),