This commit is contained in:
@ -59,6 +59,7 @@ SYSTEM_PROMPT = """你是一个专门解析提醒请求的助手。请分析用
|
|||||||
|
|
||||||
pt_pattern = re.compile(
|
pt_pattern = re.compile(
|
||||||
r"^PT"
|
r"^PT"
|
||||||
|
r"((?P<year>\d+)Y)?"
|
||||||
r"((?P<day>\d+)D)?"
|
r"((?P<day>\d+)D)?"
|
||||||
r"((?P<hour>\d+)H)?"
|
r"((?P<hour>\d+)H)?"
|
||||||
r"((?P<minute>\d+)M)?"
|
r"((?P<minute>\d+)M)?"
|
||||||
@ -107,13 +108,15 @@ async def ask_ai(expression: str, now: datetime.datetime | None = None) -> tuple
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if datetime_delta and (match := pt_pattern.match(datetime_delta)):
|
if datetime_delta and (match := pt_pattern.match(datetime_delta)):
|
||||||
|
years = tryint(match.group("year"))
|
||||||
days = tryint(match.group("day"))
|
days = tryint(match.group("day"))
|
||||||
hours = tryint(match.group("hour"))
|
hours = tryint(match.group("hour"))
|
||||||
minutes = tryint(match.group("minute"))
|
minutes = tryint(match.group("minute"))
|
||||||
seconds = tryint(match.group("second"))
|
seconds = tryint(match.group("second"))
|
||||||
|
|
||||||
dt = datetime.timedelta(days=days, hours=hours, minutes=minutes, seconds=seconds)
|
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}")
|
logger.warning(f"提醒功能:解析 AI 返回值时没有找到解析方法 raw={result}")
|
||||||
return (None, "")
|
return (None, "")
|
||||||
|
|||||||
Reference in New Issue
Block a user