fix: resolve all flake8 lint errors (118 → 0)
CI / lint (push) Successful in 8s
CI / lint (pull_request) Successful in 5s
CI / test (push) Failing after 8s
CI / test (pull_request) Failing after 8s
CI / notify-on-failure (push) Successful in 1s
CI / notify-on-failure (pull_request) Successful in 3s

This commit is contained in:
cfdaily
2026-06-09 16:43:41 +08:00
parent 62d8ced8ed
commit 09a0928bbc
24 changed files with 89 additions and 106 deletions
+14 -13
View File
@@ -25,6 +25,14 @@ from src.daemon.inbox import InboxWatcher
from src.daemon.guardrails import GuardrailEngine
from src.utils import get_data_root
from src.api.blackboard_routes import router as blackboard_router
from src.api.checkpoint_routes import router as checkpoint_router
from src.api.daemon_routes import router as daemon_router
from src.api.project_routes import router as project_router
from src.api.sse_routes import router as sse_router
from src.api.mail_routes import router as mail_router
from src.api.toolchain_routes import router as toolchain_router
logger = logging.getLogger("moziplus-v2")
# ---------------------------------------------------------------------------
@@ -191,7 +199,7 @@ async def lifespan(app: FastAPI):
)
# ExperienceDistiller(经验自动蒸馏)
experience_config = config.get("experience", {})
config.get("experience", {})
experience_distiller = ExperienceDistiller(
store=ExperienceStore(store_path=DATA_ROOT / "experiences.jsonl"),
)
@@ -252,14 +260,6 @@ app.add_middleware(
# API 路由注册
# ---------------------------------------------------------------------------
from src.api.blackboard_routes import router as blackboard_router
from src.api.checkpoint_routes import router as checkpoint_router
from src.api.daemon_routes import router as daemon_router
from src.api.project_routes import router as project_router
from src.api.sse_routes import router as sse_router
from src.api.mail_routes import router as mail_router
from src.api.toolchain_routes import router as toolchain_router
app.include_router(blackboard_router)
app.include_router(checkpoint_router)
app.include_router(daemon_router)
@@ -289,16 +289,17 @@ async def list_projects_compat():
DIST_DIR = Path(__file__).parent / "frontend" / "dist"
if DIST_DIR.exists():
# v3.1: 缓存策略 - HTML 不缓存(确保新版本生效),JS/CSS 长缓存(Vite content hash 已处理)
import mimetypes
_static_app = StaticFiles(directory=str(DIST_DIR), html=True)
class CachedStaticFiles:
"""包装 StaticFiles,添加 Cache-Control 头"""
def __init__(self, app):
self._app = app
async def __call__(self, scope, receive, send):
original_send = send
async def patched_send(message):
if message.get("type") == "http.response.start":
headers = dict(message.get("headers", []))
@@ -310,5 +311,5 @@ if DIST_DIR.exists():
message["headers"] = list(headers.items())
await original_send(message)
await self._app(scope, receive, patched_send)
app.mount("/", CachedStaticFiles(_static_app), name="frontend")