style(chat): 统一 chat_loop 模块 logger 命名并添加业务注释

将各子模块 logger 由 hfc.* 缩减为统一 "hfc"

涉及的子模块:
- cycle_tracker / energy_manager / hfc_utils / proactive_thinker / response_handler
This commit is contained in:
minecraft1024a
2025-08-21 15:32:57 +08:00
committed by Windpicker-owo
parent 1e71105e62
commit aa960e02dd
6 changed files with 15 additions and 15 deletions

View File

@@ -5,7 +5,7 @@ from src.common.logger import get_logger
from src.chat.chat_loop.hfc_utils import CycleDetail
from .hfc_context import HfcContext
logger = get_logger("hfc.cycle")
logger = get_logger("hfc")
class CycleTracker:
def __init__(self, context: HfcContext):

View File

@@ -6,7 +6,7 @@ from src.config.config import global_config
from src.plugin_system.base.component_types import ChatMode
from .hfc_context import HfcContext
logger = get_logger("hfc.energy")
logger = get_logger("hfc")
class EnergyManager:
def __init__(self, context: HfcContext):

View File

@@ -225,9 +225,9 @@ class HeartFChatting:
if is_group_chat and global_config.chat.group_chat_mode == "focus":
return
if self.context.energy_value <= 1:
self.context.energy_value = 1
self.context.loop_mode = ChatMode.NORMAL
if self.context.energy_value <= 1: # 如果能量值小于等于1非强制情况
self.context.energy_value = 1 # 将能量值设置为1
self.context.loop_mode = ChatMode.NORMAL # 切换到普通模式
def _check_focus_entry(self, new_message_count: int):
"""
@@ -254,11 +254,11 @@ class HeartFChatting:
if is_group_chat and global_config.chat.group_chat_mode == "normal":
return
if global_config.chat.focus_value != 0:
if new_message_count > 3 / pow(global_config.chat.focus_value, 0.5):
self.context.loop_mode = ChatMode.FOCUS
self.context.energy_value = 10 + (new_message_count / (3 / pow(global_config.chat.focus_value, 0.5))) * 10
return
if global_config.chat.focus_value != 0: # 如果专注值配置不为0启用自动专注
if new_message_count > 3 / pow(global_config.chat.focus_value, 0.5): # 如果新消息数超过阈值(基于专注值计算)
self.context.loop_mode = ChatMode.FOCUS # 进入专注模式
self.context.energy_value = 10 + (new_message_count / (3 / pow(global_config.chat.focus_value, 0.5))) * 10 # 根据消息数量计算能量值
return # 返回,不再检查其他条件
if self.context.energy_value >= 30:
self.context.loop_mode = ChatMode.FOCUS
if self.context.energy_value >= 30: # 如果能量值达到或超过30
self.context.loop_mode = ChatMode.FOCUS # 进入专注模式

View File

@@ -9,7 +9,7 @@ from maim_message.message_base import GroupInfo
from src.common.message_repository import count_messages
logger = get_logger(__name__)
logger = get_logger("hfc")
class CycleDetail:

View File

@@ -11,7 +11,7 @@ from .hfc_context import HfcContext
if TYPE_CHECKING:
from .cycle_processor import CycleProcessor
logger = get_logger("hfc.proactive")
logger = get_logger("hfc")
class ProactiveThinker:
def __init__(self, context: HfcContext, cycle_processor: "CycleProcessor"):

View File

@@ -9,7 +9,7 @@ from src.plugin_system.apis import generator_api, send_api, message_api, databas
from src.person_info.person_info import get_person_info_manager
from .hfc_context import HfcContext
logger = get_logger("hfc.response")
logger = get_logger("hfc")
class ResponseHandler:
def __init__(self, context: HfcContext):