fix:修复类属性优先级问题
This commit is contained in:
@@ -24,6 +24,8 @@ logger = get_logger("core_actions")
|
||||
WAITING_TIME_THRESHOLD = 1200 # 等待新消息时间阈值,单位秒
|
||||
|
||||
|
||||
|
||||
|
||||
class ReplyAction(BaseAction):
|
||||
"""回复动作 - 参与聊天回复"""
|
||||
|
||||
@@ -103,24 +105,28 @@ class ReplyAction(BaseAction):
|
||||
return False, f"回复失败: {str(e)}"
|
||||
|
||||
|
||||
|
||||
class NoReplyAction(BaseAction):
|
||||
"""不回复动作,继承时会等待新消息或超时"""
|
||||
|
||||
focus_activation_type = ActionActivationType.ALWAYS
|
||||
# focus_activation_type = ActionActivationType.ALWAYS
|
||||
focus_activation_type = ActionActivationType.RANDOM
|
||||
normal_activation_type = ActionActivationType.NEVER
|
||||
mode_enable = ChatMode.FOCUS
|
||||
parallel_action = False
|
||||
|
||||
# 动作基本信息
|
||||
action_name = "no_reply"
|
||||
action_description = "暂时不回复消息,等待新消息或超时"
|
||||
action_description = "暂时不回复消息"
|
||||
|
||||
# 默认超时时间,将由插件在注册时设置
|
||||
waiting_timeout = 1200
|
||||
|
||||
# 连续no_reply计数器
|
||||
_consecutive_count = 0
|
||||
|
||||
|
||||
random_activation_probability = 0.2
|
||||
|
||||
# 分级等待时间
|
||||
_waiting_stages = [10, 60, 600] # 第1、2、3次的等待时间
|
||||
|
||||
@@ -128,7 +134,7 @@ class NoReplyAction(BaseAction):
|
||||
action_parameters = {}
|
||||
|
||||
# 动作使用场景
|
||||
action_require = ["你连续发送了太多消息,且无人回复", "想要暂时不回复"]
|
||||
action_require = ["你发送了消息,目前无人回复"]
|
||||
|
||||
# 关联类型
|
||||
associated_types = []
|
||||
@@ -361,6 +367,7 @@ class CoreActionsPlugin(BasePlugin):
|
||||
config_schema = {
|
||||
"plugin": {
|
||||
"enabled": ConfigField(type=bool, default=True, description="是否启用插件"),
|
||||
"config_version": ConfigField(type=str, default="0.0.2", description="配置文件版本"),
|
||||
},
|
||||
"components": {
|
||||
"enable_reply": ConfigField(type=bool, default=True, description="是否启用'回复'动作"),
|
||||
@@ -376,6 +383,9 @@ class CoreActionsPlugin(BasePlugin):
|
||||
"stage_1_wait": ConfigField(type=int, default=10, description="第1次连续不回复的等待时间(秒)"),
|
||||
"stage_2_wait": ConfigField(type=int, default=60, description="第2次连续不回复的等待时间(秒)"),
|
||||
"stage_3_wait": ConfigField(type=int, default=600, description="第3次连续不回复的等待时间(秒)"),
|
||||
"random_probability": ConfigField(
|
||||
type=float, default=0.8, description="Focus模式下,随机选择不回复的概率(0.0到1.0)", example=0.8
|
||||
),
|
||||
},
|
||||
"emoji": {
|
||||
"random_probability": ConfigField(
|
||||
@@ -391,6 +401,9 @@ class CoreActionsPlugin(BasePlugin):
|
||||
emoji_chance = self.get_config("emoji.random_probability", 0.1)
|
||||
EmojiAction.random_activation_probability = emoji_chance
|
||||
|
||||
no_reply_probability = self.get_config("no_reply.random_probability", 0.8)
|
||||
NoReplyAction.random_activation_probability = no_reply_probability
|
||||
|
||||
no_reply_timeout = self.get_config("no_reply.waiting_timeout", 1200)
|
||||
NoReplyAction.waiting_timeout = no_reply_timeout
|
||||
|
||||
|
||||
Reference in New Issue
Block a user