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
+9
View File
@@ -118,6 +118,14 @@ try {
$emit('progress', ['step' => 'synthesising', 'detail' => 'Synthesising overall assessment…']);
$synth = $agent->synthesise($answered, $language, $docType);
$legalCheck = [];
try {
$legalCheck = dbnToolsRunLegalCheck(
mb_strimwidth((string)($synth['overall_assessment'] ?? ''), 0, 800),
$docType
);
} catch (Throwable) {}
$result = [
'ok' => true,
'issues' => $answered,
@@ -126,6 +134,7 @@ try {
'disclaimer' => $synth['disclaimer'],
'doc_type' => $docType,
'model' => 'dbn-legal-agent-v3',
'legal_check' => $legalCheck,
'latency_ms' => (int)round((microtime(true) - $startTime) * 1000),
];
if ($ftRemaining >= 0) {