diff --git a/konabot/plugins/simple_notify/ask_llm.py b/konabot/plugins/simple_notify/ask_llm.py index 5b536bc..baa4c1e 100644 --- a/konabot/plugins/simple_notify/ask_llm.py +++ b/konabot/plugins/simple_notify/ask_llm.py @@ -59,6 +59,7 @@ SYSTEM_PROMPT = """你是一个专门解析提醒请求的助手。请分析用 pt_pattern = re.compile( r"^PT" + r"((?P\d+)Y)?" r"((?P\d+)D)?" r"((?P\d+)H)?" r"((?P\d+)M)?" @@ -107,13 +108,15 @@ async def ask_ai(expression: str, now: datetime.datetime | None = None) -> tuple pass if datetime_delta and (match := pt_pattern.match(datetime_delta)): + years = tryint(match.group("year")) days = tryint(match.group("day")) hours = tryint(match.group("hour")) minutes = tryint(match.group("minute")) seconds = tryint(match.group("second")) dt = datetime.timedelta(days=days, hours=hours, minutes=minutes, seconds=seconds) - return (now + dt, content) + now2 = now.replace(year=now.year + years) + return (now2 + dt, content) logger.warning(f"提醒功能:解析 AI 返回值时没有找到解析方法 raw={result}") return (None, "")