Fix Korrespond stream disconnect: emit progress before legal check

The dbnToolsRunLegalCheck call blocks for 30-120s with no output,
causing the H2 idle stream timeout (~60s) to drop the connection.

Fix: emit 'Verifying legal authorities...' progress event just before
the legal check to reset the idle timer. Also reduce legal check
timeouts from 120s/60s to 45s/30s so the call completes within the
new 60s window even if LiteLLM is slow.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-22 19:26:45 +02:00
parent b014638f39
commit e3645ba908
2 changed files with 12 additions and 3 deletions
+2 -2
View File
@@ -949,7 +949,7 @@ function dbnToolsRunLegalCheck(string $brief, string $docType): array
'model' => 'dbn-legal-agent-v3',
'temperature' => 0.1,
'max_tokens' => 350,
'timeout' => 120,
'timeout' => 45,
// No 'json' key — plain narrative, no response_format flag
];
@@ -977,7 +977,7 @@ function dbnToolsRunLegalCheck(string $brief, string $docType): array
['role' => 'system', 'content' => $sysMsg],
['role' => 'user', 'content' => $question],
],
array_merge($opts, ['model' => 'qwen2.5:7b', 'timeout' => 60])
array_merge($opts, ['model' => 'qwen2.5:7b', 'timeout' => 30])
);
$text = trim((string)($fallback['choices'][0]['message']['content'] ?? ''));
} catch (Throwable $e) {