login+ai cluster

This commit is contained in:
stardrophere
2026-03-11 01:33:21 +08:00
parent 9fa07cfb07
commit 8ed819a580
39 changed files with 3392 additions and 610 deletions
+13
View File
@@ -0,0 +1,13 @@
# app/api/dependencies.py
from app.database import SessionLocal
def get_db():
"""
FastAPI 依赖注入:为每个 HTTP 请求提供独立的数据库会话。
请求处理完成后自动关闭,防止连接泄漏。
"""
db = SessionLocal()
try:
yield db
finally:
db.close()