Fix legal analysis issue extraction for long documents

This commit is contained in:
2026-05-25 19:06:23 +02:00
parent 190f639784
commit 8205a22205
3 changed files with 263 additions and 1 deletions
+20
View File
@@ -353,6 +353,9 @@
if (result.disclaimer) {
topHtml += '<p class="disclaimer-note">' + esc(result.disclaimer) + '</p>';
}
if (Array.isArray(result.legal_check) && result.legal_check.length) {
topHtml += renderLegalCheck(result.legal_check);
}
topHtml += '</section>';
}
@@ -383,6 +386,23 @@
setStatus('');
}
function renderLegalCheck(findings) {
return '<div class="korr-legal-check">'
+ '<h4 class="korr-legal-check__title">Legal threshold check <small>(dbn-legal-agent-v3)</small></h4>'
+ findings.map(function (f) {
var severity = f.severity || 'low';
return '<div class="bvj-red-flag">'
+ '<div class="bvj-red-flag__head">'
+ '<div class="bvj-red-flag__desc">' + esc(f.description || '') + '</div>'
+ '<span class="bvj-severity bvj-severity-' + esc(severity) + '">' + esc(severity) + '</span>'
+ '</div>'
+ (f.legal_basis ? '<span class="bvj-red-flag__legal">' + esc(f.legal_basis) + '</span>' : '')
+ (f.what_to_check ? '<details class="bvj-red-flag__details"><summary>What to verify</summary><p class="bvj-red-flag__check">' + esc(f.what_to_check) + '</p></details>' : '')
+ '</div>';
}).join('')
+ '</div>';
}
// ── Helpers ───────────────────────────────────────────────────────────────
function setBusy(on) {
if (runBtn) runBtn.disabled = on;