fix: Ruff

This commit is contained in:
墨梓柒
2025-05-14 23:09:14 +08:00
parent 2051b011b1
commit 0352340b72
5 changed files with 8 additions and 12 deletions

View File

@@ -1,6 +1,4 @@
from typing import Dict, List, Optional, Callable, Coroutine, Type, Any, Union
import os
import importlib
from typing import Dict, List, Optional, Callable, Coroutine, Type, Any
from src.chat.focus_chat.planners.actions.base_action import BaseAction, _ACTION_REGISTRY, _DEFAULT_ACTIONS
from src.chat.heart_flow.observation.observation import Observation
from src.chat.focus_chat.expressors.default_expressor import DefaultExpressor
@@ -9,8 +7,6 @@ from src.chat.focus_chat.heartFC_Cycleinfo import CycleDetail
from src.common.logger_manager import get_logger
# 导入动作类,确保装饰器被执行
from src.chat.focus_chat.planners.actions.reply_action import ReplyAction
from src.chat.focus_chat.planners.actions.no_reply_action import NoReplyAction
logger = get_logger("action_factory")

View File

@@ -25,8 +25,8 @@ def register_action(cls):
logger.error(f"动作类 {cls.__name__} 缺少必要的属性: action_name 或 action_description")
return cls
action_name = getattr(cls, "action_name")
action_description = getattr(cls, "action_description")
action_name = getattr(cls, "action_name") #noqa
action_description = getattr(cls, "action_description") #noqa
is_default = getattr(cls, "default", False)
if not action_name or not action_description:

View File

@@ -2,9 +2,9 @@
# -*- coding: utf-8 -*-
from src.common.logger_manager import get_logger
from src.chat.utils.timer_calculator import Timer
# from src.chat.utils.timer_calculator import Timer
from src.chat.focus_chat.planners.actions.base_action import BaseAction, register_action
from typing import Tuple, List, Optional
from typing import Tuple, List
from src.chat.heart_flow.observation.observation import Observation
from src.chat.focus_chat.expressors.default_expressor import DefaultExpressor
from src.chat.message_receive.chat_stream import ChatStream

View File

@@ -4,7 +4,7 @@ from typing import List, Dict, Any, Optional
from rich.traceback import install
from src.chat.models.utils_model import LLMRequest
from src.config.config import global_config
from src.chat.focus_chat.heartflow_prompt_builder import prompt_builder
# from src.chat.focus_chat.heartflow_prompt_builder import prompt_builder
from src.chat.focus_chat.info.info_base import InfoBase
from src.chat.focus_chat.info.obs_info import ObsInfo
from src.chat.focus_chat.info.cycle_info import CycleInfo

View File

@@ -454,7 +454,7 @@ async def build_anonymous_messages(messages: List[Dict[str, Any]]) -> str:
def reply_replacer(match):
# aaa = match.group(1)
bbb = match.group(2)
anon_reply = get_anon_name(platform, bbb)
anon_reply = get_anon_name(platform, bbb) #noqa
return f"回复 {anon_reply}"
content = re.sub(reply_pattern, reply_replacer, content, count=1)
@@ -465,7 +465,7 @@ async def build_anonymous_messages(messages: List[Dict[str, Any]]) -> str:
def at_replacer(match):
# aaa = match.group(1)
bbb = match.group(2)
anon_at = get_anon_name(platform, bbb)
anon_at = get_anon_name(platform, bbb) #noqa
return f"@{anon_at}"
content = re.sub(at_pattern, at_replacer, content)