Skip to content

[Bug] webchat(内置平台)受 friend_message_needs_wake_prefix 限制,必须带唤醒前缀才能回复 #9211

Description

@Neo-millunnium

问题描述

friend_message_needs_wake_prefix 配置项本意是控制 QQ 等外部平台的私聊消息是否需要唤醒前缀(/),但当前实现是一刀切的——所有私聊/好友类型的消息都受此限制,导致 webchat(WebUI 内置聊天平台)也必须带 / 前缀才能触发回复

复现步骤

  1. 配置 friend_message_needs_wake_prefix: true
  2. 打开 AstrBot WebUI 前端聊天窗口
  3. 输入"你好"(不带 / 前缀)
  4. 消息被接收但无任何回复

根因

astrbot/core/pipeline/waking_check/stage.py 中,唤醒判断逻辑没有区分平台:

if event.is_private_chat() and not self.friend_message_needs_wake_prefix:

webchat 平台的消息类型为 MessageType.FRIEND_MESSAGEis_private_chat() 返回 true,因此被 friend_message_needs_wake_prefix 规则拦截。

影响范围

所有使用 AstrBot WebUI 内置聊天功能的用户,只要开启了 friend_message_needs_wake_prefix: true,webchat 就无法正常回复。

修复建议

在唤醒判断时对 webchat 平台做豁免:

if event.is_private_chat() and (not self.friend_message_needs_wake_prefix or event.get_platform_id() == "webchat"):

环境信息

  • AstrBot 版本: v4.26.5
  • 最新提交: a1a7de1
  • 系统: Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreThe bug / feature is about astrbot's core, backendarea:platformThe bug / feature is about IM platform adapter, such as QQ, Lark, Telegram, WebChat and so on.feature:chatuiThe bug / feature is about astrbot's chatui, webchat

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions