fix:ruff
This commit is contained in:
@@ -25,7 +25,6 @@ from src.plugin_system.core.plugin_manager import plugin_manager
|
||||
|
||||
# 导入消息API和traceback模块
|
||||
from src.common.message import global_api
|
||||
import traceback
|
||||
|
||||
# 条件导入记忆系统
|
||||
if global_config.memory.enable_memory:
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
import traceback
|
||||
import time
|
||||
from typing import Optional, List, Dict, Any
|
||||
from typing import List, Dict, Any
|
||||
from src.common.logger_manager import get_logger
|
||||
from src.chat.heart_flow.observation.chatting_observation import ChattingObservation
|
||||
from src.chat.focus_chat.hfc_utils import create_empty_anchor_message
|
||||
|
||||
# 以下为类型注解需要
|
||||
from src.chat.message_receive.chat_stream import ChatStream, chat_manager
|
||||
from src.chat.focus_chat.expressors.default_expressor import DefaultExpressor
|
||||
from src.chat.focus_chat.replyer.default_replyer import DefaultReplyer
|
||||
from src.chat.focus_chat.info.obs_info import ObsInfo
|
||||
|
||||
# 新增导入
|
||||
|
||||
@@ -2,7 +2,6 @@ from typing import Dict, List, Optional, Any, TYPE_CHECKING
|
||||
import os
|
||||
import importlib
|
||||
import importlib.util
|
||||
import inspect
|
||||
from pathlib import Path
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@@ -57,7 +56,7 @@ class PluginManager:
|
||||
logger.debug(f"插件模块加载完成 - 成功: {total_loaded_modules}, 失败: {total_failed_modules}")
|
||||
|
||||
# 第二阶段:实例化所有已注册的插件类
|
||||
from src.plugin_system.base.base_plugin import get_registered_plugin_classes, instantiate_and_register_plugin
|
||||
from src.plugin_system.base.base_plugin import get_registered_plugin_classes
|
||||
|
||||
plugin_classes = get_registered_plugin_classes()
|
||||
total_registered = 0
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
"""测试插件包:图片发送"""
|
||||
|
||||
"""
|
||||
这是一个测试插件,用于测试图片发送功能
|
||||
"""
|
||||
|
||||
"""豆包图片生成插件包
|
||||
|
||||
这是一个基于火山引擎豆包模型的AI图片生成插件。
|
||||
|
||||
功能特性:
|
||||
- 智能LLM判定:根据聊天内容智能判断是否需要生成图片
|
||||
- 高质量图片生成:使用豆包Seed Dream模型生成图片
|
||||
- 结果缓存:避免重复生成相同内容的图片
|
||||
- 配置验证:自动验证和修复配置文件
|
||||
- 参数验证:完整的输入参数验证和错误处理
|
||||
- 多尺寸支持:支持多种图片尺寸生成
|
||||
|
||||
使用场景:
|
||||
- 用户要求画图或生成图片时自动触发
|
||||
- 将文字描述转换为视觉图像
|
||||
- 创意图片和艺术作品生成
|
||||
|
||||
配置文件:config.toml
|
||||
|
||||
配置要求:
|
||||
1. 设置火山引擎API密钥 (volcano_generate_api_key)
|
||||
2. 配置API基础URL (base_url)
|
||||
3. 选择合适的生成模型和参数
|
||||
|
||||
注意:需要有效的火山引擎API访问权限才能正常使用。
|
||||
"""
|
||||
|
||||
from .plugin import DoubaoImagePlugin
|
||||
|
||||
__all__ = ["DoubaoImagePlugin"]
|
||||
@@ -21,7 +21,6 @@ import urllib.request
|
||||
import urllib.error
|
||||
import base64
|
||||
import traceback
|
||||
import random
|
||||
from typing import List, Tuple, Type, Optional
|
||||
|
||||
# 导入新插件系统
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
- 禁言命令Command - 手动执行禁言操作
|
||||
"""
|
||||
|
||||
from typing import List, Tuple, Type, Optional, Dict, Any
|
||||
from typing import List, Tuple, Type, Optional
|
||||
import random
|
||||
|
||||
# 导入新插件系统
|
||||
@@ -169,7 +169,7 @@ class MuteAction(BaseAction):
|
||||
else:
|
||||
error_msg = "发送禁言命令失败"
|
||||
logger.error(f"{self.log_prefix} {error_msg}")
|
||||
await self.send_reply(f"执行禁言动作失败")
|
||||
await self.send_reply("执行禁言动作失败")
|
||||
return False, error_msg
|
||||
|
||||
def _get_template_message(self, target: str, duration_str: str, reason: str) -> str:
|
||||
|
||||
@@ -21,8 +21,7 @@
|
||||
- 日志和错误处理
|
||||
"""
|
||||
|
||||
from typing import List, Tuple, Type, Optional, Dict, Any
|
||||
import re
|
||||
from typing import List, Tuple, Type, Optional
|
||||
import time
|
||||
import random
|
||||
# 导入新插件系统
|
||||
@@ -344,13 +343,13 @@ class MessageInfoCommand(BaseCommand):
|
||||
info_parts = [
|
||||
"📋 消息信息详情",
|
||||
"",
|
||||
f"👤 用户信息:",
|
||||
"👤 用户信息:",
|
||||
f" • ID: {user_info.user_id}",
|
||||
f" • 昵称: {user_info.user_nickname}",
|
||||
f" • 群名片: {getattr(user_info, 'user_cardname', '无')}",
|
||||
f" • 平台: {message.message_info.platform}",
|
||||
"",
|
||||
f"💬 消息信息:",
|
||||
"💬 消息信息:",
|
||||
f" • 消息ID: {message.message_info.message_id}",
|
||||
f" • 时间戳: {message.message_info.time}",
|
||||
f" • 原始内容: {message.processed_plain_text[:100]}{'...' if len(message.processed_plain_text) > 100 else ''}",
|
||||
@@ -361,15 +360,15 @@ class MessageInfoCommand(BaseCommand):
|
||||
if group_info:
|
||||
info_parts.extend([
|
||||
"",
|
||||
f"👥 群聊信息:",
|
||||
"👥 群聊信息:",
|
||||
f" • 群ID: {group_info.group_id}",
|
||||
f" • 群名: {getattr(group_info, 'group_name', '未知')}",
|
||||
f" • 聊天类型: 群聊"
|
||||
" • 聊天类型: 群聊"
|
||||
])
|
||||
else:
|
||||
info_parts.extend([
|
||||
"",
|
||||
f"💭 聊天类型: 私聊"
|
||||
"💭 聊天类型: 私聊"
|
||||
])
|
||||
|
||||
# 流信息
|
||||
@@ -377,7 +376,7 @@ class MessageInfoCommand(BaseCommand):
|
||||
stream = message.chat_stream
|
||||
info_parts.extend([
|
||||
"",
|
||||
f"🌊 聊天流信息:",
|
||||
"🌊 聊天流信息:",
|
||||
f" • 流ID: {stream.stream_id}",
|
||||
f" • 创建时间: {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(stream.create_time))}",
|
||||
f" • 最后活跃: {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(stream.last_active_time))}"
|
||||
|
||||
Reference in New Issue
Block a user