Fix type errors and bare except clauses in app.py; update readme
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
6
app.py
6
app.py
@@ -235,7 +235,7 @@ def get_db():
|
|||||||
# MEMORY SYSTEM (FTS5)
|
# 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."""
|
"""Store a new memory. Returns rowid."""
|
||||||
db = get_db()
|
db = get_db()
|
||||||
now = datetime.now(timezone.utc).isoformat()
|
now = datetime.now(timezone.utc).isoformat()
|
||||||
@@ -497,7 +497,7 @@ if static_dir.exists():
|
|||||||
|
|
||||||
@app.get("/", response_class=HTMLResponse)
|
@app.get("/", response_class=HTMLResponse)
|
||||||
async def index(request: Request):
|
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")
|
@app.get("/api/models")
|
||||||
async def list_models():
|
async def list_models():
|
||||||
@@ -533,7 +533,7 @@ async def search_status():
|
|||||||
try:
|
try:
|
||||||
resp = await client.get(f"{SEARXNG_BASE}/search", params={"q": "test", "format": "json"}, timeout=5)
|
resp = await client.get(f"{SEARXNG_BASE}/search", params={"q": "test", "format": "json"}, timeout=5)
|
||||||
return {"available": resp.status_code == 200}
|
return {"available": resp.status_code == 200}
|
||||||
except:
|
except Exception:
|
||||||
return {"available": False}
|
return {"available": False}
|
||||||
|
|
||||||
@app.get("/api/stats")
|
@app.get("/api/stats")
|
||||||
|
|||||||
@@ -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
|
- **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"
|
- **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
|
- **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
|
## What's New in v1.4.0
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user