feat:可以自定义连续回复次数
This commit is contained in:
@@ -62,6 +62,12 @@ description = "思考的时间间隔(秒),可以有效减少消耗"
|
|||||||
path = "focus_chat.think_interval"
|
path = "focus_chat.think_interval"
|
||||||
type = "number"
|
type = "number"
|
||||||
|
|
||||||
|
[[editor.quick_settings.items]]
|
||||||
|
name = "连续回复能力(focus模式)"
|
||||||
|
description = "连续回复能力,值越高,麦麦连续回复的概率越高"
|
||||||
|
path = "focus_chat.consecutive_replies"
|
||||||
|
type = "number"
|
||||||
|
|
||||||
[[editor.quick_settings.items]]
|
[[editor.quick_settings.items]]
|
||||||
name = "自我识别处理器(focus模式)"
|
name = "自我识别处理器(focus模式)"
|
||||||
description = "是否启用自我识别处理器"
|
description = "是否启用自我识别处理器"
|
||||||
@@ -86,6 +92,8 @@ description = "是否在回复后显示当前聊天模式"
|
|||||||
path = "experimental.debug_show_chat_mode"
|
path = "experimental.debug_show_chat_mode"
|
||||||
type = "bool"
|
type = "bool"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
[translations.sections.inner]
|
[translations.sections.inner]
|
||||||
name = "版本"
|
name = "版本"
|
||||||
description = "麦麦的内部配置,包含版本号等信息。此部分仅供显示,不可编辑。"
|
description = "麦麦的内部配置,包含版本号等信息。此部分仅供显示,不可编辑。"
|
||||||
@@ -290,6 +298,10 @@ description = "需要降低回复频率的群组列表"
|
|||||||
name = "思考间隔"
|
name = "思考间隔"
|
||||||
description = "思考的时间间隔(秒),可以有效减少消耗"
|
description = "思考的时间间隔(秒),可以有效减少消耗"
|
||||||
|
|
||||||
|
[translations.items.consecutive_replies]
|
||||||
|
name = "连续回复能力"
|
||||||
|
description = "连续回复能力,值越高,麦麦连续回复的概率越高"
|
||||||
|
|
||||||
[translations.items.observation_context_size]
|
[translations.items.observation_context_size]
|
||||||
name = "观察上下文大小"
|
name = "观察上下文大小"
|
||||||
description = "观察到的最长上下文大小,建议15,太短太长都会导致脑袋尖尖"
|
description = "观察到的最长上下文大小,建议15,太短太长都会导致脑袋尖尖"
|
||||||
|
|||||||
@@ -143,20 +143,32 @@ class ActionModifier:
|
|||||||
result["remove"].append("no_reply")
|
result["remove"].append("no_reply")
|
||||||
result["remove"].append("reply")
|
result["remove"].append("reply")
|
||||||
|
|
||||||
# 获取最近三次的reply状态
|
# 获取最近max_reply_num次的reply状态
|
||||||
last_three = reply_sequence[-3:] if len(reply_sequence) >= 3 else reply_sequence
|
max_reply_num = int(global_config.focus_chat.consecutive_replies * 3)
|
||||||
|
sec_thres_reply_num = int(global_config.focus_chat.consecutive_replies * 2)
|
||||||
|
one_thres_reply_num = int(global_config.focus_chat.consecutive_replies * 1)
|
||||||
|
last_max_reply_num = reply_sequence[-max_reply_num:] if len(reply_sequence) >= max_reply_num else reply_sequence
|
||||||
|
|
||||||
# 根据最近的reply情况决定是否移除reply动作
|
# 根据最近的reply情况决定是否移除reply动作
|
||||||
if len(last_three) >= 3 and all(last_three):
|
if len(last_max_reply_num) >= max_reply_num and all(last_max_reply_num):
|
||||||
# 如果最近三次都是reply,直接移除
|
# 如果最近max_reply_num次都是reply,直接移除
|
||||||
result["remove"].append("reply")
|
result["remove"].append("reply")
|
||||||
elif len(last_three) >= 2 and all(last_three[-2:]):
|
logger.debug(f"最近{len(last_max_reply_num)}次回复中,有{no_reply_count}次no_reply,{len(last_max_reply_num) - no_reply_count}次reply,直接移除")
|
||||||
# 如果最近两次都是reply,40%概率移除
|
elif len(last_max_reply_num) >= sec_thres_reply_num and all(last_max_reply_num[-sec_thres_reply_num:]):
|
||||||
if random.random() < 0.4:
|
# 如果最近sec_thres_reply_num次都是reply,40%概率移除
|
||||||
|
if random.random() < 0.4 / global_config.focus_chat.consecutive_replies:
|
||||||
result["remove"].append("reply")
|
result["remove"].append("reply")
|
||||||
elif last_three and last_three[-1]:
|
logger.debug(f"最近{len(last_max_reply_num)}次回复中,有{no_reply_count}次no_reply,{len(last_max_reply_num) - no_reply_count}次reply,{0.4 / global_config.focus_chat.consecutive_replies}概率移除,移除")
|
||||||
# 如果最近一次是reply,20%概率移除
|
else:
|
||||||
if random.random() < 0.2:
|
logger.debug(f"最近{len(last_max_reply_num)}次回复中,有{no_reply_count}次no_reply,{len(last_max_reply_num) - no_reply_count}次reply,{0.4 / global_config.focus_chat.consecutive_replies}概率移除,不移除")
|
||||||
|
elif len(last_max_reply_num) >= one_thres_reply_num and all(last_max_reply_num[-one_thres_reply_num:]):
|
||||||
|
# 如果最近one_thres_reply_num次都是reply,20%概率移除
|
||||||
|
if random.random() < 0.2 / global_config.focus_chat.consecutive_replies:
|
||||||
result["remove"].append("reply")
|
result["remove"].append("reply")
|
||||||
|
logger.debug(f"最近{len(last_max_reply_num)}次回复中,有{no_reply_count}次no_reply,{len(last_max_reply_num) - no_reply_count}次reply,{0.2 / global_config.focus_chat.consecutive_replies}概率移除,移除")
|
||||||
|
else:
|
||||||
|
logger.debug(f"最近{len(last_max_reply_num)}次回复中,有{no_reply_count}次no_reply,{len(last_max_reply_num) - no_reply_count}次reply,{0.2 / global_config.focus_chat.consecutive_replies}概率移除,不移除")
|
||||||
|
else:
|
||||||
|
logger.debug(f"最近{len(last_max_reply_num)}次回复中,有{no_reply_count}次no_reply,{len(last_max_reply_num) - no_reply_count}次reply,无需移除")
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -885,6 +885,17 @@ API_SERVER_STYLE_CONFIG = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ACTION_MANAGER_STYLE_CONFIG = {
|
||||||
|
"advanced": {
|
||||||
|
"console_format": "<level>{time:HH:mm:ss}</level> | <fg #AFA04F>动作选择</fg #AFA04F> | <fg #AFA04F>{message}</fg #AFA04F>",
|
||||||
|
"file_format": "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {extra[module]: <15} | 动作选择 | {message}",
|
||||||
|
},
|
||||||
|
"simple": {
|
||||||
|
"console_format": "<level>{time:HH:mm:ss}</level> | <fg #AFA04F>动作选择</fg #AFA04F> | <fg #AFA04F>{message}</fg #AFA04F>",
|
||||||
|
"file_format": "{time:YYYY-MM-DD HH:mm:ss} | {level: <8} | {extra[module]: <15} | 动作选择 | {message}",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
# maim_message 消息服务样式配置
|
# maim_message 消息服务样式配置
|
||||||
MAIM_MESSAGE_STYLE_CONFIG = {
|
MAIM_MESSAGE_STYLE_CONFIG = {
|
||||||
"advanced": {
|
"advanced": {
|
||||||
@@ -909,6 +920,9 @@ EMOJI_STYLE_CONFIG = EMOJI_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else EMOJI_ST
|
|||||||
PFC_ACTION_PLANNER_STYLE_CONFIG = (
|
PFC_ACTION_PLANNER_STYLE_CONFIG = (
|
||||||
PFC_ACTION_PLANNER_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else PFC_ACTION_PLANNER_STYLE_CONFIG["advanced"]
|
PFC_ACTION_PLANNER_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else PFC_ACTION_PLANNER_STYLE_CONFIG["advanced"]
|
||||||
)
|
)
|
||||||
|
ACTION_MANAGER_STYLE_CONFIG = (
|
||||||
|
ACTION_MANAGER_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else ACTION_MANAGER_STYLE_CONFIG["advanced"]
|
||||||
|
)
|
||||||
REMOTE_STYLE_CONFIG = REMOTE_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else REMOTE_STYLE_CONFIG["advanced"]
|
REMOTE_STYLE_CONFIG = REMOTE_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else REMOTE_STYLE_CONFIG["advanced"]
|
||||||
BASE_TOOL_STYLE_CONFIG = BASE_TOOL_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else BASE_TOOL_STYLE_CONFIG["advanced"]
|
BASE_TOOL_STYLE_CONFIG = BASE_TOOL_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else BASE_TOOL_STYLE_CONFIG["advanced"]
|
||||||
PERSON_INFO_STYLE_CONFIG = PERSON_INFO_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else PERSON_INFO_STYLE_CONFIG["advanced"]
|
PERSON_INFO_STYLE_CONFIG = PERSON_INFO_STYLE_CONFIG["simple"] if SIMPLE_OUTPUT else PERSON_INFO_STYLE_CONFIG["advanced"]
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ from src.common.logger import (
|
|||||||
API_SERVER_STYLE_CONFIG,
|
API_SERVER_STYLE_CONFIG,
|
||||||
NORMAL_CHAT_RESPONSE_STYLE_CONFIG,
|
NORMAL_CHAT_RESPONSE_STYLE_CONFIG,
|
||||||
EXPRESS_STYLE_CONFIG,
|
EXPRESS_STYLE_CONFIG,
|
||||||
|
ACTION_MANAGER_STYLE_CONFIG,
|
||||||
)
|
)
|
||||||
|
|
||||||
# 可根据实际需要补充更多模块配置
|
# 可根据实际需要补充更多模块配置
|
||||||
@@ -100,6 +101,7 @@ MODULE_LOGGER_CONFIGS = {
|
|||||||
"normal_chat": NORMAL_CHAT_STYLE_CONFIG, # 一般水群
|
"normal_chat": NORMAL_CHAT_STYLE_CONFIG, # 一般水群
|
||||||
"focus_chat": FOCUS_CHAT_STYLE_CONFIG, # 专注水群
|
"focus_chat": FOCUS_CHAT_STYLE_CONFIG, # 专注水群
|
||||||
"expressor": EXPRESS_STYLE_CONFIG, # 麦麦表达
|
"expressor": EXPRESS_STYLE_CONFIG, # 麦麦表达
|
||||||
|
"action_manager": ACTION_MANAGER_STYLE_CONFIG, # 动作选择
|
||||||
# ...如有更多模块,继续添加...
|
# ...如有更多模块,继续添加...
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -143,6 +143,9 @@ class FocusChatConfig(ConfigBase):
|
|||||||
|
|
||||||
think_interval: int = 1
|
think_interval: int = 1
|
||||||
"""思考间隔(秒)"""
|
"""思考间隔(秒)"""
|
||||||
|
|
||||||
|
consecutive_replies: int = 1
|
||||||
|
"""连续回复能力,值越高,麦麦连续回复的概率越高"""
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[inner]
|
[inner]
|
||||||
version = "2.6.0"
|
version = "2.7.0"
|
||||||
|
|
||||||
#----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读----
|
#----以下是给开发人员阅读的,如果你只是部署了麦麦,不需要阅读----
|
||||||
#如果你想要修改配置文件,请在修改后将version的值进行变更
|
#如果你想要修改配置文件,请在修改后将version的值进行变更
|
||||||
@@ -92,6 +92,8 @@ talk_frequency_down_groups = [] #降低回复频率的群号码
|
|||||||
|
|
||||||
[focus_chat] #专注聊天
|
[focus_chat] #专注聊天
|
||||||
think_interval = 3 # 思考间隔 单位秒,可以有效减少消耗
|
think_interval = 3 # 思考间隔 单位秒,可以有效减少消耗
|
||||||
|
consecutive_replies = 1 # 连续回复能力,值越高,麦麦连续回复的概率越高
|
||||||
|
|
||||||
|
|
||||||
observation_context_size = 16 # 观察到的最长上下文大小,建议15,太短太长都会导致脑袋尖尖
|
observation_context_size = 16 # 观察到的最长上下文大小,建议15,太短太长都会导致脑袋尖尖
|
||||||
compressed_length = 8 # 不能大于observation_context_size,心流上下文压缩的最短压缩长度,超过心流观察到的上下文长度,会压缩,最短压缩长度为5
|
compressed_length = 8 # 不能大于observation_context_size,心流上下文压缩的最短压缩长度,超过心流观察到的上下文长度,会压缩,最短压缩长度为5
|
||||||
|
|||||||
Reference in New Issue
Block a user