alpha new hybridretriver line

This commit is contained in:
team2
2026-02-26 07:02:07 +01:00
parent c12ae8b45e
commit df97f9314b
9 changed files with 460 additions and 152 deletions

View File

@@ -22,7 +22,10 @@
<div class="row g-4">
<!-- Modell -->
<!-- ============================== -->
<!-- Modell-Basis -->
<!-- ============================== -->
<div class="col-md-6">
<label class="form-label">Modellname</label>
<input type="text"
@@ -31,11 +34,10 @@
placeholder="z. B. qwen3:latest"
required>
<div class="form-text text-secondary">
Exakter Modellname wie im KI-Endpunkt konfiguriert (z. B. Ollama oder API).
Exakter Modellname wie im KI-Endpunkt konfiguriert.
</div>
</div>
<!-- Stream -->
<div class="col-md-6 d-flex align-items-center">
<div class="form-check form-switch mt-4">
<input class="form-check-input"
@@ -48,11 +50,22 @@
</label>
</div>
<div class="form-text text-secondary ms-3">
Aktiviert Token-Streaming im Chat (empfohlen für bessere UX).
Token-Streaming im Chat (empfohlen).
</div>
</div>
<!-- Temperature -->
</div>
<hr class="border-secondary my-4">
<!-- ============================== -->
<!-- GENERATION -->
<!-- ============================== -->
<h5 class="text-info mb-3">Generation (LLM Sampling)</h5>
<div class="row g-4">
<div class="col-md-4">
<label class="form-label">Temperature</label>
<input type="number"
@@ -64,29 +77,24 @@
class="form-control bg-dark text-light border-secondary"
required>
<div class="form-text text-secondary">
Steuert die Kreativität der Antworten.
Niedrige Werte (0.20.4) erzeugen stabile, sachliche Ergebnisse empfohlen für RAG-Systeme.
Höhere Werte führen zu freieren, weniger deterministischen Antworten.
Kreativität des Modells. Für RAG 0.20.4 empfohlen.
</div>
</div>
<!-- Top K -->
<div class="col-md-4">
<label class="form-label">Top K</label>
<input type="number"
min="1"
max="200"
name="top_k"
value="40"
class="form-control bg-dark text-light border-secondary"
required>
<div class="form-text text-secondary">
Begrenzt die Anzahl der wahrscheinlichsten Token, aus denen das Modell auswählt.
Niedrigere Werte = konservativer, höhere Werte = flexibler.
2050 ist für Wissenssysteme üblich.
Begrenzt die Auswahl wahrscheinlicher Token.
</div>
</div>
<!-- Top P -->
<div class="col-md-4">
<label class="form-label">Top P</label>
<input type="number"
@@ -98,13 +106,10 @@
class="form-control bg-dark text-light border-secondary"
required>
<div class="form-text text-secondary">
Nucleus Sampling: Das Modell berücksichtigt nur Token,
deren kumulative Wahrscheinlichkeit innerhalb dieses Werts liegt.
0.80.95 bietet eine gute Balance zwischen Stabilität und Natürlichkeit.
Nucleus Sampling Balance zwischen Stabilität und Natürlichkeit.
</div>
</div>
<!-- Repeat Penalty -->
<div class="col-md-6">
<label class="form-label">Repeat Penalty</label>
<input type="number"
@@ -116,12 +121,10 @@
class="form-control bg-dark text-light border-secondary"
required>
<div class="form-text text-secondary">
Bestraft Wortwiederholungen. Werte leicht über 1.0 (z. B. 1.11.15)
verhindern Schleifen und redundante Antworten.
Verhindert Wiederholungen (1.11.15 empfohlen).
</div>
</div>
<!-- Num Ctx -->
<div class="col-md-6">
<label class="form-label">Context Window (num_ctx)</label>
<input type="number"
@@ -132,9 +135,50 @@
class="form-control bg-dark text-light border-secondary"
required>
<div class="form-text text-secondary">
Maximale Kontextlänge in Tokens (Systemprompt + Benutzerfrage + Retrieval-Chunks).
Muss vom Modell unterstützt werden.
Höhere Werte ermöglichen größere Wissenskontexte, erhöhen jedoch Speicher- und Rechenbedarf.
Maximale Kontextlänge (System + Frage + Retrieval).
</div>
</div>
</div>
<hr class="border-secondary my-4">
<!-- ============================== -->
<!-- RETRIEVAL -->
<!-- ============================== -->
<h5 class="text-warning mb-3">Retrieval (Wissensabruf)</h5>
<div class="row g-4">
<div class="col-md-6">
<label class="form-label">Max Chunks</label>
<input type="number"
min="1"
max="200"
name="retrieval_max_chunks"
value="25"
class="form-control bg-dark text-light border-secondary"
required>
<div class="form-text text-secondary">
Maximale Anzahl an Wissens-Chunks,
die dem Modell übergeben werden.
2040 ist für die meisten Systeme optimal.
</div>
</div>
<div class="col-md-6">
<label class="form-label">Vector Top K</label>
<input type="number"
min="1"
max="200"
name="retrieval_vector_top_k"
value="25"
class="form-control bg-dark text-light border-secondary"
required>
<div class="form-text text-secondary">
Anzahl der Vektor-Treffer vor Filterung.
Höhere Werte erhöhen Recall, können aber Rauschen verstärken.
</div>
</div>
@@ -157,4 +201,4 @@
Hinweis: Neue Konfigurationen werden zunächst inaktiv gespeichert und
müssen separat aktiviert werden. Pro Modell kann nur eine Version aktiv sein.
</div>
{% endblock %}
{% endblock %}

View File

@@ -24,11 +24,8 @@
<th>Modell</th>
<th>Version</th>
<th>Stream</th>
<th>Temp</th>
<th>Top K</th>
<th>Top P</th>
<th>Repeat</th>
<th>Ctx</th>
<th>Sampling</th>
<th class="text-warning">Retrieval</th>
<th>Status</th>
<th class="text-end">Aktionen</th>
</tr>
@@ -52,27 +49,47 @@
{% endif %}
</td>
<td>{{ config.temperature }}</td>
<td>{{ config.topK }}</td>
<td>{{ config.topP }}</td>
<td>{{ config.repeatPenalty }}</td>
<td>{{ config.numCtx }}</td>
{# ========================= #}
{# Sampling Group #}
{# ========================= #}
<td>
<div class="small">
<div><strong>T:</strong> {{ config.temperature }}</div>
<div><strong>K:</strong> {{ config.topK }}</div>
<div><strong>P:</strong> {{ config.topP }}</div>
<div><strong>R:</strong> {{ config.repeatPenalty }}</div>
<div><strong>Ctx:</strong> {{ config.numCtx }}</div>
</div>
</td>
{# ========================= #}
{# Retrieval Group #}
{# ========================= #}
<td class="text-warning">
<div class="small">
<div><strong>Chunks:</strong> {{ config.retrievalMaxChunks }}</div>
<div><strong>VectorK:</strong> {{ config.retrievalVectorTopK }}</div>
</div>
</td>
<td>
{% if config.active %}
<span class="badge bg-success">Aktiv</span>
{% else %}
<span class="badge bg-dark border border-secondary">
Inaktiv
</span>
Inaktiv
</span>
{% endif %}
</td>
<td class="text-end">
<a href="{{ path('admin_model_config_test_retrieval', {id: config.id}) }}"
class="btn btn-sm btn-outline-warning me-1">
Test Retrieval
</a>
{% if not config.active and is_granted('ROLE_SUPER_ADMIN') %}
{# Aktivieren via POST + CSRF #}
<form method="post"
action="{{ path('admin_model_config_activate', {id: config.id}) }}"
class="d-inline"
@@ -82,12 +99,11 @@
name="_token"
value="{{ csrf_token('activate_model_config_' ~ config.id) }}">
<button class="btn btn-sm btn-outline-success me-2">
<button class="btn btn-sm btn-outline-success me-1">
Aktivieren
</button>
</form>
{# Löschen via POST + CSRF #}
<form method="post"
action="{{ path('admin_model_config_delete', {id: config.id}) }}"
class="d-inline"
@@ -105,13 +121,12 @@
{% else %}
<span class="text-secondary small">—</span>
{% endif %}
</td>
</tr>
{% else %}
<tr>
<td colspan="10" class="text-center text-secondary py-4">
<td colspan="7" class="text-center text-secondary py-4">
Keine Konfiguration vorhanden.
</td>
</tr>
@@ -132,13 +147,11 @@
<div class="card bg-black border-info">
<div class="card-body p-0">
<iframe
src="/index.html?admin_test=1"
class="w-100 border-0"
style="height:75vh;"
></iframe>
</div>
</div>
@@ -146,4 +159,5 @@
Der Agent läuft im isolierten Admin-Test-Modus.
Keine Persistenz. Keine produktive Session.
</div>
{% endblock %}
{% endblock %}

View File

@@ -0,0 +1,93 @@
{% extends 'admin/base.html.twig' %}
{% block title %}Retrieval-Test{% endblock %}
{% block body %}
<div class="d-flex justify-content-between align-items-center mb-4">
<h1 class="h3">
Retrieval-Test {{ config.modelName }} (v{{ config.version }})
</h1>
<a href="{{ path('admin_model_config_list') }}"
class="btn btn-sm btn-outline-secondary">
Zurück
</a>
</div>
{# ====================================================== #}
{# Konfigurationsübersicht #}
{# ====================================================== #}
<div class="card bg-black border-secondary text-light mb-4">
<div class="card-body small">
<div class="row">
<div class="col-md-6">
<strong>Max Chunks:</strong>
{{ config.retrievalMaxChunks }}
</div>
<div class="col-md-6">
<strong>Vector Top K:</strong>
{{ config.retrievalVectorTopK }}
</div>
</div>
</div>
</div>
{# ====================================================== #}
{# Testformular #}
{# ====================================================== #}
<div class="card bg-black border-secondary text-light mb-4">
<div class="card-body">
<form method="post">
<div class="mb-3">
<label class="form-label">Test-Prompt</label>
<textarea name="prompt"
rows="3"
class="form-control bg-dark text-light border-secondary"
required>{{ prompt }}</textarea>
</div>
<button type="submit"
class="btn btn-outline-warning">
Retrieval testen
</button>
</form>
</div>
</div>
{# ====================================================== #}
{# Ergebnisse #}
{# ====================================================== #}
{% if results is not empty %}
<div class="card bg-black border-secondary text-light">
<div class="card-body">
<h5 class="text-warning mb-3">
Gefundene Chunks ({{ results|length }})
</h5>
<div style="max-height: 500px; overflow-y: auto;">
{% for chunk in results %}
<div class="border border-secondary p-3 mb-3 small">
{{ chunk }}
</div>
{% endfor %}
</div>
</div>
</div>
{% endif %}
{% endblock %}