{
"event": "PreToolUse",
"tool_name": "Edit",
"tool_input": {
"file_path": "\/var\/www\/dev.campus.systemische-tools.de\/src\/View\/chat\/partials\/response.php",
"old_string": "<span class=\"chat-source__score\"><?= round(($source['score'] ?? 0) * 100) ?>%<\/span>",
"new_string": "<span class=\"chat-source__score\"><?= round(($source['score'] ?? 0) * \\Domain\\Constants::PERCENT_FULL) ?>%<\/span>"
}
}
{
"tool_response": {
"filePath": "\/var\/www\/dev.campus.systemische-tools.de\/src\/View\/chat\/partials\/response.php",
"oldString": "<span class=\"chat-source__score\"><?= round(($source['score'] ?? 0) * 100) ?>%<\/span>",
"newString": "<span class=\"chat-source__score\"><?= round(($source['score'] ?? 0) * \\Domain\\Constants::PERCENT_FULL) ?>%<\/span>",
"originalFile": "<?php\n\/**\n * HTMX Response Partial - Renders both user question and assistant response\n * Uses same CSS classes as index.php for consistent styling\n *\n * @var string $question The user's question\n * @var array $result AI response with 'answer', 'sources', 'usage'\n * @var string $model The model used\n * @var string $formattedAnswer Pre-formatted answer HTML\n *\/\n\n$answer = $formattedAnswer ?? htmlspecialchars($result['answer'] ?? '');\n$sources = $result['sources'] ?? [];\n$usage = $result['usage'] ?? null;\n$isOllama = str_starts_with($model, 'ollama:');\n$modelLabel = $isOllama ? substr($model, 7) : $model;\n\n$inputTokens = (int) ($usage['input_tokens'] ?? 0);\n$outputTokens = (int) ($usage['output_tokens'] ?? 0);\n$cost = ($inputTokens * 0.000015) + ($outputTokens * 0.000075);\n\n$qualityValidation = $result['quality_validation'] ?? null;\n$uniqueId = uniqid('sources-');\n?>\n<!-- User Message -->\n<div class=\"chat-msg chat-msg--user\">\n <div class=\"chat-msg__content\"><?= htmlspecialchars($question) ?><\/div>\n<\/div>\n\n<!-- Assistant Message -->\n<div class=\"chat-msg chat-msg--assistant\">\n <div class=\"chat-msg__content\">\n <?= $answer ?>\n\n <?php if ($qualityValidation !== null): ?>\n <div class=\"chat-quality chat-quality--<?= $qualityValidation['passed'] ? 'passed' : 'failed' ?>\"\n title=\"<?= htmlspecialchars($qualityValidation['details'] ?? '') ?>\">\n <span class=\"chat-quality__icon\"><?= $qualityValidation['passed'] ? '✓' : '⚠' ?><\/span>\n <span class=\"chat-quality__score\"><?= round($qualityValidation['score'] ?? 0) ?>%<\/span>\n <?php if (!empty($qualityValidation['issues'])): ?>\n <div class=\"chat-quality__issues\">\n <strong>Hinweise:<\/strong>\n <ul>\n <?php foreach ($qualityValidation['issues'] as $issue): ?>\n <li><?= htmlspecialchars($issue) ?><\/li>\n <?php endforeach; ?>\n <\/ul>\n <\/div>\n <?php endif; ?>\n <\/div>\n <?php endif; ?>\n\n <?php if (!empty($sources)): ?>\n <div class=\"chat-sources\" id=\"<?= $uniqueId ?>\">\n <button type=\"button\" class=\"chat-sources__toggle\" onclick=\"this.parentElement.classList.toggle('chat-sources--open')\">\n <?= count($sources) ?> Quelle<?= count($sources) > 1 ? 'n' : '' ?> ▾\n <\/button>\n <div class=\"chat-sources__list\">\n <?php foreach ($sources as $source): ?>\n <div class=\"chat-source\">\n <div class=\"chat-source__header\">\n <?php if (!empty($source['collection'])): ?>\n <span class=\"chat-source__collection\">[<?= htmlspecialchars($source['collection']) ?>]<\/span>\n <?php endif; ?>\n <span class=\"chat-source__title\"><?= htmlspecialchars($source['title'] ?? 'Unbekannt') ?><\/span>\n <span class=\"chat-source__score\"><?= round(($source['score'] ?? 0) * 100) ?>%<\/span>\n <\/div>\n <?php if (!empty($source['content'])): ?>\n <div class=\"chat-source__content\">\"<?= htmlspecialchars(mb_substr($source['content'], 0, 200)) ?><?= mb_strlen($source['content']) > 200 ? '...' : '' ?>\"<\/div>\n <?php endif; ?>\n <\/div>\n <?php endforeach; ?>\n <\/div>\n <\/div>\n <?php endif; ?>\n\n <div class=\"chat-msg__meta\">\n <span><?= htmlspecialchars($modelLabel) ?><\/span>\n <?php if (!$isOllama && ($inputTokens > 0 || $outputTokens > 0)): ?>\n <span class=\"chat-msg__tokens\">↓<?= number_format($inputTokens) ?> ↑<?= number_format($outputTokens) ?><\/span>\n <span class=\"chat-msg__cost\">~$<?= number_format($cost, 4) ?><\/span>\n <?php elseif ($isOllama): ?>\n <span class=\"chat-msg__local\">lokal<\/span>\n <?php endif; ?>\n <\/div>\n <\/div>\n<\/div>\n",
"structuredPatch": [
{
"oldStart": 63,
"oldLines": 7,
"newStart": 63,
"newLines": 7,
"lines": [
" <span class=\"chat-source__collection\">[<?= htmlspecialchars($source['collection']) ?>]<\/span>",
" <?php endif; ?>",
" <span class=\"chat-source__title\"><?= htmlspecialchars($source['title'] ?? 'Unbekannt') ?><\/span>",
"- <span class=\"chat-source__score\"><?= round(($source['score'] ?? 0) * 100) ?>%<\/span>",
"+ <span class=\"chat-source__score\"><?= round(($source['score'] ?? 0) * \\Domain\\Constants::PERCENT_FULL) ?>%<\/span>",
" <\/div>",
" <?php if (!empty($source['content'])): ?>",
" <div class=\"chat-source__content\">\"<?= htmlspecialchars(mb_substr($source['content'], 0, 200)) ?><?= mb_strlen($source['content']) > 200 ? '...' : '' ?>\"<\/div>"
]
}
],
"userModified": false,
"replaceAll": false
}
}