Merge branch 'dev' of https://github.com/MaiM-with-u/MaiBot into dev
This commit is contained in:
@@ -145,8 +145,10 @@ class ExpressionSelector:
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"更新表达方式count失败: {e}")
|
||||
|
||||
async def select_suitable_expressions_llm(self, chat_id: str, chat_info: str, max_num: int = 10, min_num: int = 5) -> List[Dict[str, str]]:
|
||||
|
||||
async def select_suitable_expressions_llm(
|
||||
self, chat_id: str, chat_info: str, max_num: int = 10, min_num: int = 5
|
||||
) -> List[Dict[str, str]]:
|
||||
"""使用LLM选择适合的表达方式"""
|
||||
|
||||
# 1. 获取35个随机表达方式(现在按权重抽取)
|
||||
@@ -195,7 +197,6 @@ class ExpressionSelector:
|
||||
max_num=max_num,
|
||||
)
|
||||
|
||||
|
||||
# 4. 调用LLM
|
||||
try:
|
||||
content, (_, _) = await self.llm_model.generate_response_async(prompt=prompt)
|
||||
|
||||
@@ -181,7 +181,9 @@ class HeartFCMessageReceiver:
|
||||
mes_name = chat.group_info.group_name if chat.group_info else "私聊"
|
||||
# current_time = time.strftime("%H:%M:%S", time.localtime(message.message_info.time))
|
||||
current_talk_frequency = global_config.chat.get_current_talk_frequency(chat.stream_id)
|
||||
logger.info(f"[{mes_name}]{userinfo.user_nickname}:{message.processed_plain_text}[当前回复频率: {current_talk_frequency}]")
|
||||
logger.info(
|
||||
f"[{mes_name}]{userinfo.user_nickname}:{message.processed_plain_text}[当前回复频率: {current_talk_frequency}]"
|
||||
)
|
||||
|
||||
# 8. 关系处理
|
||||
if global_config.relationship.enable_relationship:
|
||||
|
||||
@@ -71,7 +71,9 @@ class ExpressionSelectorProcessor(BaseProcessor):
|
||||
|
||||
try:
|
||||
# LLM模式:调用LLM选择5-10个,然后随机选5个
|
||||
selected_expressions = await expression_selector.select_suitable_expressions_llm(self.subheartflow_id, chat_info, max_num=12, min_num=2)
|
||||
selected_expressions = await expression_selector.select_suitable_expressions_llm(
|
||||
self.subheartflow_id, chat_info, max_num=12, min_num=2
|
||||
)
|
||||
cache_size = len(selected_expressions) if selected_expressions else 0
|
||||
mode_desc = f"LLM模式(已缓存{cache_size}个)"
|
||||
|
||||
|
||||
@@ -292,8 +292,7 @@ class PersonImpressionpProcessor(BaseProcessor):
|
||||
"message_count": self._count_messages_in_timerange(potential_start_time, message_time),
|
||||
}
|
||||
segments.append(new_segment)
|
||||
|
||||
|
||||
|
||||
person_name = get_person_info_manager().get_value(person_id, "person_name")
|
||||
logger.info(
|
||||
f"{self.log_prefix} 眼熟用户 {person_name} 在 {time.strftime('%H:%M:%S', time.localtime(potential_start_time))} - {time.strftime('%H:%M:%S', time.localtime(message_time))} 之间有 {new_segment['message_count']} 条消息"
|
||||
|
||||
@@ -1000,7 +1000,9 @@ class NormalChat:
|
||||
"""
|
||||
# --- 1. 定义参数 ---
|
||||
evaluation_minutes = 10.0
|
||||
target_replies_per_min = global_config.chat.get_current_talk_frequency(self.stream_id) # 目标频率:e.g. 1条/分钟
|
||||
target_replies_per_min = global_config.chat.get_current_talk_frequency(
|
||||
self.stream_id
|
||||
) # 目标频率:e.g. 1条/分钟
|
||||
target_replies_in_window = target_replies_per_min * evaluation_minutes # 10分钟内的目标回复数
|
||||
|
||||
if target_replies_in_window <= 0:
|
||||
|
||||
@@ -162,8 +162,10 @@ class PromptBuilder:
|
||||
read_mark=0.0,
|
||||
show_actions=True,
|
||||
)
|
||||
|
||||
expressions = await expression_selector.select_suitable_expressions_llm(chat_stream.stream_id, chat_talking_prompt_half, max_num=8, min_num=3)
|
||||
|
||||
expressions = await expression_selector.select_suitable_expressions_llm(
|
||||
chat_stream.stream_id, chat_talking_prompt_half, max_num=8, min_num=3
|
||||
)
|
||||
style_habbits = []
|
||||
grammar_habbits = []
|
||||
if expressions:
|
||||
|
||||
Reference in New Issue
Block a user