AstrBot icon indicating copy to clipboard operation
AstrBot copied to clipboard

[Bug] 以唤醒词/开头会直接调用LMM回复

Open heiqiu47 opened this issue 6 months ago • 7 comments

What happened / 发生了什么

以设置的唤醒词(如:/)开头会直接调用LMM回复,如群聊中有人使用其他机器人的指令(如/grok),会直接调用LMM进行回复。(这应该是个bug,不是feature吧?)

Reproduce / 如何复现?

4.24.5版本,在Q群中以设置的唤醒词(如:/)开头,但不使用AstrBot中已经存在的指令,在今天重装过的情况下依旧复现。

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

4.24.5 Docker,onebot 11(NapCat)

OS

Linux

Logs / 报错日志

(日志没有出现报错) [2026-05-14 21:17:03.980] [Core] [INFO] [core.event_bus:61]: [default] [QQ(aiocqhttp)] 萌新⁧~喵⁧‭: [引用消息] /grok 分析一下画风,这是谁画的 [2026-05-14 21:17:19.453] [Core] [INFO] [respond.stage:183]: Prepare to send - 萌新: 喵~我看看这张图……画风好可爱呢!不过我暂时识别不出是哪位画师画的喵,可能是群里有大佬知道的喵~

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • [ ] Yes!

Code of Conduct

heiqiu47 avatar May 14 '26 13:05 heiqiu47

但是你会发现没有带上斜杠就可以调用指令,比方说你的/grok就是grok就行,如果加了唤醒词(以李华为例)就是李华grok来唤醒命令

而且我看所有人都是这个情况,需要去掉斜杠来使用命令,不清楚是bug还是feature

NotUNperson avatar May 14 '26 13:05 NotUNperson

Hi @heiqiu47! I'm Dosu and I’m helping the AstrBot team.

这是当前的预期行为(虽然可以理解为什么你觉得像是 bug)。

AstrBot 的消息处理流程是:唤醒词匹配 → 命令匹配 → 插件处理 → LLM 回退。当消息以唤醒词(如 /)开头但没有匹配到任何已注册命令时,系统会自动将消息转发给 LLM 处理 [1]。目前没有配置项可以单独关闭这个"未匹配命令回退到 LLM"的行为。

建议的解决方案:

  1. 更换唤醒词 — 将 AstrBot 的 wake_prefix 改为其他前缀(如 ! 或 #),避免与群内其他机器人的 / 指令冲突 [2]
  2. 使用 LLM 专用唤醒前缀 — 在 provider_settings 中设置 wake_prefix,这样只有同时满足 bot 唤醒词 + LLM 唤醒词的消息才会触发 LLM [3]
  3. 按会话关闭 LLM — 在多 bot 共存的群使用 /llm off 命令禁用该群的 LLM 回复

如果你认为应该增加一个"未匹配命令不回退 LLM"的选项,可以考虑作为 feature request 提出。

To reply, just mention @dosu.


Docs are dead. Just use Dosu.

Leave Feedback Ask Dosu about AstrBot Share Dosu with your team

dosubot[bot] avatar May 14 '26 13:05 dosubot[bot]

这明显是个预期效果,谁能来把这个issue关了

KaleidScoper avatar May 14 '26 19:05 KaleidScoper

或许可以有个讨论:是否应该将唤醒词与指令前缀分开

lingyun14beta avatar May 15 '26 09:05 lingyun14beta

其实设计的就是这样的

Yangyuwuhan avatar May 15 '26 14:05 Yangyuwuhan

或许可以有个讨论:是否应该将唤醒词与指令前缀分开

看到您的PR了,非常感谢:)

heiqiu47 avatar May 17 '26 03:05 heiqiu47

This is the expected behavior in the current design. Messages that start with the configured wake prefix are treated as messages addressed to AstrBot; if no registered command matches, they may fall back to the LLM response flow.

For groups where / conflicts with other bots, please use a different wake_prefix, configure an additional provider-level wake prefix, or disable LLM replies for that session when needed.

Closing this as expected behavior rather than a bug.

Soulter avatar Jun 27 '26 08:06 Soulter