chore: 统一代码风格并进行现代化改造
本次提交主要包含以下内容: - **代码风格统一**:对多个文件进行了格式化,包括移除多余的空行、调整导入顺序、统一字符串引号等,以提高代码一致性和可读性。 - **类型提示现代化**:在多个文件中将旧的 `typing` 模块类型提示(如 `Optional[T]`、`List[T]`、`Union[T, U]`)更新为现代 Python 语法(`T | None`、`list[T]`、`T | U`)。 - **f-string 格式化**:在 `scripts/convert_manifest.py` 中,将 `.format()` 调用更新为更现代和易读的 f-string `!r` 表示法。 - **文件末尾换行符**:为多个文件添加或修正了文件末尾的换行符,遵循 POSIX 标准。
This commit is contained in:
@@ -550,7 +550,7 @@ async def _build_readable_messages_internal(
|
||||
if pic_id_mapping is None:
|
||||
pic_id_mapping = {}
|
||||
current_pic_counter = pic_counter
|
||||
|
||||
|
||||
# --- 异步图片ID处理器 (修复核心问题) ---
|
||||
async def process_pic_ids(content: str) -> str:
|
||||
"""异步处理内容中的图片ID,将其直接替换为[图片:描述]格式"""
|
||||
@@ -978,7 +978,7 @@ async def build_readable_messages(
|
||||
return ""
|
||||
|
||||
copy_messages = [msg.copy() for msg in messages]
|
||||
|
||||
|
||||
if not copy_messages:
|
||||
return ""
|
||||
|
||||
@@ -1092,7 +1092,7 @@ async def build_readable_messages(
|
||||
)
|
||||
|
||||
read_mark_line = "\n--- 以上消息是你已经看过,请关注以下未读的新消息---\n"
|
||||
|
||||
|
||||
# 组合结果
|
||||
result_parts = []
|
||||
if formatted_before and formatted_after:
|
||||
|
||||
Reference in New Issue
Block a user