rufffffff
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
|
||||
from sqlalchemy import delete, func, select, update
|
||||
|
||||
from src.common.database.core.models import MonthlyPlan
|
||||
from src.common.database.core import get_db_session
|
||||
from src.common.database.core.models import MonthlyPlan
|
||||
from src.common.logger import get_logger
|
||||
from src.config.config import global_config
|
||||
|
||||
@@ -312,7 +312,7 @@ async def delete_plans_older_than(month: str):
|
||||
logger.info(f"没有找到比 {month} 更早的月度计划需要删除。")
|
||||
return 0
|
||||
|
||||
plan_months = sorted(list(set(p.target_month for p in plans_to_delete)))
|
||||
plan_months = sorted({p.target_month for p in plans_to_delete})
|
||||
logger.info(f"将删除 {len(plans_to_delete)} 条早于 {month} 的月度计划 (涉及月份: {', '.join(plan_months)})。")
|
||||
|
||||
# 然后,执行删除操作
|
||||
|
||||
@@ -100,7 +100,7 @@ class MonthlyPlanGenerationTask(AsyncTask):
|
||||
next_month = datetime(now.year + 1, 1, 1)
|
||||
else:
|
||||
next_month = datetime(now.year, now.month + 1, 1)
|
||||
|
||||
|
||||
sleep_seconds = (next_month - now).total_seconds()
|
||||
logger.info(
|
||||
f" 下一次月度计划生成任务将在 {sleep_seconds:.2f} 秒后运行 (北京时间 {next_month.strftime('%Y-%m-%d %H:%M:%S')})"
|
||||
@@ -110,7 +110,7 @@ class MonthlyPlanGenerationTask(AsyncTask):
|
||||
# 到达月初,先归档上个月的计划
|
||||
last_month = (next_month - timedelta(days=1)).strftime("%Y-%m")
|
||||
await self.monthly_plan_manager.plan_manager.archive_current_month_plans(last_month)
|
||||
|
||||
|
||||
# 为当前月生成新计划
|
||||
current_month = next_month.strftime("%Y-%m")
|
||||
logger.info(f" 到达月初,开始生成 {current_month} 的月度计划...")
|
||||
|
||||
@@ -97,4 +97,4 @@ MONTHLY_PLAN_GENERATION_PROMPT = Prompt(
|
||||
|
||||
请你扮演我,以我的身份和兴趣,为 {target_month} 制定合适的月度计划。
|
||||
""",
|
||||
)
|
||||
)
|
||||
|
||||
@@ -5,8 +5,8 @@ from typing import Any
|
||||
import orjson
|
||||
from sqlalchemy import select
|
||||
|
||||
from src.common.database.core.models import MonthlyPlan, Schedule
|
||||
from src.common.database.core import get_db_session
|
||||
from src.common.database.core.models import MonthlyPlan, Schedule
|
||||
from src.common.logger import get_logger
|
||||
from src.config.config import global_config
|
||||
from src.manager.async_task_manager import AsyncTask, async_task_manager
|
||||
|
||||
Reference in New Issue
Block a user