Quelltext des aktuellen Standes
<?php $this->layout('layouts/admin', [
'page_title' => 'KI-Integration – Feedback',
'current_admin_page' => 'ai-chat'
]); ?>
<div class="settings-page">
<?= $this->partial('ai-chat-tabs', ['active' => 'feedback']) ?>
<?php
$up = (int)($stats['up'] ?? 0);
$down = (int)($stats['down'] ?? 0);
$total = (int)($stats['total'] ?? 0);
$rate = $total > 0 ? round($up / $total * 100) : 0;
?>
<section class="settings-card">
<div class="settings-card-header">
<span class="settings-card-icon">👍</span>
<div>
<h2><?= $this->te('Antwort-Feedback') ?></h2>
<p class="settings-card-desc"><?= $this->te('Bewertungen der Nutzer auf KI-Antworten.') ?></p>
</div>
</div>
<div class="settings-card-body">
<div style="display:flex;gap:1.5rem;flex-wrap:wrap">
<div><strong style="font-size:1.6rem;color:var(--green-700)"><?= $up ?></strong><br><?= $this->te('👍 Hilfreich') ?></div>
<div><strong style="font-size:1.6rem;color:var(--red-700)"><?= $down ?></strong><br><?= $this->te('👎 Nicht hilfreich') ?></div>
<div><strong style="font-size:1.6rem"><?= $rate ?> %</strong><br><?= $this->te('Zufriedenheit') ?></div>
<div><strong style="font-size:1.6rem"><?= $total ?></strong><br><?= $this->te('Bewertungen gesamt') ?></div>
</div>
</div>
</section>
<section class="settings-card">
<div class="settings-card-header">
<span class="settings-card-icon">🔎</span>
<div>
<h2><?= $this->te('Zuletzt negativ bewertete Antworten') ?></h2>
<p class="settings-card-desc"><?= $this->te('Ansatzpunkte, um Prompt oder Datenbasis zu verbessern.') ?></p>
</div>
</div>
<div class="settings-card-body">
<?php if (empty($negative)): ?>
<p><?= $this->te('Keine negativen Bewertungen vorhanden.') ?></p>
<?php else: ?>
<table class="data-table" style="width:100%">
<thead>
<tr>
<th scope="col"><?= $this->te('Datum') ?></th>
<th scope="col"><?= $this->te('Nutzer') ?></th>
<th scope="col"><?= $this->te('Frage') ?></th>
<th scope="col"><?= $this->te('Antwort (Auszug)') ?></th>
</tr>
</thead>
<tbody>
<?php foreach ($negative as $row): ?>
<tr>
<td style="white-space:nowrap"><?= htmlspecialchars(date('d.m.Y H:i', strtotime((string)$row['created_at']))) ?></td>
<td><?= htmlspecialchars((string)($row['display_name'] ?? '–')) ?></td>
<td><?= htmlspecialchars(mb_substr((string)($row['question'] ?? ''), 0, 160)) ?></td>
<td><?= htmlspecialchars(mb_substr((string)($row['answer'] ?? ''), 0, 220)) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
</div>
</section>
</div>