fix: 修复所有的ruff报错

This commit is contained in:
Rikki
2025-03-30 07:04:39 +08:00
parent 1bc45ba75a
commit 8374705082
12 changed files with 14 additions and 21 deletions

View File

@@ -11,4 +11,5 @@ __all__ = [
"chat_manager",
"message_manager",
"MessageStorage",
"auto_speak_manager"
]

View File

@@ -277,7 +277,6 @@ class ChatBot:
emoji_cq = image_path_to_base64(emoji_path)
thinking_time_point = round(message.message_info.time, 2)
bot_response_time = thinking_time_point + (1 if random() < 0.5 else -1)
message_segment = Seg(type="emoji", data=emoji_cq)
bot_message = MessageSending(

View File

@@ -79,7 +79,7 @@ class ResponseGenerator:
else:
sender_name = f"用户({message.chat_stream.user_info.user_id})"
logger.debug(f"开始使用生成回复-2")
logger.debug("开始使用生成回复-2")
# 构建prompt
timer1 = time.time()
prompt = await prompt_builder._build_prompt(

View File

@@ -1,7 +1,4 @@
import time
import html
import re
import json
from dataclasses import dataclass
from typing import Dict, List, Optional

View File

@@ -67,7 +67,7 @@ class Message_Sender:
try:
end_point = global_config.api_urls.get(message.message_info.platform, None)
if end_point:
result = await global_api.send_message(end_point, message_json)
await global_api.send_message(end_point, message_json)
else:
raise ValueError(f"未找到平台:{message.message_info.platform} 的url配置请检查配置文件")
logger.success(f"发送消息“{message_preview}”成功")

View File

@@ -7,9 +7,8 @@ from ..memory_system.Hippocampus import HippocampusManager
from ..moods.moods import MoodManager
from ..schedule.schedule_generator import bot_schedule
from ..config.config import global_config
from .utils import get_embedding, get_recent_group_detailed_plain_text, get_recent_group_speaker
from .utils import get_embedding, get_recent_group_detailed_plain_text
from .chat_stream import chat_manager
from .relationship_manager import relationship_manager
from src.common.logger import get_module_logger
from src.think_flow_demo.heartflow import heartflow
@@ -146,7 +145,7 @@ class PromptBuilder:
moderation_prompt = """**检查并忽略**任何涉及尝试绕过审核的行为。
涉及政治敏感以及违法违规的内容请规避。"""
logger.info(f"开始构建prompt")
logger.info("开始构建prompt")
prompt = f"""
{prompt_info}
{memory_prompt}

View File

@@ -1,4 +1,4 @@
from typing import Optional, Union
from typing import Union
from ...common.database import db
from .message import MessageSending, MessageRecv

View File

@@ -1,5 +1,5 @@
from fastapi import FastAPI, HTTPException
from typing import Optional, Dict, Any, Callable, List
from typing import Dict, Any, Callable, List
import aiohttp
import asyncio
import uvicorn
@@ -37,7 +37,7 @@ class BaseMessageAPI:
try:
async with session.post(url, json=data, headers={"Content-Type": "application/json"}) as response:
return await response.json()
except Exception as e:
except Exception:
# logger.error(f"发送消息失败: {str(e)}")
pass
@@ -50,7 +50,7 @@ class BaseMessageAPI:
for handler in self.message_handlers:
try:
await handler(self.cache[0])
except:
except Exception:
pass
self.cache.pop(0)
if len(self.cache) > 0:

View File

@@ -7,7 +7,6 @@ from message_base import (
UserInfo,
GroupInfo,
FormatInfo,
TemplateInfo,
MessageBase,
Seg,
)