Skip to content

feat: add global LLM no-reply prefixes - #10180

Open
iuiu-py wants to merge 1 commit into
AstrBotDevs:masterfrom
iuiu-py:feat/global-llm-no-reply-prefixes
Open

iuiu-py wants to merge 1 commit into
AstrBotDevs:masterfrom
iuiu-py:feat/global-llm-no-reply-prefixes

Conversation

@iuiu-py

@iuiu-py iuiu-py commented Sep 21, 2026

Copy link
Copy Markdown

Motivation

Fixes #9563.

AstrBot currently has no global way to say "messages with this prefix are intentionally not for the LLM." This makes it difficult to reserve CLI-like prefixes while still allowing commands and plugins to handle those messages.

Modifications

  • Add provider_settings.llm_no_reply_prefixes, defaulting to an empty list.
  • Add WebUI metadata for the string-list setting next to the existing provider wake-prefix setting.
  • Detect configured prefixes on the original stripped message before wake prefixes are removed, so /style 1 still matches / after the wake prefix is stripped to style 1.
  • Mark matching events internally and skip only the normal LLM fallback; plugin-provided ProviderRequest objects continue to run.
  • Ignore blank prefixes and preserve case-sensitive prefix matching.
  • Document the setting in both English and Chinese configuration references.

Tests

  • Added focused unit tests for configuration metadata, original-prefix matching after wake stripping, blank-prefix handling, and normal/plugin LLM request gating.
  • uv run pytest -q tests/unit/test_llm_no_reply_prefixes.py — 6 passed.
  • uv run pytest -q tests/unit — 1362 passed, 25 skipped.
  • uv run ruff format --check . and uv run ruff check . — passed.

Summary by Sourcery

Add configurable no-reply prefixes to prevent selected messages from triggering ordinary LLM responses without blocking command or plugin processing.

New Features:

  • Add a configurable global list of prefixes that suppresses normal LLM fallback requests while leaving command and plugin handling available.

Enhancements:

  • Detect no-reply prefixes against the original message before wake-prefix processing, with case-sensitive matching and blank-prefix exclusion.

Documentation:

  • Document the new no-reply prefix setting in English and Chinese configuration references.

Tests:

  • Add unit coverage for configuration metadata, prefix detection, blank prefixes, and normal versus plugin LLM request handling.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] 建议新增全局 LLM 不回复前缀配置

1 participant