From 20677cff86243aeb5fa372307d0031575e0147df Mon Sep 17 00:00:00 2001 From: RockChinQ <1010553892@qq.com> Date: Mon, 31 Jul 2023 17:53:33 +0800 Subject: [PATCH] =?UTF-8?q?doc(wiki):=20=E6=8F=92=E4=BB=B6=E5=BC=80?= =?UTF-8?q?=E5=8F=91=E9=A1=B5=E5=A2=9E=E5=8A=A0=E7=89=88=E6=9C=AC=E6=96=AD?= =?UTF-8?q?=E8=A8=80=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- res/wiki/插件开发.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/res/wiki/插件开发.md b/res/wiki/插件开发.md index 903fbed9..f08e13d8 100644 --- a/res/wiki/插件开发.md +++ b/res/wiki/插件开发.md @@ -291,6 +291,21 @@ class HelloPlugin(Plugin): - 这仅仅是一个示例,需要更高效的网络访问能力支持插件,请查看[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参考 ### 说明 @@ -436,7 +451,7 @@ KeySwitched = "key_switched" key_list: list[str] api-key列表 """ -PromptPreProcessing = "prompt_pre_processing" +PromptPreProcessing = "prompt_pre_processing" # 于v2.5.1加入 """每回合调用接口前对prompt进行预处理时触发,此事件不支持阻止默认行为 kwargs: session_name: str 会话名称(_)