{
"event": "PreToolUse",
"tool_name": "Read",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/ContentController.php",
"offset": 176,
"limit": 130
}
}
{
"tool_response": {
"type": "text",
"file": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/Controller\/ContentController.php",
"content": " }\n\n $this->view('content.edit', [\n 'title' => 'Auftrag bearbeiten',\n 'order' => $order,\n 'profiles' => $this->repository->findAllProfiles(),\n 'contracts' => $this->repository->findAllContracts(),\n 'structures' => $this->repository->findAllStructures(),\n 'systemPrompts' => $this->repository->findAllSystemPrompts(),\n 'critics' => $this->repository->findAllCritics(),\n 'models' => $this->modelRegistry->getChatModels(),\n 'collections' => $this->collectionService->getAvailable(),\n ]);\n }\n\n \/**\n * POST \/content\/{id}\/generate - Start async content generation (HTMX)\n *\/\n public function generate(int $id): void\n {\n $this->requireCsrf();\n\n $command = GenerateContentCommand::fromRequest($id, $_POST);\n if (($errors = $command->validate()) !== []) {\n $this->htmxError(implode(' ', $errors));\n\n return;\n }\n\n $result = $this->collectionService->validateWithCompatibility([$command->collection]);\n if (!$result['valid']) {\n $this->htmxError($result['error'] ?? 'Collection-Fehler');\n\n return;\n }\n\n \/\/ Set status to generating and start async\n $this->repository->updateGenerationStatus($id, 'generating');\n $this->generateUseCase->generateAsync($id, $command->model, $result['collections'][0], $command->contextLimit);\n\n \/\/ Return polling partial\n $this->view('content.partials.generating', ['orderId' => $id]);\n }\n\n \/**\n * GET \/content\/{id}\/generation-status - Poll generation status (HTMX)\n *\/\n public function generationStatus(int $id): void\n {\n $order = $this->repository->findOrder($id);\n if ($order === null) {\n $this->htmxError('Auftrag nicht gefunden');\n\n return;\n }\n\n $status = $order['generation_status'] ?? 'idle';\n\n if ($status === 'completed') {\n $version = $this->repository->findLatestVersion($id);\n if ($version !== null) {\n \/\/ Reset status to idle after showing result\n $this->repository->updateGenerationStatus($id, 'idle');\n $this->renderVersionPartial([\n 'content' => $version['content'],\n 'sources' => $this->repository->findSourcesByOrder($id),\n 'version_number' => $version['version_number'],\n ]);\n\n return;\n }\n }\n\n if ($status === 'failed') {\n \/\/ Reset status after showing error\n $error = $order['generation_error'] ?? 'Unbekannter Fehler';\n $this->repository->updateGenerationStatus($id, 'idle');\n $this->htmxError('Generierung fehlgeschlagen: ' . $error);\n\n return;\n }\n\n if ($status === 'generating' || $status === 'queued') {\n \/\/ Still generating - return polling partial with log\n $this->view('content.partials.generating', [\n 'orderId' => $id,\n 'log' => $order['generation_log'] ?? '',\n 'step' => $order['generation_step'] ?? '',\n ]);\n\n return;\n }\n\n \/\/ Status is idle - return empty (nothing happening)\n $this->html('');\n }\n\n \/**\n * POST \/content\/{id}\/critique - Start async critique round (HTMX)\n *\/\n public function critique(int $id): void\n {\n $this->requireCsrf();\n\n $version = $this->repository->findLatestVersion($id);\n if ($version === null) {\n $this->htmxError('Keine Version vorhanden.');\n\n return;\n }\n\n \/\/ Set status to critiquing and start async\n $this->repository->updateCritiqueStatus($id, 'critiquing');\n $this->generateUseCase->critiqueAsync($id, $version['id'], $_POST['model'] ?? 'claude-opus-4-5-20251101');\n\n \/\/ Return polling partial\n $this->view('content.partials.critiquing-live', ['orderId' => $id]);\n }\n\n \/**\n * GET \/content\/{id}\/critique-status - Poll critique status (HTMX)\n *\/\n public function critiqueStatus(int $id): void\n {\n $order = $this->repository->findOrder($id);\n if ($order === null) {\n $this->htmxError('Auftrag nicht gefunden');\n\n return;\n }",
"numLines": 130,
"startLine": 176,
"totalLines": 435
}
}
}