Files
MtoRagSystem/templates/admin/system/agent_overview.html.twig
team2 6822c8f3f8 optimize ui
add new ki endpoint params
2026-02-17 20:36:47 +01:00

190 lines
6.9 KiB
Twig

{% extends 'admin/base.html.twig' %}
{% block title %}Wissensdaten (Chunk-Index){% endblock %}
{% block body %}
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3">Wissensdaten (Chunk-Index)</h1>
<a href="{{ path('admin_dashboard') }}"
class="btn btn-sm btn-outline-secondary">
Zurück zum Dashboard
</a>
</div>
{# ============================= #}
{# Index Meta Section #}
{# ============================= #}
<div class="card bg-black border-secondary mb-5">
<div class="card-body">
<h5 class="text-info 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 class="text-muted">{{ meta.path }}</small>
</div>
{% else %}
<div class="table-responsive">
<table class="table table-dark table-striped align-middle mb-0">
<tbody>
{% for key, value in meta %}
<tr>
<th style="width:260px;" class="text-secondary">
{{ key }}
</th>
<td>
{% if value is iterable %}
<pre class="mb-0 small text-info">
{{ value|json_encode(constant('JSON_PRETTY_PRINT')) }}
</pre>
{% else %}
{{ value }}
{% endif %}
</td>
</tr>
{% else %}
<tr>
<td colspan="2" class="text-secondary">
Keine Meta-Daten vorhanden.
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endif %}
</div>
</div>
{# ============================= #}
{# NDJSON Section #}
{# ============================= #}
{% set currentPage = ndjson.page|default(1) %}
{% set currentLimit = ndjson.limit|default(50) %}
<div class="card bg-black border-secondary">
<div class="card-body">
<div class="d-flex justify-content-between align-items-center mb-3">
<h5 class="text-info mb-0">
NDJSON-Index Übersicht (index.ndjson)
</h5>
<div class="btn-group">
<a href="{{ path('admin_system_agent', {
page: currentPage > 1 ? currentPage - 1 : 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-3 small text-secondary">
Datei:
{% if ndjson.path %}
<span class="badge bg-success">Vorhanden</span>
{% else %}
<span class="badge bg-danger">Nicht gefunden</span>
{% endif %}
• Geladene Einträge: {{ debugCount|default(0) }}
• Seite {{ currentPage }}
• Limit {{ currentLimit }}
</div>
<div class="table-responsive">
<table class="table table-dark table-striped table-hover align-middle">
<thead class="table-secondary text-dark">
<tr>
<th style="width:200px;">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 class="small">{{ item.chunk_id ?? '-' }}</td>
<td>
{% if item.document_id %}
<a href="{{ path('admin_document_show', {id: item.document_id}) }}"
class="text-decoration-none text-light">
{{ item.document_id }}
</a>
{% else %}
-
{% endif %}
</td>
<td>
{% set text = item.text ?? '' %}
<div class="small">
{{ text|slice(0, 240) }}
{% if text|length > 240 %}{% endif %}
</div>
<details class="mt-2">
<summary class="text-secondary small">
JSON anzeigen
</summary>
<pre class="bg-dark text-info p-2 border border-secondary rounded mt-2 small">
{{ item|json_encode(constant('JSON_PRETTY_PRINT')) }}
</pre>
</details>
</td>
</tr>
{% else %}
<tr>
<td colspan="3" class="text-center text-secondary py-4">
Keine Einträge gefunden.
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="mt-4 small text-secondary">
Hinweis: Änderungen am NDJSON-Index oder an der Indexstruktur können
inkonsistente Retrieval-Ergebnisse verursachen, bis ein vollständiger
Reindex durchgeführt wurde.
</div>
{% endblock %}