修正工作流

This commit is contained in:
2024-08-19 09:43:46 +08:00
parent fd4d680e87
commit 943e0c2665
45 changed files with 2271 additions and 66 deletions

View File

@ -0,0 +1,13 @@
---
title: liteyuki.plugin
index: true
icon: laptop-code
category: API
---
### ***def*** `get_loaded_plugins() -> dict[str, Plugin]`
获取已加载的插件
Returns:
dict[str, Plugin]: 插件字典

View File

@ -0,0 +1,33 @@
---
title: liteyuki.plugin.load
order: 1
icon: laptop-code
category: API
---
### ***def*** `load_plugin(module_path: str | Path) -> Optional[Plugin]`
加载单个插件,可以是本地插件或是通过 `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

@ -0,0 +1,7 @@
---
title: liteyuki.plugin.manager
order: 1
icon: laptop-code
category: API
---

View File

@ -0,0 +1,60 @@
---
title: liteyuki.plugin.model
order: 1
icon: laptop-code
category: API
---
### ***class*** `PluginType(Enum)`
插件类型枚举值
#### &emsp; ***attr*** `APPLICATION`
Type: 'application'
#### &emsp; ***attr*** `SERVICE`
Type: 'service'
#### &emsp; ***attr*** `IMPLEMENTATION`
Type: 'implementation'
#### &emsp; ***attr*** `MODULE`
Type: 'module'
#### &emsp; ***attr*** `UNCLASSIFIED`
Type: '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}