Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ async def process(
follow_up_capture: FollowUpCapture | None = None
follow_up_consumed_marked = False
follow_up_activated = False
typing_requested = False
try:
streaming_response = self.streaming_response
if (enable_streaming := event.get_extra("enable_streaming")) is not None:
Expand Down Expand Up @@ -178,7 +179,11 @@ async def process(
)
return

await event.send_typing()
try:
typing_requested = True
await event.send_typing()
except Exception:
logger.warning("send_typing failed", exc_info=True)
await call_event_hook(event, EventType.OnWaitingLLMRequestEvent)

async with session_lock_manager.acquire_lock(event.unified_msg_origin):
Expand Down Expand Up @@ -377,6 +382,11 @@ async def process(
)
await event.send(MessageChain().message(error_text))
finally:
if typing_requested:
try:
await event.stop_typing()
except Exception:
logger.warning("stop_typing failed", exc_info=True)
if follow_up_capture:
await finalize_follow_up_capture(
follow_up_capture,
Expand Down
6 changes: 6 additions & 0 deletions astrbot/core/platform/astr_message_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,12 @@ async def send_typing(self) -> None:
默认实现为空,由具体平台按需重写。
"""

async def stop_typing(self) -> None:
"""停止输入中状态。
默认实现为空,由具体平台按需重写。
"""

async def _pre_send(self) -> None:
"""调度器会在执行 send() 前调用该方法 deprecated in v3.5.18"""

Expand Down
Loading
Loading