Files
MtoRagSystem/templates/admin/system/agent_overview.html.twig
2026-02-16 14:38:02 +01:00

136 lines
5.0 KiB
Twig

{% extends 'admin/base.html.twig' %}
{% block title %}Wissensdaten (Chunk-Index){% endblock %}
{% block body %}
<a href="{{ path('admin_dashboard') }}"
class="btn btn-sm btn-outline-light mb-3">
← Zurück
</a>
<h1 class="h4 mb-4">Wissensdaten (Chunk-Index)</h1>
{# ============================= #}
{# Index Meta Section #}
{# ============================= #}
<div class="card bg-black text-info border-secondary mb-4"{#>
<div class="card-body">
<h5 class="mb-3">Index Meta (index_meta.json)</h5>
{% if meta.error is defined %}
<div class="alert alert-danger">
<strong>Fehler:</strong><br>
{{ meta.error }}<br>
<small>{{ meta.path }}</small>
</div>
{% else %}
<table class="table table-dark table-sm table-bordered align-middle mb-0">
<tbody>
{% for key, value in meta %}
<tr>
<th style="width:280px;">{{ key }}</th>
<td>
{% if value is iterable %}
<pre class="mb-0 text-info">
{{ value|json_encode(constant('JSON_PRETTY_PRINT')) }}
</pre>
{% else %}
{{ value }}
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
</div>
</div>#}
{# ============================= #}
{# NDJSON Section #}
{# ============================= #}
{% set currentPage = ndjson.page|default(1) %}
{% set currentLimit = ndjson.limit|default(50) %}
<div class="card bg-black text-info border-secondary mb-4">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center mb-3">
<h5 class="mb-0">NdJson Index Übersicht Chunks (index.ndjson)</h5>
<div>
<a href="{{ path('admin_system_agent', {page: (currentPage - 1 < 1 ? 1 : currentPage - 1), limit: currentLimit}) }}"
class="btn btn-sm btn-outline-light">
← Zurück
</a>
<a href="{{ path('admin_system_agent', {page: currentPage + 1, limit: currentLimit}) }}"
class="btn btn-sm btn-outline-light">
Weiter →
</a>
</div>
</div>
{% if ndjson.error %}
<div class="alert alert-danger">
<strong>Fehler:</strong><br>
{{ ndjson.error }}<br>
<small>{{ ndjson.path|default('-') }}</small>
</div>
{% endif %}
<div class="mb-2 text-secondary">
Datei vorhanden: {{ ndjson.path ? 'JA' : 'NEIN' }} |
Geladene Einträge: {{ debugCount|default(0) }} |
Seite {{ currentPage }} • Limit {{ currentLimit }}
</div>
<div class="table-responsive">
<table class="table table-dark table-sm table-bordered align-middle">
<thead>
<tr>
<th style="width:220px;">chunk_id</th>
<th style="width:180px;">document_id</th>
<th>text (gekürzt)</th>
</tr>
</thead>
<tbody>
{% for item in ndjson.items|default([]) %}
<tr>
<td>{{ item.chunk_id ?? '-' }}</td>
<td>{{ item.document_id ?? '-' }}</td>
<td>
{% set text = item.text ?? '' %}
{{ text|slice(0, 240) }}{% if text|length > 240 %}{% endif %}
<details class="mt-2">
<summary class="text-secondary" style="cursor:pointer;">
JSON anzeigen
</summary>
<pre class="bg-dark text-info p-2 border border-secondary rounded mt-2">
{{ item|json_encode(constant('JSON_PRETTY_PRINT')) }}
</pre>
</details>
</td>
</tr>
{% else %}
<tr>
<td colspan="3" class="text-secondary">
Keine Einträge gefunden.
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endblock %}