add chat as own route
This commit is contained in:
Binary file not shown.
@@ -1,249 +0,0 @@
|
||||
diff -ruN '--exclude=var/cache' rag_work_chat_orig/patch_history/RETRIEX_PATCH_87_CHAT_FRONTEND_CONTROLLER_README.md rag_work_chat_patch/patch_history/RETRIEX_PATCH_87_CHAT_FRONTEND_CONTROLLER_README.md
|
||||
--- rag_work_chat_orig/patch_history/RETRIEX_PATCH_87_CHAT_FRONTEND_CONTROLLER_README.md 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ rag_work_chat_patch/patch_history/RETRIEX_PATCH_87_CHAT_FRONTEND_CONTROLLER_README.md 2026-05-11 09:12:52.126440052 +0000
|
||||
@@ -0,0 +1,82 @@
|
||||
+# RetrieX Patch p87 - Chat Frontend Symfony Controller
|
||||
+
|
||||
+## Zweck
|
||||
+
|
||||
+Der Chat lief bisher als statische `public/index.html`. Dadurch konnte die Startseite den Symfony-Kernel umgehen und war fuer spaetere PHP-seitige Erweiterungen wie Rollen-/Rechtepruefung, Mandantenlogik oder dynamische Chat-Optionen ungeeignet.
|
||||
+
|
||||
+p87 hebt nur den Chat-Frontend-Einstieg in einen eigenen Symfony-Controller und trennt ihn architektonisch vom Adminbereich. Es gibt keine Aenderungen an Agent, Retrieval, Scoring, Ranking, Shop-Matching, SSE, History oder Frontend-JavaScript-Logik.
|
||||
+
|
||||
+## Aenderungen
|
||||
+
|
||||
+- Neuer Controller: `src/Controller/Chat/ChatController.php`
|
||||
+ - Namespace bewusst getrennt von `App\Controller\Admin`
|
||||
+ - Route `/` als Chat-Startseite
|
||||
+ - Route `/chat` als expliziter Chat-Alias
|
||||
+ - rendert `templates/chat/index.html.twig`
|
||||
+- Neues Twig-Template: `templates/chat/index.html.twig`
|
||||
+ - Inhalt aus der bisherigen `public/index.html` uebernommen
|
||||
+ - Asset-Pfade ueber `asset()` gerendert
|
||||
+ - Chat-UI bleibt optisch und funktional gleich
|
||||
+- `public/index.html` entfernt
|
||||
+ - wichtig, damit der Webserver die Root-Anfrage nicht weiter statisch vor Symfony abfaengt
|
||||
+- `src/Controller/Admin/DashboardController.php` angepasst
|
||||
+ - Root-Routen `''` und `/` entfernt
|
||||
+ - Admin-Redirect bleibt nur unter `/admin` und `/admin/`
|
||||
+
|
||||
+## Architekturentscheidung
|
||||
+
|
||||
+Chat und Admin bleiben getrennt:
|
||||
+
|
||||
+- Chat: `App\Controller\Chat\...`, `templates/chat/...`, oeffentliche Route `/` bzw. `/chat`
|
||||
+- Admin: `App\Controller\Admin\...`, `templates/admin/...`, geschuetzte Route `/admin...`
|
||||
+
|
||||
+Damit kann Schritt 2 spaeter sauber aufsetzen, z. B. mit einem eigenen Chat-Firewall-/Access-Control-Bereich oder Controller-Attributen wie `#[IsGranted(...)]`, ohne Admin-Templates, Admin-Routen oder Admin-Navigation mit dem Chat zu vermischen.
|
||||
+
|
||||
+## Bewusst nicht geaendert
|
||||
+
|
||||
+- Keine Rollen-/Rechtepflicht fuer den Chat in diesem Patch
|
||||
+- Keine Aenderung an `security.yaml`, ausser dass die bestehende Trennung weiterhin moeglich bleibt
|
||||
+- Keine Aenderung an `/ask-jobs`, `/ask-sse`, `/history`, `/chat-messages/frontend`
|
||||
+- Keine Aenderung an `public/assets/js/base.js`
|
||||
+- Keine Aenderung an RAG-/Commerce-/Prompt-/YAML-Logik
|
||||
+
|
||||
+## Lokale Checks
|
||||
+
|
||||
+Ausgefuehrt:
|
||||
+
|
||||
+```bash
|
||||
+php -l src/Controller/Chat/ChatController.php
|
||||
+php -l src/Controller/Admin/DashboardController.php
|
||||
+python3 - <<'PY'
|
||||
+from pathlib import Path
|
||||
+assert Path('templates/chat/index.html.twig').exists()
|
||||
+assert not Path('public/index.html').exists()
|
||||
+assert "#[Route('/', name: 'chat_index'" in Path('src/Controller/Chat/ChatController.php').read_text()
|
||||
+print('p87 structural checks OK')
|
||||
+PY
|
||||
+```
|
||||
+
|
||||
+Ergebnis:
|
||||
+
|
||||
+- PHP lint OK
|
||||
+- Chat-Template vorhanden
|
||||
+- statische `public/index.html` entfernt
|
||||
+- Root-Route liegt jetzt beim ChatController
|
||||
+
|
||||
+## Noch in Zielumgebung ausfuehren
|
||||
+
|
||||
+```bash
|
||||
+php bin/console cache:clear
|
||||
+php bin/console debug:router | grep -E 'chat_index|admin_dashboard'
|
||||
+php bin/console mto:agent:config:validate
|
||||
+php bin/console mto:agent:regression:test
|
||||
+php bin/console mto:agent:config:audit-source --details
|
||||
+php bin/console mto:agent:config:audit-patterns --details
|
||||
+```
|
||||
+
|
||||
+Manuelle Smoke-Tests:
|
||||
+
|
||||
+1. `/` oeffnet den Chat.
|
||||
+2. `/chat` oeffnet denselben Chat.
|
||||
+3. `/admin` leitet weiterhin zum Admin-Dashboard/Login.
|
||||
+4. `/ask-jobs`, `/ask-sse/{jobId}`, `/history`, `/history/delete`, `/chat-messages/frontend` funktionieren unveraendert.
|
||||
diff -ruN '--exclude=var/cache' rag_work_chat_orig/public/index.html rag_work_chat_patch/public/index.html
|
||||
--- rag_work_chat_orig/public/index.html 2026-05-10 15:02:19.000000000 +0000
|
||||
+++ rag_work_chat_patch/public/index.html 1970-01-01 00:00:00.000000000 +0000
|
||||
@@ -1,56 +0,0 @@
|
||||
-<!DOCTYPE html>
|
||||
-<html lang="de">
|
||||
-<head>
|
||||
- <meta charset="UTF-8">
|
||||
- <title></title>
|
||||
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
-
|
||||
- <!-- Markdown + Sanitizer -->
|
||||
- <link href="/assets/styles/bootstrap.min.css" rel="stylesheet"/>
|
||||
- <link rel="stylesheet" href="/assets/styles/base.css">
|
||||
- <link rel="shortcut icon" href="https://www.mitho-media.de/media/fc/16/42/1667224106/favicon.ico?ts=1767609928">
|
||||
-
|
||||
- <script src="/assets/js/bootstrap.bundle.min.js"></script>
|
||||
- <script src="/assets/js/marked.min.js"></script>
|
||||
- <script src="/assets/js/purify.min.js"></script>
|
||||
- <script src="/assets/js/base.js"></script>
|
||||
-</head>
|
||||
-<body class="bg-black">
|
||||
-
|
||||
-<div class="container">
|
||||
- <div class="header">
|
||||
-
|
||||
- <div>
|
||||
-
|
||||
- <div class="d-flex">
|
||||
- <img src="/assets/img/logo.png" style="max-height: 20px;">
|
||||
- </div>
|
||||
- <div class="text-info fw-bold" style="font-size: 12px" data-chat-message-text="ui.header_title"></div>
|
||||
- </div>
|
||||
- <img src="/assets/img/logo.svg" style="max-height: 20px;">
|
||||
- <div class="spacer"></div>
|
||||
-
|
||||
- <button id="clear" class="btn btn-trans" data-chat-message-text="ui.buttons.clear"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill" viewBox="0 0 16 16">
|
||||
- <path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0"/>
|
||||
- </svg></button>
|
||||
- </div>
|
||||
- <div id="ai-cloud" class="ai-cloud d-none"></div>
|
||||
- <div id="chat" class="chat"></div>
|
||||
-
|
||||
- <div id="retriex-chat-options" class="retriex-chat-options p-2" data-chat-message-aria-label="ui.options.aria_label">
|
||||
- <label class="retriex-option-toggle" for="toggle-retriex-cards">
|
||||
- <input id="toggle-retriex-cards" type="checkbox">
|
||||
- <span data-chat-message-text="ui.options.status_info"></span>
|
||||
- </label>
|
||||
- </div>
|
||||
-
|
||||
- <div class="input-area">
|
||||
- <textarea id="prompt" class="form-control bg-dark" data-chat-message-placeholder="ui.input.prompt_placeholder"></textarea>
|
||||
- <button id="send" class="btn btn-trans" data-chat-message-text="ui.buttons.send"></button>
|
||||
- <button id="abort" class="btn btn-trans" disabled data-chat-message-text="ui.buttons.abort"></button>
|
||||
- </div>
|
||||
- <div class="small mt-2 text-center text-secondary" data-chat-message-text="ui.footer_disclaimer"></div>
|
||||
-</div>
|
||||
-
|
||||
-</body>
|
||||
-</html>
|
||||
diff -ruN '--exclude=var/cache' rag_work_chat_orig/src/Controller/Admin/DashboardController.php rag_work_chat_patch/src/Controller/Admin/DashboardController.php
|
||||
--- rag_work_chat_orig/src/Controller/Admin/DashboardController.php 2026-04-24 07:36:06.000000000 +0000
|
||||
+++ rag_work_chat_patch/src/Controller/Admin/DashboardController.php 2026-05-11 09:12:22.931937348 +0000
|
||||
@@ -15,9 +15,8 @@
|
||||
|
||||
final class DashboardController extends AbstractController
|
||||
{
|
||||
- #[Route('', name: 'admin_dashboard_null')]
|
||||
- #[Route('/', name: 'admin_dashboard_trail')]
|
||||
#[Route('/admin', name: 'admin_dashboard_alias')]
|
||||
+ #[Route('/admin/', name: 'admin_dashboard_trail')]
|
||||
public function redirectToDashboard(): RedirectResponse
|
||||
{
|
||||
return $this->redirectToRoute('admin_dashboard');
|
||||
diff -ruN '--exclude=var/cache' rag_work_chat_orig/src/Controller/Chat/ChatController.php rag_work_chat_patch/src/Controller/Chat/ChatController.php
|
||||
--- rag_work_chat_orig/src/Controller/Chat/ChatController.php 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ rag_work_chat_patch/src/Controller/Chat/ChatController.php 2026-05-11 09:12:20.808732910 +0000
|
||||
@@ -0,0 +1,26 @@
|
||||
+<?php
|
||||
+
|
||||
+declare(strict_types=1);
|
||||
+
|
||||
+namespace App\Controller\Chat;
|
||||
+
|
||||
+use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
+use Symfony\Component\HttpFoundation\Response;
|
||||
+use Symfony\Component\Routing\Attribute\Route;
|
||||
+
|
||||
+/**
|
||||
+ * Public chat frontend entrypoint.
|
||||
+ *
|
||||
+ * This controller intentionally lives outside App\Controller\Admin so the chat
|
||||
+ * UI can evolve independently from the administration area and can receive its
|
||||
+ * own access rules later without coupling it to admin navigation or templates.
|
||||
+ */
|
||||
+final class ChatController extends AbstractController
|
||||
+{
|
||||
+ #[Route('/', name: 'chat_index', methods: ['GET'])]
|
||||
+ #[Route('/chat', name: 'chat_index_alias', methods: ['GET'])]
|
||||
+ public function index(): Response
|
||||
+ {
|
||||
+ return $this->render('chat/index.html.twig');
|
||||
+ }
|
||||
+}
|
||||
diff -ruN '--exclude=var/cache' rag_work_chat_orig/templates/chat/index.html.twig rag_work_chat_patch/templates/chat/index.html.twig
|
||||
--- rag_work_chat_orig/templates/chat/index.html.twig 1970-01-01 00:00:00.000000000 +0000
|
||||
+++ rag_work_chat_patch/templates/chat/index.html.twig 2026-05-11 09:12:20.822443841 +0000
|
||||
@@ -0,0 +1,55 @@
|
||||
+<!DOCTYPE html>
|
||||
+<html lang="de">
|
||||
+<head>
|
||||
+ <meta charset="UTF-8">
|
||||
+ <title></title>
|
||||
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
+
|
||||
+ <link href="{{ asset('assets/styles/bootstrap.min.css') }}" rel="stylesheet"/>
|
||||
+ <link rel="stylesheet" href="{{ asset('assets/styles/base.css') }}">
|
||||
+ <link rel="shortcut icon" href="https://www.mitho-media.de/media/fc/16/42/1667224106/favicon.ico?ts=1767609928">
|
||||
+
|
||||
+ <script src="{{ asset('assets/js/bootstrap.bundle.min.js') }}"></script>
|
||||
+ <script src="{{ asset('assets/js/marked.min.js') }}"></script>
|
||||
+ <script src="{{ asset('assets/js/purify.min.js') }}"></script>
|
||||
+ <script src="{{ asset('assets/js/base.js') }}"></script>
|
||||
+</head>
|
||||
+<body class="bg-black">
|
||||
+
|
||||
+<div class="container">
|
||||
+ <div class="header">
|
||||
+
|
||||
+ <div>
|
||||
+
|
||||
+ <div class="d-flex">
|
||||
+ <img src="{{ asset('assets/img/logo.png') }}" style="max-height: 20px;" alt="">
|
||||
+ </div>
|
||||
+ <div class="text-info fw-bold" style="font-size: 12px" data-chat-message-text="ui.header_title"></div>
|
||||
+ </div>
|
||||
+ <img src="{{ asset('assets/img/logo.svg') }}" style="max-height: 20px;" alt="">
|
||||
+ <div class="spacer"></div>
|
||||
+
|
||||
+ <button id="clear" class="btn btn-trans" data-chat-message-text="ui.buttons.clear"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-trash-fill" viewBox="0 0 16 16">
|
||||
+ <path d="M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5M8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5m3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0"/>
|
||||
+ </svg></button>
|
||||
+ </div>
|
||||
+ <div id="ai-cloud" class="ai-cloud d-none"></div>
|
||||
+ <div id="chat" class="chat"></div>
|
||||
+
|
||||
+ <div id="retriex-chat-options" class="retriex-chat-options p-2" data-chat-message-aria-label="ui.options.aria_label">
|
||||
+ <label class="retriex-option-toggle" for="toggle-retriex-cards">
|
||||
+ <input id="toggle-retriex-cards" type="checkbox">
|
||||
+ <span data-chat-message-text="ui.options.status_info"></span>
|
||||
+ </label>
|
||||
+ </div>
|
||||
+
|
||||
+ <div class="input-area">
|
||||
+ <textarea id="prompt" class="form-control bg-dark" data-chat-message-placeholder="ui.input.prompt_placeholder"></textarea>
|
||||
+ <button id="send" class="btn btn-trans" data-chat-message-text="ui.buttons.send"></button>
|
||||
+ <button id="abort" class="btn btn-trans" disabled data-chat-message-text="ui.buttons.abort"></button>
|
||||
+ </div>
|
||||
+ <div class="small mt-2 text-center text-secondary" data-chat-message-text="ui.footer_disclaimer"></div>
|
||||
+</div>
|
||||
+
|
||||
+</body>
|
||||
+</html>
|
||||
Reference in New Issue
Block a user