We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 36f058d commit bb51eadCopy full SHA for bb51ead
zh/dev/star/guides/listen-message-event.md
@@ -252,6 +252,22 @@ async def on_astrbot_loaded(self):
252
253
```
254
255
+#### 等待 LLM 请求时
256
+
257
+在 AstrBot 准备调用 LLM 但还未获取会话锁时,会触发 `on_waiting_llm_request` 钩子。
258
259
+这个钩子适合用于发送"正在等待请求..."等用户反馈提示,亦或是在锁外及时获取LLM请求而不用等到锁被释放。
260
261
+```python
262
+from astrbot.api.event import filter, AstrMessageEvent
263
264
+@filter.on_waiting_llm_request()
265
+async def on_waiting_llm(self, event: AstrMessageEvent):
266
+ await event.send("🤔 正在等待请求...")
267
+```
268
269
+> 这里不能使用 yield 来发送消息。如需发送,请直接使用 `event.send()` 方法。
270
271
#### LLM 请求时
272
273
在 AstrBot 默认的执行流程中,在调用 LLM 前,会触发 `on_llm_request` 钩子。
0 commit comments