From 07ace8e6e9c3dc72c02875b9770dd00aad8bf6c3 Mon Sep 17 00:00:00 2001 From: passthem Date: Fri, 21 Nov 2025 16:19:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=B1=E6=98=AF=E5=8A=A0=E4=B8=AA=20Y=20?= =?UTF-8?q?=E7=9A=84=E4=BA=8B=E6=83=85=EF=BC=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- konabot/plugins/simple_notify/ask_llm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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, "")