Skip to content

Commit 8f8e831

Browse files
Update main.py
1 parent a7405e0 commit 8f8e831

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

  • astrbot/builtin_stars/astrbot

astrbot/builtin_stars/astrbot/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from astrbot.api.provider import LLMResponse, ProviderRequest
77
from astrbot.core import logger
88

9-
from .constants import LTM_ACTIVE_REPLY_KEY
9+
from .constants import LTM_ACTIVE_REPLY_IN_PROGRESS_KEY, LTM_ACTIVE_REPLY_KEY
1010
from .long_term_memory import LongTermMemory
1111

1212

@@ -99,7 +99,7 @@ async def decorate_llm_req(
9999
# so on_llm_response can correctly identify the active reply response
100100
active_reply_req_id = event.get_extra(LTM_ACTIVE_REPLY_KEY, None)
101101
if active_reply_req_id is not None and id(req) == active_reply_req_id:
102-
event.set_extra("_ltm_active_reply_in_progress", True)
102+
event.set_extra(LTM_ACTIVE_REPLY_IN_PROGRESS_KEY, True)
103103
try:
104104
await self.ltm.on_req_llm(event, req)
105105
except BaseException as e:
@@ -112,7 +112,7 @@ async def record_llm_resp_to_ltm(
112112
"""在 LLM 响应后记录对话"""
113113
if self.ltm and self.ltm_enabled(event):
114114
# Skip recording if this response is from an active reply request
115-
if event.get_extra("_ltm_active_reply_in_progress", False):
115+
if event.get_extra(LTM_ACTIVE_REPLY_IN_PROGRESS_KEY, False):
116116
return
117117
# Only record if group_icl_enable is on, to keep session_chats consistent
118118
# (handle_message is also guarded by group_icl_enable)
@@ -136,4 +136,4 @@ async def after_message_sent(self, event: AstrMessageEvent) -> None:
136136
logger.error(f"ltm: {e}")
137137
# 清除主动回复标记,避免 event 被复用时意外影响后续流程
138138
event.set_extra(LTM_ACTIVE_REPLY_KEY, None)
139-
event.set_extra("_ltm_active_reply_in_progress", False)
139+
event.set_extra(LTM_ACTIVE_REPLY_IN_PROGRESS_KEY, False)

0 commit comments

Comments
 (0)