show.php

Code Hygiene Score: 100

Keine Issues gefunden.

Code

<?php ob_start(); ?>

<nav class="breadcrumb">
    <a href="/">Home</a> &raquo; <a href="/explorer">Explorer</a> &raquo; <a href="/system-explorer">System Explorer</a> &raquo; <a href="/system-explorer/chunks">Chunks</a> &raquo; #<?= $chunk['id'] ?>
</nav>

<h1>Chunk #<?= $chunk['id'] ?></h1>
<p>
    Aus: <a href="/docs/<?= htmlspecialchars($chunk['dokument_path']) ?>"><?= htmlspecialchars($chunk['dokument_title']) ?></a>
    (Index: <?= $chunk['chunk_index'] ?>)
</p>

<div class="stats-grid">
    <div class="stat-card">
        <span class="stat-card__value"><?= $chunk['token_count'] ?></span>
        <span class="stat-card__label">Tokens</span>
    </div>
    <div class="stat-card stat-card--<?= $chunk['qdrant_id'] ? 'success' : ($chunk['analysis_status'] === 'completed' ? 'info' : 'warning') ?>">
        <span class="stat-card__value"><?= $chunk['qdrant_id'] ? 'Synced' : ucfirst($chunk['analysis_status']) ?></span>
        <span class="stat-card__label">Status</span>
    </div>
</div>

<div class="chunk-navigation">
    <?php if ($prevChunk): ?>
    <a href="/system-explorer/chunks/<?= $prevChunk['id'] ?>" class="btn btn--small">&laquo; Vorheriger (#<?= $prevChunk['chunk_index'] ?>)</a>
    <?php endif; ?>
    <?php if ($nextChunk): ?>
    <a href="/system-explorer/chunks/<?= $nextChunk['id'] ?>" class="btn btn--small">Nächster (#<?= $nextChunk['chunk_index'] ?>) &raquo;</a>
    <?php endif; ?>
</div>

<h2>Taxonomie</h2>
<table>
    <tr>
        <th>Kategorie</th>
        <td>
            <?php if ($chunk['taxonomy_category']): ?>
            <span class="badge badge--primary"><?= htmlspecialchars($chunk['taxonomy_category']) ?></span>
            <?php else: ?>
            -
            <?php endif; ?>
        </td>
    </tr>
    <tr>
        <th>Pfad</th>
        <td>
            <?php if (!empty($chunk['taxonomy_path_decoded'])): ?>
            <?= htmlspecialchars(implode(' > ', $chunk['taxonomy_path_decoded'])) ?>
            <?php else: ?>
            -
            <?php endif; ?>
        </td>
    </tr>
    <tr>
        <th>Heading-Pfad</th>
        <td>
            <?php if (!empty($chunk['heading_path_decoded'])): ?>
            <?= htmlspecialchars(implode(' > ', $chunk['heading_path_decoded'])) ?>
            <?php else: ?>
            -
            <?php endif; ?>
        </td>
    </tr>
</table>

<?php if (!empty($chunk['entities_decoded'])): ?>
<h2>Entities</h2>
<table>
    <thead>
        <tr>
            <th>Name</th>
            <th>Typ</th>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($chunk['entities_decoded'] as $entity): ?>
        <tr>
            <td><?= htmlspecialchars($entity['name'] ?? '') ?></td>
            <td><span class="badge"><?= htmlspecialchars($entity['type'] ?? 'OTHER') ?></span></td>
        </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<?php endif; ?>

<?php if (!empty($chunk['keywords_decoded'])): ?>
<h2>Keywords</h2>
<div class="tags">
    <?php foreach ($chunk['keywords_decoded'] as $kw): ?>
    <span class="badge"><?= htmlspecialchars($kw) ?></span>
    <?php endforeach; ?>
</div>
<?php endif; ?>

<h2>Inhalt</h2>
<div class="chunk-content">
    <?= $chunk['content'] ?>
</div>

<?php if ($chunk['content_clean']): ?>
<h2>Clean Content</h2>
<pre class="code-block"><?= htmlspecialchars($chunk['content_clean']) ?></pre>
<?php endif; ?>

<h2>Metadaten</h2>
<table>
    <tr><th>Analysiert am</th><td><?= $chunk['analyzed_at'] ? date('d.m.Y H:i:s', strtotime($chunk['analyzed_at'])) : '-' ?></td></tr>
    <tr><th>Analyse-Modell</th><td><?= htmlspecialchars($chunk['analysis_model'] ?? '-') ?></td></tr>
    <tr><th>Embedding-Modell</th><td><?= htmlspecialchars($chunk['embedding_model'] ?? '-') ?></td></tr>
    <tr><th>Qdrant-ID</th><td><code><?= htmlspecialchars($chunk['qdrant_id'] ?? '-') ?></code></td></tr>
    <tr><th>Erstellt</th><td><?= date('d.m.Y H:i:s', strtotime($chunk['created_at'])) ?></td></tr>
    <tr><th>Aktualisiert</th><td><?= date('d.m.Y H:i:s', strtotime($chunk['updated_at'])) ?></td></tr>
</table>

<?php if ($chunk['analysis_error']): ?>
<h2>Fehler</h2>
<div class="error-box">
    <?= htmlspecialchars($chunk['analysis_error']) ?>
</div>
<?php endif; ?>

<p class="links-bar">
    <a href="/system-explorer/chunks">Alle Chunks</a> |
    <a href="/system-explorer/seiten/<?= $chunk['dokument_id'] ?>">Zur Seite</a> |
    <a href="/docs/<?= htmlspecialchars($chunk['dokument_path']) ?>">In Docs anzeigen</a>
</p>

<?php $content = ob_get_clean(); ?>
<?php require VIEW_PATH . '/layout.php'; ?>
← Übersicht