fix:修复私聊bug
This commit is contained in:
@@ -358,14 +358,18 @@ class DefaultExpressor:
|
||||
)
|
||||
else: # Private chat
|
||||
template_name = "default_expressor_private_prompt"
|
||||
chat_target_1 = "你正在和人私聊"
|
||||
prompt = await global_prompt_manager.format_prompt(
|
||||
template_name,
|
||||
sender_name=effective_sender_name, # Used in private template
|
||||
chat_talking_prompt=chat_talking_prompt,
|
||||
style_habbits=style_habbits_str,
|
||||
grammar_habbits=grammar_habbits_str,
|
||||
chat_target=chat_target_1,
|
||||
chat_info=chat_talking_prompt,
|
||||
bot_name=global_config.bot.nickname,
|
||||
prompt_personality=prompt_personality,
|
||||
prompt_personality="",
|
||||
reason=reason,
|
||||
moderation_prompt=await global_prompt_manager.get_prompt_async("moderation_prompt"),
|
||||
in_mind_reply=in_mind_reply,
|
||||
target_message=target_message,
|
||||
)
|
||||
|
||||
return prompt
|
||||
|
||||
@@ -54,7 +54,7 @@ CONSECUTIVE_NO_REPLY_THRESHOLD = 3 # 连续不回复的阈值
|
||||
logger = get_logger("hfc") # Logger Name Changed
|
||||
|
||||
# 设定处理器超时时间(秒)
|
||||
PROCESSOR_TIMEOUT = 10
|
||||
PROCESSOR_TIMEOUT = 20
|
||||
|
||||
|
||||
async def _handle_cycle_delay(action_taken_this_cycle: bool, cycle_start_time: float, log_prefix: str):
|
||||
|
||||
@@ -137,9 +137,9 @@ class ActionProcessor(BaseProcessor):
|
||||
# 检查no_reply比例
|
||||
print(f"no_reply_count: {no_reply_count}, len(recent_cycles): {len(recent_cycles)}")
|
||||
# print(1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111)
|
||||
if len(recent_cycles) >= (5 * global_config.focus_chat.exit_focus_threshold) and (
|
||||
if len(recent_cycles) >= (5 * global_config.chat.exit_focus_threshold) and (
|
||||
no_reply_count / len(recent_cycles)
|
||||
) >= (0.8 * global_config.focus_chat.exit_focus_threshold):
|
||||
) >= (0.8 * global_config.chat.exit_focus_threshold):
|
||||
if global_config.chat.chat_mode == "auto":
|
||||
result["add"].append("exit_focus_chat")
|
||||
result["remove"].append("no_reply")
|
||||
|
||||
@@ -472,8 +472,8 @@ class NormalChat:
|
||||
return # 如果没有设置回调函数,直接返回
|
||||
current_time = time.time()
|
||||
|
||||
time_threshold = 120 / global_config.focus_chat.auto_focus_threshold
|
||||
reply_threshold = 6 * global_config.focus_chat.auto_focus_threshold
|
||||
time_threshold = 120 / global_config.chat.auto_focus_threshold
|
||||
reply_threshold = 6 * global_config.chat.auto_focus_threshold
|
||||
|
||||
one_minute_ago = current_time - time_threshold
|
||||
|
||||
|
||||
@@ -59,6 +59,12 @@ class ChatConfig(ConfigBase):
|
||||
|
||||
chat_mode: str = "normal"
|
||||
"""聊天模式"""
|
||||
|
||||
auto_focus_threshold: float = 1.0
|
||||
"""自动切换到专注聊天的阈值,越低越容易进入专注聊天"""
|
||||
|
||||
exit_focus_threshold: float = 1.0
|
||||
"""自动退出专注聊天的阈值,越低越容易退出专注聊天"""
|
||||
|
||||
|
||||
@dataclass
|
||||
@@ -123,11 +129,7 @@ class NormalChatConfig(ConfigBase):
|
||||
class FocusChatConfig(ConfigBase):
|
||||
"""专注聊天配置类"""
|
||||
|
||||
auto_focus_threshold: float = 1.0
|
||||
"""自动切换到专注聊天的阈值,越低越容易进入专注聊天"""
|
||||
|
||||
exit_focus_threshold: float = 1.0
|
||||
"""自动退出专注聊天的阈值,越低越容易退出专注聊天"""
|
||||
|
||||
observation_context_size: int = 12
|
||||
"""可观察到的最长上下文大小,超过这个值的上下文会被压缩"""
|
||||
|
||||
@@ -44,6 +44,8 @@ chat_mode = "normal" # 聊天模式 —— 普通模式:normal,专注模式
|
||||
# chat_mode = "focus"
|
||||
# chat_mode = "auto"
|
||||
|
||||
auto_focus_threshold = 1 # 自动切换到专注聊天的阈值,越低越容易进入专注聊天
|
||||
exit_focus_threshold = 1 # 自动退出专注聊天的阈值,越低越容易退出专注聊天
|
||||
# 普通模式下,麦麦会针对感兴趣的消息进行回复,token消耗量较低
|
||||
# 专注模式下,麦麦会进行主动的观察和回复,并给出回复,token消耗量较高
|
||||
# 自动模式下,麦麦会根据消息内容自动切换到专注模式或普通模式
|
||||
@@ -79,9 +81,6 @@ at_bot_inevitable_reply = false # @bot 必然回复
|
||||
talk_frequency_down_groups = [] #降低回复频率的群号码
|
||||
|
||||
[focus_chat] #专注聊天
|
||||
auto_focus_threshold = 1 # 自动切换到专注聊天的阈值,越低越容易进入专注聊天
|
||||
exit_focus_threshold = 1 # 自动退出专注聊天的阈值,越低越容易退出专注聊天
|
||||
|
||||
think_interval = 3 # 思考间隔 单位秒,可以有效减少消耗
|
||||
|
||||
observation_context_size = 15 # 观察到的最长上下文大小,建议15,太短太长都会导致脑袋尖尖
|
||||
|
||||
Reference in New Issue
Block a user