mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-15 17:30:13 +08:00
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:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user