Merge remote-tracking branch 'upstream/r-dev' into r-dev
# Conflicts: # src/memory_system/chat_history_summarizer.py # src/memory_system/memory_retrieval.py # src/memory_system/retrieval_tools/__init__.py
This commit is contained in:
@@ -68,7 +68,6 @@ class DefaultReplyer:
|
||||
reply_reason: str = "",
|
||||
available_actions: Optional[Dict[str, ActionInfo]] = None,
|
||||
chosen_actions: Optional[List[ActionPlannerInfo]] = None,
|
||||
enable_tool: bool = True,
|
||||
from_plugin: bool = True,
|
||||
stream_id: Optional[str] = None,
|
||||
reply_message: Optional[SessionMessage] = None,
|
||||
@@ -87,7 +86,6 @@ class DefaultReplyer:
|
||||
reply_reason: 回复原因
|
||||
available_actions: 可用的动作信息字典
|
||||
chosen_actions: 已选动作
|
||||
enable_tool: 是否启用工具调用
|
||||
from_plugin: 是否来自插件
|
||||
|
||||
Returns:
|
||||
@@ -112,7 +110,6 @@ class DefaultReplyer:
|
||||
extra_info=extra_info,
|
||||
available_actions=available_actions,
|
||||
chosen_actions=chosen_actions,
|
||||
enable_tool=enable_tool,
|
||||
reply_message=reply_message,
|
||||
reply_reason=reply_reason,
|
||||
reply_time_point=reply_time_point,
|
||||
@@ -394,26 +391,20 @@ class DefaultReplyer:
|
||||
|
||||
return f"{expression_habits_title}\n{expression_habits_block}", selected_ids
|
||||
|
||||
async def build_tool_info(self, chat_history: str, sender: str, target: str, enable_tool: bool = True) -> str:
|
||||
async def build_tool_info(self, chat_history: str, sender: str, target: str) -> str:
|
||||
del chat_history
|
||||
del sender
|
||||
del target
|
||||
del enable_tool
|
||||
return ""
|
||||
"""构建工具信息块
|
||||
|
||||
Args:
|
||||
chat_history: 聊天历史记录
|
||||
reply_to: 回复对象,格式为 "发送者:消息内容"
|
||||
enable_tool: 是否启用工具调用
|
||||
|
||||
Returns:
|
||||
str: 工具信息字符串
|
||||
"""
|
||||
|
||||
if not enable_tool:
|
||||
return ""
|
||||
|
||||
try:
|
||||
# 使用工具执行器获取信息
|
||||
tool_results = []
|
||||
@@ -741,7 +732,6 @@ class DefaultReplyer:
|
||||
reply_reason: str = "",
|
||||
available_actions: Optional[Dict[str, ActionInfo]] = None,
|
||||
chosen_actions: Optional[List[ActionPlannerInfo]] = None,
|
||||
enable_tool: bool = True,
|
||||
reply_time_point: float = time.time(),
|
||||
think_level: int = 1,
|
||||
unknown_words: Optional[List[str]] = None,
|
||||
@@ -755,7 +745,6 @@ class DefaultReplyer:
|
||||
available_actions: 可用动作
|
||||
chosen_actions: 已选动作
|
||||
enable_timeout: 是否启用超时处理
|
||||
enable_tool: 是否启用工具调用
|
||||
reply_message: 回复的原始消息
|
||||
Returns:
|
||||
str: 构建好的上下文
|
||||
@@ -840,7 +829,7 @@ class DefaultReplyer:
|
||||
"expression_habits",
|
||||
),
|
||||
self._time_and_run_task(
|
||||
self.build_tool_info(chat_talking_prompt_short, sender, target, enable_tool=enable_tool), "tool_info"
|
||||
self.build_tool_info(chat_talking_prompt_short, sender, target), "tool_info"
|
||||
),
|
||||
self._time_and_run_task(self.get_prompt_info(chat_talking_prompt_short, sender, target), "prompt_info"),
|
||||
self._time_and_run_task(self.build_actions_prompt(available_actions, chosen_actions), "actions_info"),
|
||||
|
||||
@@ -174,7 +174,7 @@ class MaisakaReplyGenerator:
|
||||
|
||||
try:
|
||||
system_prompt = load_prompt(
|
||||
"maidairy_replyer",
|
||||
"maisaka_replyer",
|
||||
bot_name=global_config.bot.nickname,
|
||||
time_block=f"当前时间:{current_time}",
|
||||
identity=self._personality_prompt,
|
||||
@@ -193,7 +193,7 @@ class MaisakaReplyGenerator:
|
||||
]
|
||||
if extra_sections:
|
||||
user_sections.append("\n\n".join(extra_sections))
|
||||
user_sections.append(f"【你的想法】\n{reply_reason}")
|
||||
user_sections.append(f"【回复信息参考】\n{reply_reason}")
|
||||
user_sections.append("现在,你说:")
|
||||
|
||||
user_prompt = "\n\n".join(user_sections)
|
||||
@@ -288,7 +288,6 @@ class MaisakaReplyGenerator:
|
||||
reply_reason: str = "",
|
||||
available_actions: Optional[Dict[str, ActionInfo]] = None,
|
||||
chosen_actions: Optional[List[object]] = None,
|
||||
enable_tool: bool = True,
|
||||
from_plugin: bool = True,
|
||||
stream_id: Optional[str] = None,
|
||||
reply_message: Optional[SessionMessage] = None,
|
||||
@@ -303,7 +302,6 @@ class MaisakaReplyGenerator:
|
||||
"""结合上下文生成 Maisaka 的最终可见回复。"""
|
||||
del available_actions
|
||||
del chosen_actions
|
||||
del enable_tool
|
||||
del extra_info
|
||||
del from_plugin
|
||||
del log_reply
|
||||
|
||||
@@ -65,7 +65,6 @@ class PrivateReplyer:
|
||||
reply_reason: str = "",
|
||||
available_actions: Optional[Dict[str, ActionInfo]] = None,
|
||||
chosen_actions: Optional[List[ActionPlannerInfo]] = None,
|
||||
enable_tool: bool = True,
|
||||
from_plugin: bool = True,
|
||||
think_level: int = 1,
|
||||
stream_id: Optional[str] = None,
|
||||
@@ -84,7 +83,6 @@ class PrivateReplyer:
|
||||
reply_reason: 回复原因
|
||||
available_actions: 可用的动作信息字典
|
||||
chosen_actions: 已选动作
|
||||
enable_tool: 是否启用工具调用
|
||||
from_plugin: 是否来自插件
|
||||
|
||||
Returns:
|
||||
@@ -103,7 +101,6 @@ class PrivateReplyer:
|
||||
extra_info=extra_info,
|
||||
available_actions=available_actions,
|
||||
chosen_actions=chosen_actions,
|
||||
enable_tool=enable_tool,
|
||||
reply_message=reply_message,
|
||||
reply_reason=reply_reason,
|
||||
unknown_words=unknown_words,
|
||||
@@ -287,26 +284,20 @@ class PrivateReplyer:
|
||||
|
||||
return f"{expression_habits_title}\n{expression_habits_block}", selected_ids
|
||||
|
||||
async def build_tool_info(self, chat_history: str, sender: str, target: str, enable_tool: bool = True) -> str:
|
||||
async def build_tool_info(self, chat_history: str, sender: str, target: str) -> str:
|
||||
del chat_history
|
||||
del sender
|
||||
del target
|
||||
del enable_tool
|
||||
return ""
|
||||
"""构建工具信息块
|
||||
|
||||
Args:
|
||||
chat_history: 聊天历史记录
|
||||
reply_to: 回复对象,格式为 "发送者:消息内容"
|
||||
enable_tool: 是否启用工具调用
|
||||
|
||||
Returns:
|
||||
str: 工具信息字符串
|
||||
"""
|
||||
|
||||
if not enable_tool:
|
||||
return ""
|
||||
|
||||
try:
|
||||
# 使用工具执行器获取信息
|
||||
tool_results = []
|
||||
@@ -612,7 +603,6 @@ class PrivateReplyer:
|
||||
reply_reason: str = "",
|
||||
available_actions: Optional[Dict[str, ActionInfo]] = None,
|
||||
chosen_actions: Optional[List[ActionPlannerInfo]] = None,
|
||||
enable_tool: bool = True,
|
||||
unknown_words: Optional[List[str]] = None,
|
||||
) -> Tuple[str, List[int]]:
|
||||
"""
|
||||
@@ -624,7 +614,6 @@ class PrivateReplyer:
|
||||
available_actions: 可用动作
|
||||
chosen_actions: 已选动作
|
||||
enable_timeout: 是否启用超时处理
|
||||
enable_tool: 是否启用工具调用
|
||||
reply_message: 回复的原始消息
|
||||
Returns:
|
||||
str: 构建好的上下文
|
||||
@@ -719,7 +708,7 @@ class PrivateReplyer:
|
||||
),
|
||||
# self._time_and_run_task(self.build_relation_info(chat_talking_prompt_short, sender), "relation_info"),
|
||||
self._time_and_run_task(
|
||||
self.build_tool_info(chat_talking_prompt_short, sender, target, enable_tool=enable_tool), "tool_info"
|
||||
self.build_tool_info(chat_talking_prompt_short, sender, target), "tool_info"
|
||||
),
|
||||
self._time_and_run_task(self.get_prompt_info(chat_talking_prompt_short, sender, target), "prompt_info"),
|
||||
self._time_and_run_task(self.build_actions_prompt(available_actions, chosen_actions), "actions_info"),
|
||||
|
||||
Reference in New Issue
Block a user