fix: Ruff
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
from typing import Dict, List, Optional, Callable, Coroutine, Type, Any, Union
|
from typing import Dict, List, Optional, Callable, Coroutine, Type, Any
|
||||||
import os
|
|
||||||
import importlib
|
|
||||||
from src.chat.focus_chat.planners.actions.base_action import BaseAction, _ACTION_REGISTRY, _DEFAULT_ACTIONS
|
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.heart_flow.observation.observation import Observation
|
||||||
from src.chat.focus_chat.expressors.default_expressor import DefaultExpressor
|
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.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")
|
logger = get_logger("action_factory")
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ def register_action(cls):
|
|||||||
logger.error(f"动作类 {cls.__name__} 缺少必要的属性: action_name 或 action_description")
|
logger.error(f"动作类 {cls.__name__} 缺少必要的属性: action_name 或 action_description")
|
||||||
return cls
|
return cls
|
||||||
|
|
||||||
action_name = getattr(cls, "action_name")
|
action_name = getattr(cls, "action_name") #noqa
|
||||||
action_description = getattr(cls, "action_description")
|
action_description = getattr(cls, "action_description") #noqa
|
||||||
is_default = getattr(cls, "default", False)
|
is_default = getattr(cls, "default", False)
|
||||||
|
|
||||||
if not action_name or not action_description:
|
if not action_name or not action_description:
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from src.common.logger_manager import get_logger
|
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 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.heart_flow.observation.observation import Observation
|
||||||
from src.chat.focus_chat.expressors.default_expressor import DefaultExpressor
|
from src.chat.focus_chat.expressors.default_expressor import DefaultExpressor
|
||||||
from src.chat.message_receive.chat_stream import ChatStream
|
from src.chat.message_receive.chat_stream import ChatStream
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ from typing import List, Dict, Any, Optional
|
|||||||
from rich.traceback import install
|
from rich.traceback import install
|
||||||
from src.chat.models.utils_model import LLMRequest
|
from src.chat.models.utils_model import LLMRequest
|
||||||
from src.config.config import global_config
|
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.info_base import InfoBase
|
||||||
from src.chat.focus_chat.info.obs_info import ObsInfo
|
from src.chat.focus_chat.info.obs_info import ObsInfo
|
||||||
from src.chat.focus_chat.info.cycle_info import CycleInfo
|
from src.chat.focus_chat.info.cycle_info import CycleInfo
|
||||||
|
|||||||
@@ -454,7 +454,7 @@ async def build_anonymous_messages(messages: List[Dict[str, Any]]) -> str:
|
|||||||
def reply_replacer(match):
|
def reply_replacer(match):
|
||||||
# aaa = match.group(1)
|
# aaa = match.group(1)
|
||||||
bbb = match.group(2)
|
bbb = match.group(2)
|
||||||
anon_reply = get_anon_name(platform, bbb)
|
anon_reply = get_anon_name(platform, bbb) #noqa
|
||||||
return f"回复 {anon_reply}"
|
return f"回复 {anon_reply}"
|
||||||
|
|
||||||
content = re.sub(reply_pattern, reply_replacer, content, count=1)
|
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):
|
def at_replacer(match):
|
||||||
# aaa = match.group(1)
|
# aaa = match.group(1)
|
||||||
bbb = match.group(2)
|
bbb = match.group(2)
|
||||||
anon_at = get_anon_name(platform, bbb)
|
anon_at = get_anon_name(platform, bbb) #noqa
|
||||||
return f"@{anon_at}"
|
return f"@{anon_at}"
|
||||||
|
|
||||||
content = re.sub(at_pattern, at_replacer, content)
|
content = re.sub(at_pattern, at_replacer, content)
|
||||||
|
|||||||
Reference in New Issue
Block a user