session-list.php
- Pfad:
src/View/chat/partials/session-list.php - Namespace: -
- Zeilen: 30 | Größe: 1,774 Bytes
- Geändert: 2025-12-27 12:44:14 | Gescannt: 2025-12-31 10:22:15
Code Hygiene Score: 100
- Dependencies: 100 (25%)
- LOC: 100 (20%)
- Methods: 100 (20%)
- Secrets: 100 (15%)
- Classes: 100 (10%)
- Magic Numbers: 100 (10%)
Keine Issues gefunden.
Versionen 2
-
v2
2025-12-27 12:44 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation -
v1
2025-12-27 11:24 | claude-code-hook | modified
Claude Code Pre-Hook Backup vor Edit-Operation
Code
<?php foreach ($sessions ?? [] as $s):
$totalTokens = (int) ($s['total_input_tokens'] ?? 0) + (int) ($s['total_output_tokens'] ?? 0);
$totalCost = ((int) ($s['total_input_tokens'] ?? 0) * 0.000015) + ((int) ($s['total_output_tokens'] ?? 0) * 0.000075);
$isOllama = str_starts_with($s['model'] ?? '', 'ollama:');
$createdAt = $s['created_at'] ?? null;
$dateStr = $createdAt ? (new DateTime($createdAt))->format('d.m. H:i') : '';
?>
<a href="/chat/<?= $s['uuid'] ?>"
class="chat-session <?= ($currentUuid ?? '') === $s['uuid'] ? 'chat-session--active' : '' ?>"
data-uuid="<?= $s['uuid'] ?>">
<div class="chat-session__title" id="title-<?= $s['uuid'] ?>"><?= htmlspecialchars($s['title'] ?? 'Neuer Chat') ?></div>
<div class="chat-session__meta">
<span class="chat-session__date"><?= $dateStr ?></span>
<span><?= $s['message_count'] ?? 0 ?> Nachr.</span>
<?php if (!$isOllama && $totalTokens > 0): ?>
<span class="chat-session__cost">~$<?= number_format($totalCost, 2) ?></span>
<?php elseif ($isOllama): ?>
<span class="chat-session__local">lokal</span>
<?php endif; ?>
</div>
<div class="chat-session__actions">
<button class="chat-session__edit" onclick="event.preventDefault(); event.stopPropagation(); editTitle('<?= $s['uuid'] ?>');" title="Bearbeiten">✎</button>
<button class="chat-session__delete" hx-delete="/chat/<?= $s['uuid'] ?>" hx-headers='{"X-CSRF-TOKEN": "<?= $csrfToken ?>"}' hx-confirm="Session löschen?" onclick="event.preventDefault(); event.stopPropagation();">×</button>
</div>
</a>
<?php endforeach; ?>
<?php if (empty($sessions)): ?>
<div class="chat-session chat-session--empty">Keine Sessions</div>
<?php endif; ?>