fix:修复禁言插件和豆包画图插件

This commit is contained in:
SengokuCola
2025-06-11 00:18:48 +08:00
parent 6455dab5b8
commit 22aae4d1cd
17 changed files with 271 additions and 685 deletions

View File

@@ -166,14 +166,13 @@ class BaseAction(ABC):
if not chat_stream:
logger.error(f"{self.log_prefix} 没有可用的聊天流发送命令")
return False
command_content = str(command_data)
if chat_stream.group_info:
# 群聊
success = await self.api.send_message_to_target(
message_type="command",
content=command_content,
content=command_data,
platform=chat_stream.platform,
target_id=str(chat_stream.group_info.group_id),
is_group=True,
@@ -183,7 +182,7 @@ class BaseAction(ABC):
# 私聊
success = await self.api.send_message_to_target(
message_type="command",
content=command_content,
content=command_data,
platform=chat_stream.platform,
target_id=str(chat_stream.user_info.user_id),
is_group=False,
@@ -213,7 +212,7 @@ class BaseAction(ABC):
"""
try:
from src.chat.heart_flow.observation.chatting_observation import ChattingObservation
from src.chat.message_receive.message import create_empty_anchor_message
from src.chat.focus_chat.hfc_utils import create_empty_anchor_message
# 获取服务
expressor = self.api.get_service("expressor")
@@ -281,7 +280,7 @@ class BaseAction(ABC):
"""
try:
from src.chat.heart_flow.observation.chatting_observation import ChattingObservation
from src.chat.message_receive.message import create_empty_anchor_message
from src.chat.focus_chat.hfc_utils import create_empty_anchor_message
# 获取服务
replyer = self.api.get_service("replyer")

View File

@@ -102,7 +102,7 @@ class BaseCommand(ABC):
# 使用send_message_to_target方法发送命令
chat_stream = self.message.chat_stream
command_content = str(command_data)
command_content = command_data
if chat_stream.group_info:
# 群聊

View File

@@ -167,16 +167,26 @@ class BasePlugin(ABC):
return True
def get_config(self, key: str, default: Any = None) -> Any:
"""获取插件配置值
"""获取插件配置值,支持嵌套键访问
Args:
key: 配置键名
key: 配置键名,支持嵌套访问如 "section.subsection.key"
default: 默认值
Returns:
Any: 配置值或默认值
"""
return self.config.get(key, default)
# 支持嵌套键访问
keys = key.split('.')
current = self.config
for k in keys:
if isinstance(current, dict) and k in current:
current = current[k]
else:
return default
return current
def register_plugin(cls):