-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Labels
area:coreThe bug / feature is about astrbot's core, backendThe bug / feature is about astrbot's core, backendbugSomething isn't workingSomething isn't workingpriority: p0will fix asapwill fix asap
Description
What happened / 发生了什么
AstrBot/astrbot/core/pipeline/respond/stage.py
Lines 21 to 36 in 0c0f8bf
| _component_validators = { | |
| Comp.Plain: lambda comp: bool( | |
| comp.text and comp.text.strip(), | |
| ), # 纯文本消息需要strip | |
| Comp.Face: lambda comp: comp.id is not None, # QQ表情 | |
| Comp.Record: lambda comp: bool(comp.file), # 语音 | |
| Comp.Video: lambda comp: bool(comp.file), # 视频 | |
| Comp.At: lambda comp: bool(comp.qq) or bool(comp.name), # @ | |
| Comp.Image: lambda comp: bool(comp.file), # 图片 | |
| Comp.Reply: lambda comp: bool(comp.id) and comp.sender_id is not None, # 回复 | |
| Comp.Poke: lambda comp: comp.id != 0 and comp.qq != 0, # 戳一戳 | |
| Comp.Node: lambda comp: bool(comp.content), # 转发节点 | |
| Comp.Nodes: lambda comp: bool(comp.nodes), # 多个转发节点 | |
| Comp.File: lambda comp: bool(comp.file_ or comp.url), | |
| Comp.WechatEmoji: lambda comp: comp.md5 is not None, # 微信表情 | |
| } |
如上字典里没有 Comp.Json
AstrBot/astrbot/core/pipeline/respond/stage.py
Lines 95 to 114 in 0c0f8bf
| async def _is_empty_message_chain(self, chain: list[BaseMessageComponent]) -> bool: | |
| """检查消息链是否为空 | |
| Args: | |
| chain (list[BaseMessageComponent]): 包含消息对象的列表 | |
| """ | |
| if not chain: | |
| return True | |
| for comp in chain: | |
| comp_type = type(comp) | |
| # 检查组件类型是否在字典中 | |
| if comp_type in self._component_validators: | |
| if self._component_validators[comp_type](comp): | |
| return False | |
| # 如果所有组件都为空 | |
| return True |
并且检查函数为白名单
Reproduce / 如何复现?
随便发一个 json 消息
AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器
master 分支
OS
Not sure
Logs / 报错日志
[17:45:18.441] [Core] [INFO] [respond.stage:170]: Prepare to send -/: [ComponentType.Json]
[17:45:18.441] [Core] [INFO] [respond.stage:201]: 消息为空,跳过发送阶段
[17:45:18.443] [Core] [INFO] [core.astr_main_agent:932]: 未找到任何对话模型(提供商),跳过 LLM 请求处理。
Are you willing to submit a PR? / 你愿意提交 PR 吗?
- Yes! @NanoRocky
Code of Conduct
- I have read and agree to abide by the project's Code of Conduct。
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area:coreThe bug / feature is about astrbot's core, backendThe bug / feature is about astrbot's core, backendbugSomething isn't workingSomething isn't workingpriority: p0will fix asapwill fix asap