feat:添加plan防抖
This commit is contained in:
@@ -276,6 +276,9 @@ class HeartFChatting:
|
||||
recent_messages_list = []
|
||||
reply_text = "" # 初始化reply_text变量,避免UnboundLocalError
|
||||
|
||||
|
||||
start_time = time.time()
|
||||
|
||||
if s4u_config.enable_s4u:
|
||||
await send_typing()
|
||||
|
||||
@@ -410,8 +413,18 @@ class HeartFChatting:
|
||||
}
|
||||
reply_text = action_reply_text
|
||||
|
||||
end_time = time.time()
|
||||
if end_time - start_time < global_config.chat.planner_smooth:
|
||||
wait_time = global_config.chat.planner_smooth - (end_time - start_time)
|
||||
await asyncio.sleep(wait_time)
|
||||
else:
|
||||
await asyncio.sleep(0.1)
|
||||
|
||||
|
||||
self.end_cycle(loop_info, cycle_timers)
|
||||
self.print_cycle_info(cycle_timers)
|
||||
|
||||
|
||||
|
||||
"""S4U内容,暂时保留"""
|
||||
if s4u_config.enable_s4u:
|
||||
|
||||
@@ -84,6 +84,8 @@ class ChatConfig(ConfigBase):
|
||||
at_bot_inevitable_reply: float = 1
|
||||
"""@bot 必然回复,1为100%回复,0为不额外增幅"""
|
||||
|
||||
planner_smooth: float = 3
|
||||
"""规划器平滑,增大数值会减小planner负荷,略微降低反应速度,推荐2-5,0为关闭,必须大于等于0"""
|
||||
|
||||
talk_value: float = 1
|
||||
"""思考频率"""
|
||||
|
||||
Reference in New Issue
Block a user