From 6f410e29d20e46e567e89ae1e925194e431981ed Mon Sep 17 00:00:00 2001 From: gramps Date: Sun, 29 Mar 2026 16:09:13 -0700 Subject: [PATCH] Fix type errors and bare except clauses in app.py; update readme Co-Authored-By: Claude Sonnet 4.6 --- app.py | 6 +++--- readme.md | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index c5bc3c9..9546864 100644 --- a/app.py +++ b/app.py @@ -235,7 +235,7 @@ def get_db(): # MEMORY SYSTEM (FTS5) # ============================================================================= -def add_memory(fact: str, topic: str = "general", source: str = "explicit") -> int: +def add_memory(fact: str, topic: str = "general", source: str = "explicit") -> int | None: """Store a new memory. Returns rowid.""" db = get_db() now = datetime.now(timezone.utc).isoformat() @@ -497,7 +497,7 @@ if static_dir.exists(): @app.get("/", response_class=HTMLResponse) async def index(request: Request): - return templates.TemplateResponse("index.html", {"request": request, "version": VERSION}) + return templates.TemplateResponse(request, "index.html", {"version": VERSION}) @app.get("/api/models") async def list_models(): @@ -533,7 +533,7 @@ async def search_status(): try: resp = await client.get(f"{SEARXNG_BASE}/search", params={"q": "test", "format": "json"}, timeout=5) return {"available": resp.status_code == 200} - except: + except Exception: return {"available": False} @app.get("/api/stats") diff --git a/readme.md b/readme.md index f086473..d4ed462 100644 --- a/readme.md +++ b/readme.md @@ -12,6 +12,7 @@ Built with FastAPI + SQLite + Jinja2. Runs on Python 3.13. No Docker required. - **Orange Search Styling** — Search results, WEB badge, and search button share consistent orange color scheme - **Expanded Refusal Patterns** — Added "As an AI model", "based on my training data", "I don't have the capability" - **Code cleanup** — Removed unused `JSONResponse` import and dead `raw_results_md` variable +- **Bug fixes** — Replaced bare `except` clauses with `except Exception`; corrected `add_memory()` return type to `int | None`; updated `TemplateResponse` call to Starlette's current API signature ## What's New in v1.4.0