feat: enhance UI, refactor services, improve templates and tests

- Replace image_extractor with pdf_image_extractor service
- Enhance pi_client with expanded API capabilities
- Improve summarizer service with additional features
- Update admin routes with more endpoints
- Add login page template
- Enhance detail page with comprehensive layout
- Improve search and trends pages
- Update base template with additional elements
- Refactor tests for better coverage
- Add validate_summary script
- Update project configuration and dependencies
This commit is contained in:
2026-06-07 19:38:58 +08:00
parent 4a72c35452
commit 0d293422ac
32 changed files with 2003 additions and 586 deletions
+10 -9
View File
@@ -6,6 +6,7 @@ from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.staticfiles import StaticFiles
from starlette.middleware.sessions import SessionMiddleware
from app.config import settings
from app.database import engine, init_db
@@ -56,17 +57,17 @@ def create_app() -> FastAPI:
init_db(engine)
logger.info("Database initialized at %s", settings.db_path)
# 安全警告
if settings.ADMIN_TOKEN == "change-me":
logger.warning(
"⚠️ ADMIN_TOKEN is the default value 'change-me'. Please change it in .env!"
)
# Session 中间件
app.add_middleware(SessionMiddleware, secret_key=settings.SECRET_KEY)
if settings.APP_HOST not in ("127.0.0.1", "localhost", "::1"):
# 安全警告
if settings.SECRET_KEY == "change-me":
logger.warning(
"⚠️ APP_HOST=%s is not localhost. "
"Ensure ADMIN_TOKEN is properly set and access is restricted.",
settings.APP_HOST,
"⚠️ SECRET_KEY is the default value 'change-me'. Please change it in .env!"
)
if not settings.ADMIN_PASSWORD:
logger.warning(
"⚠️ ADMIN_PASSWORD is empty. Please set it in .env!"
)
# 静态文件