From 9e4a731c2793f49aac803abdbfba1295aafd0bcb Mon Sep 17 00:00:00 2001 From: serversdown Date: Wed, 17 Jun 2026 03:41:54 +0000 Subject: [PATCH] feat(web): dedicated full-page log viewer + run lyra-web as a service MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The inline log panel is cramped, especially on mobile. Add a standalone mobile-first log page and serve the chat server under systemd like the dream loop (the nohup process didn't survive cleanly). - static/logs.html: full-page live log — level filter chips, text search, pause/resume with buffering, autoscroll toggle, color-coded levels, and the expandable "view full prompt" block (where the now-note is visible in context) - server: GET /logs serves the page (FileResponse) - index.html: "⛶ Full Log" button opens /logs in a new tab - deploy/lyra-web.service: user service so the chat server is reboot-resilient Co-Authored-By: Claude Opus 4.8 (1M context) --- deploy/lyra-web.service | 13 ++ lyra/web/server.py | 7 +- lyra/web/static/index.html | 1 + lyra/web/static/logs.html | 239 +++++++++++++++++++++++++++++++++++++ 4 files changed, 259 insertions(+), 1 deletion(-) create mode 100644 deploy/lyra-web.service create mode 100644 lyra/web/static/logs.html diff --git a/deploy/lyra-web.service b/deploy/lyra-web.service new file mode 100644 index 0000000..9df6cf5 --- /dev/null +++ b/deploy/lyra-web.service @@ -0,0 +1,13 @@ +[Unit] +Description=Lyra web chat server (FastAPI + vendored UI) + +[Service] +Type=simple +WorkingDirectory=/home/serversdown/project-lyra +UnsetEnvironment=VIRTUAL_ENV +ExecStart=/home/serversdown/.local/bin/uv run lyra-web +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=default.target diff --git a/lyra/web/server.py b/lyra/web/server.py index b684401..6a428cc 100644 --- a/lyra/web/server.py +++ b/lyra/web/server.py @@ -15,7 +15,7 @@ import time from pathlib import Path from fastapi import FastAPI, Request -from fastapi.responses import StreamingResponse +from fastapi.responses import FileResponse, StreamingResponse from fastapi.staticfiles import StaticFiles from lyra import chat, logbus, memory, summary @@ -110,6 +110,11 @@ def create_app() -> FastAPI: ], } + @app.get("/logs") + async def logs_page() -> FileResponse: + """Full-page, mobile-friendly live log viewer (separate from the chat UI).""" + return FileResponse(str(_STATIC / "logs.html")) + @app.get("/stream/logs") async def stream_logs(request: Request) -> StreamingResponse: """Live activity feed: replay the recent buffer, then stream new events.""" diff --git a/lyra/web/static/index.html b/lyra/web/static/index.html index 411c737..da75ca9 100644 --- a/lyra/web/static/index.html +++ b/lyra/web/static/index.html @@ -69,6 +69,7 @@ + ⛶ Full Log diff --git a/lyra/web/static/logs.html b/lyra/web/static/logs.html new file mode 100644 index 0000000..2ac2623 --- /dev/null +++ b/lyra/web/static/logs.html @@ -0,0 +1,239 @@ + + + + + + + Lyra — Live Log + + + +
+
+ +

Lyra · Live Log

+ ← Chat + 0 +
+
+
+ info + debug + error + system +
+ + + + +
+
+ +
+
📡 Waiting for activity…
+
+ + + +