diff --git a/DELETE_PUBLIC_INDEX_HTML.txt b/DELETE_PUBLIC_INDEX_HTML.txt new file mode 100644 index 0000000..672c030 --- /dev/null +++ b/DELETE_PUBLIC_INDEX_HTML.txt @@ -0,0 +1,7 @@ +This patch intentionally removes public/index.html. + +Reason: +If public/index.html remains in the document root, many web servers serve it before public/index.php and the Symfony route / will not reach App\Controller\Chat\ChatController. + +When applying this patch manually, delete: +public/index.html diff --git a/patch_history/RETRIEX_PATCH_87_CHAT_FRONTEND_CONTROLLER_README.md b/patch_history/RETRIEX_PATCH_87_CHAT_FRONTEND_CONTROLLER_README.md new file mode 100644 index 0000000..b8dd40b --- /dev/null +++ b/patch_history/RETRIEX_PATCH_87_CHAT_FRONTEND_CONTROLLER_README.md @@ -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 --git a/rag-inprogress-p87-chat-frontend-controller-patch-only.zip b/rag-inprogress-p87-chat-frontend-controller-patch-only.zip new file mode 100644 index 0000000..23c9375 Binary files /dev/null and b/rag-inprogress-p87-chat-frontend-controller-patch-only.zip differ diff --git a/rag-inprogress-p87-chat-frontend-controller.diff b/rag-inprogress-p87-chat-frontend-controller.diff new file mode 100644 index 0000000..43e9357 --- /dev/null +++ b/rag-inprogress-p87-chat-frontend-controller.diff @@ -0,0 +1,249 @@ +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 @@ +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +- +-
+-
+- +-
+- +-
+- +-
+-
+-
+- +-
+- +- +-
+-
+-
+- +-
+- +-
+- +-
+- +- +- +-
+-
+-
+- +- +- +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 @@ ++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 @@ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++
++
++ ++
++ ++
++ ++
++
++
++ ++
++ ++ ++
++
++
++ ++
++ ++
++ ++
++ ++ ++ ++
++
++
++ ++ ++ diff --git a/src/Controller/Admin/DashboardController.php b/src/Controller/Admin/DashboardController.php index 7a18355..188e7b2 100644 --- a/src/Controller/Admin/DashboardController.php +++ b/src/Controller/Admin/DashboardController.php @@ -15,9 +15,8 @@ use Symfony\Component\Routing\Attribute\Route; 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 --git a/src/Controller/Chat/ChatController.php b/src/Controller/Chat/ChatController.php new file mode 100644 index 0000000..678c1b7 --- /dev/null +++ b/src/Controller/Chat/ChatController.php @@ -0,0 +1,26 @@ +render('chat/index.html.twig'); + } +} diff --git a/templates/chat/index.html.twig b/templates/chat/index.html.twig new file mode 100644 index 0000000..289d780 --- /dev/null +++ b/templates/chat/index.html.twig @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + +
+
+ +
+ +
+ +
+
+
+ +
+ + +
+
+
+ +
+ +
+ +
+ + + +
+
+
+ + +