feat: 人员库弹框显示人员图片
This commit is contained in:
19
web/app.py
19
web/app.py
@@ -195,6 +195,25 @@ async def rename_person(person_id: str, name: str):
|
||||
raise HTTPException(status_code=404, detail="人员不存在")
|
||||
|
||||
|
||||
@app.get("/api/persons/{person_id}/face")
|
||||
async def get_person_face(person_id: str):
|
||||
"""获取人员人脸图片"""
|
||||
from person_manager import person_manager
|
||||
from pathlib import Path
|
||||
|
||||
if person_id in person_manager.persons:
|
||||
face_path = person_manager.persons[person_id].get('face_path', '')
|
||||
if face_path and Path(face_path).exists():
|
||||
return FileResponse(face_path)
|
||||
|
||||
# 检查 faces_dir 中的默认图片
|
||||
face_file = person_manager.faces_dir / f"{person_id}.jpg"
|
||||
if face_file.exists():
|
||||
return FileResponse(str(face_file))
|
||||
|
||||
raise HTTPException(status_code=404, detail="人员图片不存在")
|
||||
|
||||
|
||||
@app.get("/api/stats/daily")
|
||||
async def get_daily_stats(date: str = None):
|
||||
"""获取每日统计数据"""
|
||||
|
||||
Reference in New Issue
Block a user