rebase 清理

This commit is contained in:
Windpicker-owo
2025-11-19 23:45:47 +08:00
parent 829bc9b4bc
commit 40709d95de
60 changed files with 465 additions and 10066 deletions

View File

@@ -102,9 +102,7 @@ async def generate_reply(
reply_to: 回复对象,格式为 "发送者:消息内容"
reply_message: 回复的原始消息
extra_info: 额外信息,用于补充上下文
reply_reason: 回复原因
available_actions: 可用动作
choosen_actions: 已选动作
enable_tool: 是否启用工具调用
enable_splitter: 是否启用消息分割器
enable_chinese_typo: 是否启用错字生成器
@@ -129,9 +127,6 @@ async def generate_reply(
reply_to = action_data.get("reply_to", "")
if not extra_info and action_data:
extra_info = action_data.get("extra_info", "")
if not reply_reason and action_data:
reply_reason = action_data.get("reason", "")
# 从action_data中提取prompt_mode
prompt_mode = "s4u" # 默认使用s4u模式
@@ -153,13 +148,11 @@ async def generate_reply(
extra_info = f"思考过程:{thinking}"
# 调用回复器生成回复
success, llm_response_dict, prompt, selected_expressions = await replyer.generate_reply_with_context(
success, llm_response_dict, prompt = await replyer.generate_reply_with_context(
reply_to=reply_to,
extra_info=extra_info,
available_actions=available_actions,
choosen_actions=choosen_actions,
enable_tool=enable_tool,
reply_message=reply_message,
reply_reason=reply_reason,
from_plugin=from_plugin,
stream_id=chat_stream.stream_id if chat_stream else chat_id,
reply_message=reply_message,
@@ -178,16 +171,10 @@ async def generate_reply(
logger.debug(f"[GeneratorAPI] 回复生成成功,生成了 {len(reply_set)} 个回复项")
if return_prompt:
if return_expressions:
return success, reply_set, (prompt, selected_expressions)
else:
return success, reply_set, prompt
return success, reply_set, prompt
else:
if return_expressions:
return success, reply_set, (None, selected_expressions)
else:
return success, reply_set, None
return success, reply_set, None
except ValueError as ve:
raise ve

View File

@@ -29,7 +29,7 @@ def get_person_id(platform: str, user_id: int | str) -> str:
这是一个核心的辅助函数,用于生成统一的用户标识。
"""
try:
return Person(platform=platform, user_id=str(user_id)).person_id
return PersonInfoManager.get_person_id(platform, user_id)
except Exception as e:
logger.error(f"[PersonAPI] 获取person_id失败: platform={platform}, user_id={user_id}, error={e}")
return ""

View File

@@ -199,7 +199,6 @@ async def _send_to_target(
reply_to_message: dict[str, Any] | None = None,
storage_message: bool = True,
show_log: bool = True,
selected_expressions:List[int] = None,
) -> bool:
"""向指定目标发送消息的内部实现
@@ -292,7 +291,6 @@ async def _send_to_target(
is_emoji=(message_type == "emoji"),
thinking_start_time=current_time,
reply_to=reply_to_platform_id,
selected_expressions=selected_expressions,
)
# 发送消息
@@ -330,7 +328,6 @@ async def text_to_stream(
reply_to_message: dict[str, Any] | None = None,
set_reply: bool = True,
storage_message: bool = True,
selected_expressions:List[int] = None,
) -> bool:
"""向指定流发送文本消息
@@ -354,7 +351,6 @@ async def text_to_stream(
set_reply=set_reply,
reply_to_message=reply_to_message,
storage_message=storage_message,
selected_expressions=selected_expressions,
)
@@ -412,7 +408,7 @@ async def command_to_stream(
bool: 是否发送成功
"""
return await _send_to_target(
"command", command, stream_id, display_message, typing=False, storage_message=storage_message, set_reply=set_reply,reply_message=reply_message
"command", command, stream_id, display_message, typing=False, storage_message=storage_message
)

View File

@@ -325,12 +325,11 @@ class BaseAction(ABC):
return await send_api.text_to_stream(
text=content,
stream_id=self.chat_id,
set_reply=set_reply,
reply_message=reply_message,
reply_to=reply_to,
typing=typing,
)
async def send_emoji(self, emoji_base64: str, set_reply: bool = False,reply_message: Optional[Dict[str, Any]] = None) -> bool:
async def send_emoji(self, emoji_base64: str) -> bool:
"""发送表情包
Args:
@@ -343,9 +342,9 @@ class BaseAction(ABC):
logger.error(f"{self.log_prefix} 缺少聊天ID")
return False
return await send_api.emoji_to_stream(emoji_base64, self.chat_id,set_reply=set_reply,reply_message=reply_message)
return await send_api.emoji_to_stream(emoji_base64, self.chat_id)
async def send_image(self, image_base64: str, set_reply: bool = False,reply_message: Optional[Dict[str, Any]] = None) -> bool:
async def send_image(self, image_base64: str) -> bool:
"""发送图片
Args:
@@ -358,9 +357,9 @@ class BaseAction(ABC):
logger.error(f"{self.log_prefix} 缺少聊天ID")
return False
return await send_api.image_to_stream(image_base64, self.chat_id,set_reply=set_reply,reply_message=reply_message)
return await send_api.image_to_stream(image_base64, self.chat_id)
async def send_custom(self, message_type: str, content: str, typing: bool = False, set_reply: bool = False,reply_message: Optional[Dict[str, Any]] = None) -> bool:
async def send_custom(self, message_type: str, content: str, typing: bool = False, reply_to: str = "") -> bool:
"""发送自定义类型消息
Args:
@@ -381,8 +380,7 @@ class BaseAction(ABC):
content=content,
stream_id=self.chat_id,
typing=typing,
set_reply=set_reply,
reply_message=reply_message,
reply_to=reply_to,
)
async def store_action_info(
@@ -465,7 +463,6 @@ class BaseAction(ABC):
logger.info(f"{log_prefix} 尝试调用Action: {action_name}")
try:
from src.plugin_system.core.component_registry import component_registry
# 1. 从注册中心获取Action类
from src.plugin_system.core.component_registry import component_registry

View File

@@ -827,8 +827,7 @@ class ComponentRegistry:
plugin_info = self.get_plugin_info(plugin_name)
return plugin_info.components if plugin_info else []
@staticmethod
def get_plugin_config(plugin_name: str) -> dict:
def get_plugin_config(self, plugin_name: str) -> dict:
"""获取插件配置
Args: