fix: waking bot with a reply component and empty user prompt (#8461)

* Update internal.py

* Update astr_main_agent.py

* Update astr_main_agent.py

* ruff

* Update astr_main_agent.py
This commit is contained in:
lingyun14
2026-06-01 10:03:24 +08:00
committed by GitHub
parent c89ac61892
commit e4044cc5a0
2 changed files with 8 additions and 2 deletions

View File

@@ -1428,8 +1428,10 @@ async def build_main_agent(
except Exception as exc: # noqa: BLE001
logger.error("Error occurred while applying file extract: %s", exc)
has_reply = any(isinstance(comp, Reply) for comp in event.message_obj.message)
if not req.prompt and not req.image_urls and not req.audio_urls:
if not event.get_group_id() and req.extra_user_content_parts:
if has_reply or req.extra_user_content_parts:
req.prompt = "<attachment>"
else:
return None

View File

@@ -19,7 +19,7 @@ from astrbot.core.astr_main_agent import (
MainAgentBuildResult,
build_main_agent,
)
from astrbot.core.message.components import File, Image, Record, Video
from astrbot.core.message.components import File, Image, Record, Reply, Video
from astrbot.core.message.message_event_result import (
MessageChain,
MessageEventResult,
@@ -177,11 +177,15 @@ class InternalAgentSubStage(Stage):
isinstance(comp, (Image, File, Record, Video))
for comp in event.message_obj.message
)
has_reply = any(
isinstance(comp, Reply) for comp in event.message_obj.message
)
if (
not has_provider_request
and not has_valid_message
and not has_media_content
and not has_reply
):
logger.debug("skip llm request: empty message and no provider_request")
return