Repository navigation
fix(respond): keep platform-specific components when checking for empty chains - #10716
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
…ty chains Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Hey - I've reviewed your changes and they look great!
Sourcery assessment
Needs a human reviewer. Unknown platform-specific components now make a chain non-empty, so it can be passed on and sent through the platform adapter. If that causes an unintended response or card to reach users, reverting prevents future sends but cannot unsend what was already delivered.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RespondStage._is_empty_message_chainonly knows the built-in component types. Any component without an entry in_component_validatorsis treated as empty, so a chain made only of platform-specific components, such asDiscordEmbedorDiscordView, is dropped withThe message is empty; skipping the respond stage.before it reaches the Discord adapter. #7965 describes this as the third part of the issue. The same thing happens to a chain that contains onlyAtAll, because it is a subclass ofAtand the lookup is by exact type.The respond stage cannot know what makes a platform component empty, so it should leave that decision to the adapter.
Related to #7965. This complements #10710, which fixes constructing the Discord components; this PR is independent of it.
Modifications / 改动点
astrbot/core/pipeline/respond/stage.py: a component with no registered validator now counts as content. Built-in components keep their existing checks, so emptyPlain,Image(file="")and similar chains are still skipped.tests/unit/test_respond_stage_empty_chain.py: covers a platform-specific component on its own and next to blank text, and checks that empty built-in chains are still skipped.This is NOT a breaking change. / 这不是一个破坏性变更。
Screenshots or Test Results / 运行截图或测试结果
ruff format/ruff checkpass.Checklist / 检查清单
Summary by Sourcery
Allow platform-specific message components to reach adapters while retaining existing empty-chain filtering for built-in components.
Bug Fixes:
Enhancements:
Tests: