chore: 代码格式化与类型注解优化

对项目中的多个文件进行了代码风格调整和类型注解更新。

- 使用 ruff 工具对代码进行自动格式化,主要包括:
    - 统一 import 语句的顺序和风格。
    - 移除未使用的 import。
    - 调整代码间距和空行。
- 将部分 `Optional[str]` 和 `List[T]` 等旧式类型注解更新为现代的 `str | None` 和 `list[T]` 语法。
- 修复了一些小的代码风格问题,例如将 `f'...'` 更改为 `f"..."`。
This commit is contained in:
minecraft1024a
2025-10-24 19:08:32 +08:00
committed by Windpicker-owo
parent 9380231019
commit f1dfe64f88
27 changed files with 100 additions and 101 deletions

View File

@@ -26,9 +26,9 @@ from .base import (
ActionInfo,
BaseAction,
BaseCommand,
BasePrompt,
BaseEventHandler,
BasePlugin,
BasePrompt,
BaseTool,
ChatMode,
ChatType,

View File

@@ -206,7 +206,7 @@ async def build_cross_context_s4u(
)
all_group_messages.sort(key=lambda x: x["latest_timestamp"], reverse=True)
# 计算群聊的额度
remaining_limit = cross_context_config.s4u_stream_limit - (1 if private_context_block else 0)
limited_group_messages = all_group_messages[:remaining_limit]

View File

@@ -92,4 +92,4 @@ class BasePrompt(ABC):
component_type=ComponentType.PROMPT,
description=cls.prompt_description,
injection_point=cls.injection_point,
)
)