fix(chatai): matcher 限定 * 前缀规则,避免 block 吞掉 wtfllm 等低优先级插件消息
This commit is contained in:
@@ -34,7 +34,13 @@ _ai_client: OpenAI | None = None
|
|||||||
_recall_tasks: set[asyncio.Task] = set()
|
_recall_tasks: set[asyncio.Task] = set()
|
||||||
|
|
||||||
# 注册消息事件处理器
|
# 注册消息事件处理器
|
||||||
message_handler = on_message(priority=50, block=True)
|
# 只匹配 "*" 前缀消息:block=True 会拦截更低优先级的 matcher(如 wtfllm),
|
||||||
|
# 若不限定规则,全量消息都会被本插件吞掉,导致其他插件无法响应。
|
||||||
|
def _is_ai_prefix(event) -> bool:
|
||||||
|
return event.get_plaintext().strip().startswith("*")
|
||||||
|
|
||||||
|
|
||||||
|
message_handler = on_message(rule=_is_ai_prefix, priority=50, block=True)
|
||||||
|
|
||||||
# 确保输出目录存在
|
# 确保输出目录存在
|
||||||
os.makedirs("data/chatai", exist_ok=True)
|
os.makedirs("data/chatai", exist_ok=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user