config:修改配置项

This commit is contained in:
SengokuCola
2025-07-01 14:59:00 +08:00
parent cec854cba2
commit 4dd04d4fb0
7 changed files with 23 additions and 41 deletions

View File

@@ -582,7 +582,7 @@ class HeartFChatting:
async def run_with_timeout(proc=processor):
return await asyncio.wait_for(
proc.process_info(observations=observations),
timeout=global_config.focus_chat.processor_max_time,
30
)
task = asyncio.create_task(run_with_timeout())
@@ -613,9 +613,9 @@ class HeartFChatting:
processor_time_costs[processor_name] = duration_since_parallel_start
except asyncio.TimeoutError:
logger.info(
f"{self.log_prefix} 处理器 {processor_name} 超时(>{global_config.focus_chat.processor_max_time}s已跳过"
f"{self.log_prefix} 处理器 {processor_name} 超时(>30s已跳过"
)
processor_time_costs[processor_name] = global_config.focus_chat.processor_max_time
processor_time_costs[processor_name] = 30
except Exception as e:
logger.error(
f"{self.log_prefix} 处理器 {processor_name} 执行失败,耗时 (自并行开始): {duration_since_parallel_start:.2f}秒. 错误: {e}",
@@ -672,7 +672,7 @@ class HeartFChatting:
try:
result = await asyncio.wait_for(
proc.process_info(observations=observations, action_type=action_type, action_data=action_data),
timeout=global_config.focus_chat.processor_max_time,
30
)
end_time = time.time()
post_processor_time_costs[name] = end_time - start_time
@@ -721,7 +721,7 @@ class HeartFChatting:
if task_type == "processor":
post_processor_time_costs[task_name] = elapsed_time
logger.warning(
f"{self.log_prefix} 后期处理器 {task_name} 超时(>{global_config.focus_chat.processor_max_time}s已跳过耗时: {elapsed_time:.3f}"
f"{self.log_prefix} 后期处理器 {task_name} 超时(>30s已跳过耗时: {elapsed_time:.3f}"
)
except Exception as e:
# 对于异常任务,记录已用时间

View File

@@ -67,7 +67,7 @@ class ChattingObservation(Observation):
self.talking_message_str_truncate_short = ""
self.name = global_config.bot.nickname
self.nick_name = global_config.bot.alias_names
self.max_now_obs_len = global_config.focus_chat.observation_context_size
self.max_now_obs_len = global_config.chat.max_context_size
self.overlap_len = global_config.focus_chat.compressed_length
self.person_list = []
self.compressor_prompt = ""

View File

@@ -80,7 +80,7 @@ class NormalChatActionModifier:
message_list_before_now = get_raw_msg_before_timestamp_with_chat(
chat_id=chat_stream.stream_id,
timestamp=time.time(),
limit=global_config.focus_chat.observation_context_size, # 使用相同的配置
limit=global_config.chat.max_context_size, # 使用相同的配置
)
# 构建可读的聊天上下文

View File

@@ -122,7 +122,7 @@ class NormalChatPlanner:
message_list_before_now = get_raw_msg_before_timestamp_with_chat(
chat_id=message.chat_stream.stream_id,
timestamp=time.time(),
limit=global_config.focus_chat.observation_context_size,
limit=global_config.chat.max_context_size,
)
chat_context = build_readable_messages(

View File

@@ -350,7 +350,7 @@ class DefaultReplyer:
# 使用从处理器传来的选中表达方式
# LLM模式调用LLM选择5-10个然后随机选5个
selected_expressions = await expression_selector.select_suitable_expressions_llm(
self.chat_stream.stream_id, chat_history, max_num=12, min_num=2, target_message=target
self.chat_stream.stream_id, chat_history, max_num=8, min_num=2, target_message=target
)
if selected_expressions:
@@ -476,7 +476,7 @@ class DefaultReplyer:
message_list_before_now = get_raw_msg_before_timestamp_with_chat(
chat_id=chat_id,
timestamp=time.time(),
limit=global_config.focus_chat.observation_context_size,
limit=global_config.chat.max_context_size,
)
chat_talking_prompt = build_readable_messages(
message_list_before_now,
@@ -491,7 +491,7 @@ class DefaultReplyer:
message_list_before_now_half = get_raw_msg_before_timestamp_with_chat(
chat_id=chat_id,
timestamp=time.time(),
limit=int(global_config.focus_chat.observation_context_size * 0.5),
limit=int(global_config.chat.max_context_size * 0.5),
)
chat_talking_prompt_half = build_readable_messages(
message_list_before_now_half,
@@ -654,7 +654,7 @@ class DefaultReplyer:
message_list_before_now = get_raw_msg_before_timestamp_with_chat(
chat_id=chat_stream.stream_id,
timestamp=time.time(),
limit=global_config.focus_chat.observation_context_size,
limit=global_config.chat.max_context_size,
)
chat_talking_prompt = build_readable_messages(
message_list_before_now,