📝 生成了api文档

This commit is contained in:
2024-08-19 09:55:47 +08:00
parent 943e0c2665
commit 85a3a9ad52
26 changed files with 634 additions and 850 deletions

View File

@ -8,6 +8,8 @@ category: API
### ***def*** `get_loaded_plugins() -> dict[str, Plugin]`
获取已加载的插件
Returns:
dict[str, Plugin]: 插件字典

View File

@ -9,25 +9,39 @@ category: API
加载单个插件,可以是本地插件或是通过 `pip` 安装的插件。
参数:
module_path: 插件名称 `path.to.your.plugin`
或插件路径 `pathlib.Path(path/to/your/plugin)`
### ***def*** `load_plugins() -> set[Plugin]`
导入文件夹下多个插件
参数:
plugin_dir: 文件夹路径
ignore_warning: 是否忽略警告,通常是目录不存在或目录为空
### ***def*** `format_display_name(display_name: str, plugin_type: PluginType) -> str`
设置插件名称颜色,根据不同类型插件设置颜色
Args:
display_name: 插件名称
plugin_type: 插件类型
Returns:
str: 设置后的插件名称 <y>name</y>

View File

@ -9,52 +9,57 @@ category: API
插件类型枚举值
#### &emsp; ***attr*** `APPLICATION`
### &emsp; ***attr*** `APPLICATION: 'application'`
Type: 'application'
### &emsp; ***attr*** `SERVICE: 'service'`
#### &emsp; ***attr*** `SERVICE`
### &emsp; ***attr*** `IMPLEMENTATION: 'implementation'`
Type: 'service'
### &emsp; ***attr*** `MODULE: 'module'`
#### &emsp; ***attr*** `IMPLEMENTATION`
Type: 'implementation'
#### &emsp; ***attr*** `MODULE`
Type: 'module'
#### &emsp; ***attr*** `UNCLASSIFIED`
Type: 'unclassified'
### &emsp; ***attr*** `UNCLASSIFIED: 'unclassified'`
### ***class*** `PluginMetadata(BaseModel)`
轻雪插件元数据由插件编写者提供name为必填项
Attributes:
----------
name: str
插件名称
description: str
插件描述
usage: str
插件使用方法
type: str
插件类型
author: str
插件作者
homepage: str
插件主页
extra: dict[str, Any]
额外信息
### ***class*** `Plugin(BaseModel)`
存储插件信息
#### &emsp; ***attr*** `model_config`
Type: {'arbitrary_types_allowed': True}
### &emsp; ***attr*** `model_config: {'arbitrary_types_allowed': True}`