feat: 更新接口返回值
This commit is contained in:
@@ -110,7 +110,7 @@ JSON 数据包含 userInfo(用户信息)和月度健康数据。
|
|||||||
各指标包含:totalRecords、startValue、endValue、maxValue、minValue、avgValue、netChange、normalDays/Count、abnormalDays/Count、abnormalRate、maxConsecutiveAbnormal
|
各指标包含:totalRecords、startValue、endValue、maxValue、minValue、avgValue、netChange、normalDays/Count、abnormalDays/Count、abnormalRate、maxConsecutiveAbnormal
|
||||||
- weight:体重
|
- weight:体重
|
||||||
- sleep:睡眠(含 qualifiedDays、qualifiedRate)
|
- sleep:睡眠(含 qualifiedDays、qualifiedRate)
|
||||||
- sport:运动(含 sportDays、frequency、totalDuration、categoryDistribution、maxConsecutiveNoSport)
|
- sport:运动(含 sportDays、frequency、totalDuration、categoryDistribution、maxConsecutiveNoSport),单位均为分钟
|
||||||
- bloodPressure:血压(systolic、diastolic、heartRate)
|
- bloodPressure:血压(systolic、diastolic、heartRate)
|
||||||
- bloodSugar:血糖(fasting、premeal、postmeal、bedtime)
|
- bloodSugar:血糖(fasting、premeal、postmeal、bedtime)
|
||||||
- temperature:体温(含 lowFeverDays、highFeverDays)
|
- temperature:体温(含 lowFeverDays、highFeverDays)
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ from service import agent_service
|
|||||||
router = APIRouter(prefix="/agent", tags=["Agent"])
|
router = APIRouter(prefix="/agent", tags=["Agent"])
|
||||||
|
|
||||||
|
|
||||||
@router.post("/article/generate")
|
@router.post("/tip/generate")
|
||||||
def generate_article(db: Session = Depends(get_db)):
|
def generate_article(db: Session = Depends(get_db)):
|
||||||
return agent_service.query_article_agent(db)
|
return agent_service.query_article_agent(db)
|
||||||
|
|
||||||
|
|
||||||
@router.get("/article/latest")
|
@router.get("/tip/latest")
|
||||||
def latest_article(db: Session = Depends(get_db)):
|
def latest_article(db: Session = Depends(get_db)):
|
||||||
return agent_service.get_latest_article(db)
|
return agent_service.get_latest_article(db)
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ def get_latest_article(db: Session):
|
|||||||
)
|
)
|
||||||
article = result.scalar_one_or_none()
|
article = result.scalar_one_or_none()
|
||||||
|
|
||||||
return article
|
return article.content
|
||||||
|
|
||||||
|
|
||||||
def query_recipe_agent(db: Session):
|
def query_recipe_agent(db: Session):
|
||||||
@@ -97,9 +97,9 @@ def get_latest_recipe(db: Session):
|
|||||||
result = db.execute(
|
result = db.execute(
|
||||||
select(Recipe).where(Recipe.date == today)
|
select(Recipe).where(Recipe.date == today)
|
||||||
)
|
)
|
||||||
article = result.scalar_one_or_none()
|
recipe = result.scalar_one_or_none()
|
||||||
|
|
||||||
return article
|
return recipe.content
|
||||||
|
|
||||||
|
|
||||||
def query_report_agent(req: ReportAgentRequest):
|
def query_report_agent(req: ReportAgentRequest):
|
||||||
|
|||||||
@@ -14,11 +14,13 @@ def upload_report(report: str, db: Session):
|
|||||||
db.commit()
|
db.commit()
|
||||||
db.refresh(report)
|
db.refresh(report)
|
||||||
|
|
||||||
return True
|
return report.id
|
||||||
|
|
||||||
|
|
||||||
def query_report(id: int, db: Session):
|
def query_report(id: int, db: Session):
|
||||||
result = db.execute(
|
result = db.execute(
|
||||||
select(Report).where(Report.id == id)
|
select(Report).where(Report.id == id)
|
||||||
)
|
)
|
||||||
return result.scalar_one_or_none()
|
report = result.scalar_one_or_none()
|
||||||
|
|
||||||
|
return report.content
|
||||||
|
|||||||
Reference in New Issue
Block a user