From abacbe7a5d1eb443eb153df9174f1495dae7b5c0 Mon Sep 17 00:00:00 2001 From: Cxx0822 <1556464090@qq.com> Date: Fri, 4 Sep 2026 21:28:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=9B=B4=E6=96=B0=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- agent/prompt.py | 2 +- routers/agent.py | 4 ++-- service/agent_service.py | 6 +++--- service/report_service.py | 6 ++++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/agent/prompt.py b/agent/prompt.py index 6aa6dea..dc8e4a3 100644 --- a/agent/prompt.py +++ b/agent/prompt.py @@ -110,7 +110,7 @@ JSON 数据包含 userInfo(用户信息)和月度健康数据。 各指标包含:totalRecords、startValue、endValue、maxValue、minValue、avgValue、netChange、normalDays/Count、abnormalDays/Count、abnormalRate、maxConsecutiveAbnormal - weight:体重 - sleep:睡眠(含 qualifiedDays、qualifiedRate) -- sport:运动(含 sportDays、frequency、totalDuration、categoryDistribution、maxConsecutiveNoSport) +- sport:运动(含 sportDays、frequency、totalDuration、categoryDistribution、maxConsecutiveNoSport),单位均为分钟 - bloodPressure:血压(systolic、diastolic、heartRate) - bloodSugar:血糖(fasting、premeal、postmeal、bedtime) - temperature:体温(含 lowFeverDays、highFeverDays) diff --git a/routers/agent.py b/routers/agent.py index 1734145..1ae8555 100644 --- a/routers/agent.py +++ b/routers/agent.py @@ -8,12 +8,12 @@ from service import agent_service router = APIRouter(prefix="/agent", tags=["Agent"]) -@router.post("/article/generate") +@router.post("/tip/generate") def generate_article(db: Session = Depends(get_db)): return agent_service.query_article_agent(db) -@router.get("/article/latest") +@router.get("/tip/latest") def latest_article(db: Session = Depends(get_db)): return agent_service.get_latest_article(db) diff --git a/service/agent_service.py b/service/agent_service.py index 8ebe823..4b6723d 100644 --- a/service/agent_service.py +++ b/service/agent_service.py @@ -53,7 +53,7 @@ def get_latest_article(db: Session): ) article = result.scalar_one_or_none() - return article + return article.content def query_recipe_agent(db: Session): @@ -97,9 +97,9 @@ def get_latest_recipe(db: Session): result = db.execute( 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): diff --git a/service/report_service.py b/service/report_service.py index a41e6a3..ae6ed54 100644 --- a/service/report_service.py +++ b/service/report_service.py @@ -14,11 +14,13 @@ def upload_report(report: str, db: Session): db.commit() db.refresh(report) - return True + return report.id def query_report(id: int, db: Session): result = db.execute( select(Report).where(Report.id == id) ) - return result.scalar_one_or_none() + report = result.scalar_one_or_none() + + return report.content