feat(reply): 引入 reply 和 respond 动作,优化消息回复机制
- 增加 reply 动作,针对单条消息进行深度回复,使用 s4u 模板。 - 增加 respond 动作,统一回应未读消息,使用 normal 模板。 - 更新核心动作插件以支持新动作,确保配置选项可用。 - 优化动作执行逻辑,提升对话流畅性和响应准确性。
This commit is contained in:
@@ -128,6 +128,18 @@ async def generate_reply(
|
||||
if not extra_info and action_data:
|
||||
extra_info = action_data.get("extra_info", "")
|
||||
|
||||
# 从action_data中提取prompt_mode
|
||||
prompt_mode = "s4u" # 默认使用s4u模式
|
||||
if action_data and "prompt_mode" in action_data:
|
||||
prompt_mode = action_data.get("prompt_mode", "s4u")
|
||||
|
||||
# 将prompt_mode添加到available_actions中(作为特殊键)
|
||||
# 注意:这里我们需要暂时使用类型忽略,因为available_actions的类型定义不支持非ActionInfo值
|
||||
if available_actions is None:
|
||||
available_actions = {}
|
||||
available_actions = available_actions.copy() # 避免修改原字典
|
||||
available_actions["_prompt_mode"] = prompt_mode # type: ignore # 特殊键,用于传递prompt_mode
|
||||
|
||||
# 如果action_data中有thinking,添加到extra_info中
|
||||
if action_data and (thinking := action_data.get("thinking")):
|
||||
if extra_info:
|
||||
|
||||
Reference in New Issue
Block a user