doc(wiki): 插件开发页增加版本断言说明

This commit is contained in:
RockChinQ
2023-07-31 17:53:33 +08:00
parent c8af5d8445
commit 20677cff86

View File

@@ -291,6 +291,21 @@ class HelloPlugin(Plugin):
- 这仅仅是一个示例,需要更高效的网络访问能力支持插件,请查看[WebwlkrPlugin](https://github.com/RockChinQ/WebwlkrPlugin) - 这仅仅是一个示例,需要更高效的网络访问能力支持插件,请查看[WebwlkrPlugin](https://github.com/RockChinQ/WebwlkrPlugin)
## 🔒版本要求
若您的插件对主程序的版本有要求,可以使用以下函数进行断言,若不符合版本,此函数将报错并打断此函数所在的流程:
```python
require_ver("v2.5.1") # 要求最低版本为 v2.5.1
```
```python
require_ver("v2.5.1", "v2.6.0") # 要求最低版本为 v2.5.1, 同时要求最高版本为 v2.6.0
```
- 此函数在主程序`v2.5.1`中加入
- 此函数声明在`pkg.plugin.models`模块中,在插件示例代码最前方已引入此模块所有内容,故可直接使用
## 📄API参考 ## 📄API参考
### 说明 ### 说明
@@ -436,7 +451,7 @@ KeySwitched = "key_switched"
key_list: list[str] api-key列表 key_list: list[str] api-key列表
""" """
PromptPreProcessing = "prompt_pre_processing" PromptPreProcessing = "prompt_pre_processing" # 于v2.5.1加入
"""每回合调用接口前对prompt进行预处理时触发此事件不支持阻止默认行为 """每回合调用接口前对prompt进行预处理时触发此事件不支持阻止默认行为
kwargs: kwargs:
session_name: str 会话名称(<launcher_type>_<launcher_id>) session_name: str 会话名称(<launcher_type>_<launcher_id>)