feat: 增加食谱Agent
This commit is contained in:
20
main.py
20
main.py
@@ -11,17 +11,25 @@ from service import agent_service
|
||||
scheduler = BackgroundScheduler()
|
||||
|
||||
|
||||
def job_task():
|
||||
def tip_job_task():
|
||||
"""定时执行的任务"""
|
||||
try:
|
||||
print(f"定时任务执行: {datetime.now()}")
|
||||
agent_service.generate_tip_agent()
|
||||
print(f"今日资讯定时任务执行: {datetime.now()}")
|
||||
agent_service.query_tip_agent()
|
||||
except Exception as e:
|
||||
print(f"定时任务异常: {e}")
|
||||
print(f"今日资讯定时任务异常: {e}")
|
||||
|
||||
def recipe_job_task():
|
||||
"""定时执行的任务"""
|
||||
try:
|
||||
print(f"今日菜谱定时任务执行: {datetime.now()}")
|
||||
agent_service.query_recipe_agent()
|
||||
except Exception as e:
|
||||
print(f"今日菜谱定时任务异常: {e}")
|
||||
|
||||
|
||||
scheduler.add_job(job_task, trigger="cron", hour=2, minute=0, second=0, id="daily_gen_tips", replace_existing=True)
|
||||
|
||||
scheduler.add_job(tip_job_task, trigger="cron", hour=2, minute=0, second=0, id="daily_gen_tips", replace_existing=True)
|
||||
scheduler.add_job(recipe_job_task, trigger="cron", hour=3, minute=0, second=0, id="daily_gen_recipes", replace_existing=True)
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
|
||||
Reference in New Issue
Block a user