Ruff Format

This commit is contained in:
DrSmoothl
2026-03-13 11:45:26 +08:00
parent 2a510312bc
commit a576313b22
70 changed files with 956 additions and 731 deletions

View File

@@ -142,13 +142,21 @@ class ChatManager:
if chat_stream.is_group_session:
info["group_id"] = chat_stream.group_id
if chat_stream.context and chat_stream.context.message and chat_stream.context.message.message_info.group_info:
if (
chat_stream.context
and chat_stream.context.message
and chat_stream.context.message.message_info.group_info
):
info["group_name"] = chat_stream.context.message.message_info.group_info.group_name or "未知群聊"
else:
info["group_name"] = "未知群聊"
else:
info["user_id"] = chat_stream.user_id
if chat_stream.context and chat_stream.context.message and chat_stream.context.message.message_info.user_info:
if (
chat_stream.context
and chat_stream.context.message
and chat_stream.context.message.message_info.user_info
):
info["user_name"] = chat_stream.context.message.message_info.user_info.user_nickname
else:
info["user_name"] = "未知用户"

View File

@@ -44,7 +44,9 @@ def get_replyer(
if not chat_id and not chat_stream:
raise ValueError("chat_stream 和 chat_id 不可均为空")
try:
logger.debug(f"[GeneratorService] 正在获取回复器chat_id: {chat_id}, chat_stream: {'' if chat_stream else ''}")
logger.debug(
f"[GeneratorService] 正在获取回复器chat_id: {chat_id}, chat_stream: {'' if chat_stream else ''}"
)
return replyer_manager.get_replyer(
chat_stream=chat_stream,
chat_id=chat_id,

View File

@@ -70,10 +70,10 @@ async def _send_to_target(
if reply_message:
anchor_message = db_message_to_mai_message(reply_message)
if anchor_message:
logger.debug(f"[SendService] 找到匹配的回复消息,发送者: {anchor_message.message_info.user_info.user_id}")
reply_to_platform_id = (
f"{anchor_message.platform}:{anchor_message.message_info.user_info.user_id}"
logger.debug(
f"[SendService] 找到匹配的回复消息,发送者: {anchor_message.message_info.user_info.user_id}"
)
reply_to_platform_id = f"{anchor_message.platform}:{anchor_message.message_info.user_info.user_id}"
sender_info = None
if target_stream.context and target_stream.context.message: