From 506d0802e59f8efe00331f2fa90d959d340e69d7 Mon Sep 17 00:00:00 2001 From: minecraft1024a Date: Fri, 22 Aug 2025 16:22:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E7=8E=B0=E5=9C=A8=E6=97=A5=E7=A8=8B?= =?UTF-8?q?=E8=A1=A8=E4=BC=9A=E6=A0=B9=E6=8D=AE=E8=8A=82=E6=97=A5=E7=94=9F?= =?UTF-8?q?=E6=88=90=E4=B8=9C=E8=A5=BF=E4=BA=86(gemini=E4=BD=A0=E5=86=8D?= =?UTF-8?q?=E6=9C=89=E9=97=AE=E9=A2=98=E6=88=91=E5=B0=B1=E7=A0=8D=E4=BA=86?= =?UTF-8?q?=E4=BD=A0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/manager/schedule_manager.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/manager/schedule_manager.py b/src/manager/schedule_manager.py index ff09016a4..f6191225b 100644 --- a/src/manager/schedule_manager.py +++ b/src/manager/schedule_manager.py @@ -3,6 +3,7 @@ import asyncio import random from datetime import datetime, time, timedelta from typing import Optional, List, Dict, Any +from lunar_python import Lunar from pydantic import BaseModel, ValidationError, validator from src.common.database.sqlalchemy_models import Schedule, get_db_session @@ -175,6 +176,18 @@ class ScheduleManager: current_month_str = now.strftime("%Y-%m") weekday = now.strftime("%A") + # 新增:获取节日信息 + lunar = Lunar.fromDate(now) + festivals = lunar.getFestivals() + other_festivals = lunar.getOtherFestivals() + all_festivals = festivals + other_festivals + + festival_block = "" + if all_festivals: + festival_text = "、".join(all_festivals) + festival_block = f"**今天也是一个特殊的日子: {festival_text}!请在日程中考虑和庆祝这个节日。**" + + # 获取月度计划作为额外参考 monthly_plans_block = "" used_plan_ids = [] @@ -198,7 +211,7 @@ class ScheduleManager: prompt = f""" 我,{global_config.bot.nickname},需要为自己规划一份今天({today_str},星期{weekday})的详细日程安排。 - +{festival_block} **关于我**: - **核心人设**: {personality} - **具体习惯与兴趣**: