新增插件Python依赖管理系统,支持自动检查和安装依赖,优化依赖配置和错误处理,更新相关文档和示例代码。

This commit is contained in:
minecraft1024a
2025-08-13 12:32:07 +08:00
committed by Windpicker-owo
parent 7fbd4fd1bc
commit 8ed15c8199
10 changed files with 730 additions and 36 deletions

View File

@@ -512,7 +512,7 @@ class ExpressionConfig(ConfigBase):
# 如果都没有匹配,返回默认值
return True, True, 300
def _get_stream_specific_config(self, chat_stream_id: str) -> Optional[tuple[bool, bool, int]]:
def _get_stream_specific_config(self, chat_stream_id: str) -> Optional[tuple[bool, bool, float]]:
"""
获取特定聊天流的表达配置
@@ -552,7 +552,7 @@ class ExpressionConfig(ConfigBase):
return None
def _get_global_config(self) -> Optional[tuple[bool, bool, int]]:
def _get_global_config(self) -> Optional[tuple[bool, bool, float]]:
"""
获取全局表达配置
@@ -921,4 +921,36 @@ class VideoAnalysisConfig(ConfigBase):
"""批量分析时使用的提示词"""
enable_frame_timing: bool = True
"""是否在分析中包含帧的时间信息"""
"""是否在分析中包含帧的时间信息"""
@dataclass
class DependencyManagementConfig(ConfigBase):
"""插件Python依赖管理配置类"""
auto_install: bool = True
"""是否启用自动安装Python依赖包"""
auto_install_timeout: int = 300
"""安装超时时间(秒)"""
use_proxy: bool = False
"""是否使用代理进行包安装"""
proxy_url: str = ""
"""代理URL如: "http://proxy.example.com:8080""socks5://proxy.example.com:1080" """
pip_options: list[str] = field(default_factory=lambda: [
"--no-warn-script-location",
"--disable-pip-version-check"
])
"""pip安装选项"""
allowed_auto_install: bool = True
"""是否允许自动安装(主开关),关闭后所有插件都不会自动安装依赖"""
prompt_before_install: bool = False
"""安装前是否提示用户(暂未实现)"""
install_log_level: str = "INFO"
"""依赖安装日志级别"""