optimize intention

This commit is contained in:
team 1
2026-04-14 19:54:42 +02:00
parent 0fead8983e
commit c8d7ecf1f5
4 changed files with 29 additions and 11 deletions

View File

@@ -58,12 +58,16 @@ final readonly class AskSseController
// ---------------------------------------------------------
// 🔥 FIXED: Sende Chunks direkt (behält \n!)
// ---------------------------------------------------------
foreach ($this->agentRunner->run($prompt, $clientId,true) as $chunk) {
// Normalize line endings
$chunk = str_replace(["\r\n", "\r"], "\n", $chunk);
try {
foreach ($this->agentRunner->run($prompt, $clientId, true) as $chunk) {
$chunk = str_replace(["\r\n", "\r"], "\n", $chunk);
$this->sendData($chunk);
}
// Sende Chunk direkt mit \n
$this->sendData($chunk);
$this->sendEvent('done', '[DONE]');
} catch (\Throwable $e) {
$this->sendData('<span class="text-danger">❌ Stream abgebrochen: ' . $e->getMessage() . '</span>');
$this->sendEvent('done', '[DONE]');
}
// ---------------------------------------------------------