diff --git a/README.md b/README.md old mode 100755 new mode 100644 index 5f1f4876..d513eb5b --- a/README.md +++ b/README.md @@ -22,11 +22,11 @@ _✨ 使用 OpenAI 标准格式 API 的聊天机器人插件 ✨_ ## 📖 介绍 -通过调用 OpenAI 标准格式 API(例如由 Azure OpenAI 驱动,GitHub Models 提供访问的生成式 AI 推理 API) 来实现聊天的插件。 -插件内置了猫娘小棉(Marsho)的人物设定,可以进行可爱的聊天! -*谁不喜欢回复消息快又可爱的猫娘呢?* -**对 OneBot 以外的适配器与非 GitHub Models API的支持未经过完全验证。** -[Melobot 实现](https://github.com/LiteyukiStudio/marshoai-melo) +通过调用 OpenAI 标准格式 API(例如由 Azure OpenAI 驱动,GitHub Models 提供访问的生成式 AI 推理 API) 来实现聊天的插件。 +插件内置了猫娘小棉(Marsho)的人物设定,可以进行可爱的聊天! +*谁不喜欢回复消息快又可爱的猫娘呢?* +**对 OneBot 以外的适配器与非 GitHub Models API的支持未经过完全验证。** +[Melobot 实现](https://github.com/LiteyukiStudio/marshoai-melo) ## 🐱 设定 @@ -42,156 +42,20 @@ _✨ 使用 OpenAI 标准格式 API 的聊天机器人插件 ✨_ - 🍫 吃零食!肉肉好吃! - 🐾 玩!我喜欢和朋友们一起玩! -## 💿 安装 +## 😼 使用 -
-使用 nb-cli 安装 -在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装 - - nb plugin install nonebot-plugin-marshoai - -
- -
-使用包管理器安装 -在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令 - -
-pip - - pip install nonebot-plugin-marshoai - -
-
-pdm - - pdm add nonebot-plugin-marshoai - -
-
-poetry - - poetry add nonebot-plugin-marshoai - -
-
-conda - - conda install nonebot-plugin-marshoai - -
- -打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分追加写入 - - plugins = ["nonebot_plugin_marshoai"] - -
- -## 🤖 获取 token(GitHub Models) - -- 新建一个[personal access token](https://github.com/settings/tokens/new),**不需要给予任何权限**。 -- 将新建的 token 复制,添加到`.env`文件中的`marshoai_token`配置项中。 - -## 🎉 使用 - -发送`marsho`指令可以获取使用说明(若在配置中自定义了指令前缀请使用自定义的指令前缀)。 - -#### 👉 戳一戳 - -当 nonebot 连接到支持的 OneBot v11 实现端时,可以接收头像双击戳一戳消息并进行响应。详见`MARSHOAI_POKE_SUFFIX`配置项。 - -## 🛠️ 小棉工具 -小棉工具(MarshoTools)是`v0.5.0`版本的新增功能,支持加载外部函数库来为 Marsho 提供 Function Call 功能。[使用文档](./README_TOOLS.md) - -## 👍 夸赞名单 - -夸赞名单存储于插件数据目录下的`praises.json`里(该目录路径会在 Bot 启动时输出到日志),当配置项为`true` -时发起一次聊天后自动生成,包含人物名字与人物优点两个基本数据。 -存储于其中的人物会被 Marsho “认识”和“喜欢”。 -其结构类似于: - -```json -{ - "like": [ - { - "name": "Asankilp", - "advantages": "赋予了Marsho猫娘人格,使用vim与vscode为Marsho写了许多代码,使Marsho更加可爱" - }, - { - "name": "神羽(snowykami)", - "advantages": "人脉很广,经常找小伙伴们开银趴,很会写后端代码" - }, - ... - ] -} -``` - -## ⚙️ 可配置项 - -在 nonebot2 项目的`.env`文件中添加下表中的配置 - -#### 插件行为 - -| 配置项 | 类型 | 默认值 | 说明 | -| ------------------------ | ------ | ------- | ---------------- | -| MARSHOAI_USE_YAML_CONFIG | `bool` | `false` | 是否使用 YAML 配置文件格式 | - -#### Marsho 使用方式 - -| 配置项 | 类型 | 默认值 | 说明 | -| --------------------- | ---------- | ----------- | ----------------- | -| MARSHOAI_DEFAULT_NAME | `str` | `marsho` | 调用 Marsho 默认的命令前缀 | -| MARSHOAI_ALIASES | `set[str]` | `set{"小棉"}` | 调用 Marsho 的命令别名 | -| MARSHOAI_AT | `bool` | `false` | 决定是否使用at触发 | -| MARSHOAI_MAIN_COLOUR | `str` | `FFAAAA` | 主题色,部分工具和功能可用 | - -#### AI 调用 - -| 配置项 | 类型 | 默认值 | 说明 | -| -------------------------------- | ------- | --------------------------------------- | --------------------------------------------------------------------------------------------- | -| MARSHOAI_TOKEN | `str` | | 调用 AI API 所需的 token | -| MARSHOAI_DEFAULT_MODEL | `str` | `gpt-4o-mini` | Marsho 默认调用的模型 | -| MARSHOAI_PROMPT | `str` | 猫娘 Marsho 人设提示词 | Marsho 的基本系统提示词 **※部分模型(o1等)不支持系统提示词。** | -| MARSHOAI_ADDITIONAL_PROMPT | `str` | | Marsho 的扩展系统提示词 | -| MARSHOAI_POKE_SUFFIX | `str` | `揉了揉你的猫耳` | 对 Marsho 所连接的 OneBot 用户进行双击戳一戳时,构建的聊天内容。此配置项为空字符串时,戳一戳响应功能会被禁用。例如,默认值构建的聊天内容将为`*[昵称]揉了揉你的猫耳。` | -| MARSHOAI_AZURE_ENDPOINT | `str` | `https://models.inference.ai.azure.com` | OpenAI 标准格式 API 端点 | -| MARSHOAI_TEMPERATURE | `float` | `null` | 推理生成多样性(温度)参数 | -| MARSHOAI_TOP_P | `float` | `null` | 推理核采样参数 | -| MARSHOAI_MAX_TOKENS | `int` | `null` | 最大生成 token 数 | -| MARSHOAI_ADDITIONAL_IMAGE_MODELS | `list` | `[]` | 额外添加的支持图片的模型列表,例如`hunyuan-vision` | - -#### 功能开关 - -| 配置项 | 类型 | 默认值 | 说明 | -| --------------------------------- | ------ | ------ | -------------------------- | -| MARSHOAI_ENABLE_SUPPORT_IMAGE_TIP | `bool` | `true` | 启用后用户发送带图请求时若模型不支持图片,则提示用户 | -| MARSHOAI_ENABLE_NICKNAME_TIP | `bool` | `true` | 启用后用户未设置昵称时提示用户设置 | -| MARSHOAI_ENABLE_PRAISES | `bool` | `true` | 是否启用夸赞名单功能 | -| MARSHOAI_ENABLE_TOOLS | `bool` | `true` | 是否启用小棉工具 | -| MARSHOAI_LOAD_BUILTIN_TOOLS | `bool` | `true` | 是否加载内置工具包 | -| MARSHOAI_TOOLSET_DIR | `list` | `[]` | 外部工具集路径列表 | -| MARSHOAI_DISABLED_TOOLKITS | `list` | `[]` | 禁用的工具包包名列表 | -| MARSHOAI_ENABLE_RICHTEXT_PARSE | `bool` | `true` | 是否启用自动解析消息(若包含图片链接则发送图片、若包含LaTeX公式则发送公式图) | -| MARSHOAI_SINGLE_LATEX_PARSE | `bool` | `false` | 单行公式是否渲染(当消息富文本解析启用时可用)(如果单行也渲……只能说不好看) | +请查看[使用文档](https://marsho.liteyuki.icu/start/install) ## ❤ 鸣谢&版权说明 -本项目使用了以下项目的代码: +本项目使用了以下项目的代码: -- [nonebot-plugin-latex](https://github.com/EillesWan/nonebot-plugin-latex) +- [nonebot-plugin-latex](https://github.com/EillesWan/nonebot-plugin-latex) -"Marsho" logo 由 [@Asankilp](https://github.com/Asankilp) -绘制,基于 [CC BY-NC-SA 4.0](http://creativecommons.org/licenses/by-nc-sa/4.0/) 许可下提供。 -"nonebot-plugin-marshoai" 基于 [MIT](./LICENSE-MIT) 许可下提供。 -部分指定的代码基于 [Mulan PSL v2](./LICENSE-MULAN) 许可下提供。 +"Marsho" logo 由 [@Asankilp](https://github.com/Asankilp)绘制,基于 [CC BY-NC-SA 4.0](http://creativecommons.org/licenses/by-nc-sa/4.0/) 许可下提供。 +"nonebot-plugin-marshoai" 基于 [MIT](./LICENSE-MIT) 许可下提供。 +部分指定的代码基于 [Mulan PSL v2](./LICENSE-MULAN) 许可下提供。 ## 开发 - 请阅读[开发规范](./README_DEV.md) - -## 🕊️ TODO - -- [x] [Melobot](https://github.com/Meloland/melobot) 实现 -- [x] 对聊天发起者的认知(认出是谁在问 Marsho)(初步实现) -- [ ] 自定义 API 接入点的适配(不局限于GitHub Models) -- [ ] 上下文通过数据库持久化存储 diff --git a/README_EN.md b/README_EN.md old mode 100755 new mode 100644 index 187785da..8159af99 --- a/README_EN.md +++ b/README_EN.md @@ -46,155 +46,14 @@ Plugin internally installed the catgirl character of Marsho, is able to have a c - 🍫 Eating snacks! Meat is yummy! - 🐾 Play! I like play with friends! -## 💿 Install - -
-Install with nb-cli - -Open shell under the root directory of nonebot2, input the command below. - - nb plugin install nonebot-plugin-marshoai - -
- -
-Install with pack manager - -Open shell under the plugin directory of nonebot2, input corresponding command according to your pack manager. - -
-pip - - pip install nonebot-plugin-marshoai - -
-
-pdm - - pdm add nonebot-plugin-marshoai - -
-
-poetry - - poetry add nonebot-plugin-marshoai - -
-
-conda - - conda install nonebot-plugin-marshoai - -
- -Open the `pyproject.toml` file under nonebot2's root directory, Add to`[tool.nonebot]`. - - plugins = ["nonebot_plugin_marshoai"] - -
- -## 🤖 Get token(GitHub Models) - -- Create new [personal access token](https://github.com/settings/tokens/new),**Don't need any permissions**. -- Copy the new token, add to the `.env` file's `marshoai_token` option. - -## 🎉 Usage - -End `marsho` in order to get direction for use(If you configured the custom command, please use the configured one). - -#### 👉 Double click avatar - -When nonebot linked to OneBot v11 adapter, can recieve double click and response to it. More detail in the `MARSHOAI_POKE_SUFFIX` option. - -## 🛠️ MarshoTools - -MarshoTools is a feature added in `v0.5.0`, support loading external function library to provide Function Call for Marsho. [Documentation](./README_TOOLS_EN.md) - -## 👍 Praise list - -Praise list stored in the `praises.json` in plugin directory(This directory will putput to log when Bot start), it'll automatically generate when option is `true`, include character name and advantage two basic data. - -The character stored in it would be “know” and “like” by Marsho. - -It's structure is similar to: - -```json -{ - "like": [ - { - "name": "Asankilp", - "advantages": "赋予了Marsho猫娘人格,使用vim与vscode为Marsho写了许多代码,使Marsho更加可爱" - }, - { - "name": "神羽(snowykami)", - "advantages": "人脉很广,经常找小伙伴们开银趴,很会写后端代码" - }, - ... - ] -} -``` - -## ⚙️ Configurable options - -Add options in the `.env` file from the diagram below in nonebot2 project. - -#### plugin behaviour - -| Option | Type | Default | Description | -| ------------------------ | ------ | ------- | ---------------- | -| MARSHOAI_USE_YAML_CONFIG | `bool` | `false` | Use YAML config format | - -#### Marsho usage - -| Option | Type | Default | Description | -| --------------------- | ---------- | ----------- | ----------------- | -| MARSHOAI_DEFAULT_NAME | `str` | `marsho` | Command to call Marsho | -| MARSHOAI_ALIASES | `set[str]` | `set{"Marsho"}` | Other name(Alias) to call Marsho | -| MARSHOAI_AT | `bool` | `false` | Call by @ or not | -| MARSHOAI_MAIN_COLOUR | `str` | `FFAAAA` | Theme color, used by some tools and features | - -#### AI call - -| Option | Type | Default | Description | -| -------------------------------- | ------- | --------------------------------------- | --------------------------------------------------------------------------------------------- | -| MARSHOAI_TOKEN | `str` | | The token needed to call AI API | -| MARSHOAI_DEFAULT_MODEL | `str` | `gpt-4o-mini` | The default model of Marsho | -| MARSHOAI_PROMPT | `str` | Catgirl Marsho's character prompt | Marsho's basic system prompt **※Some models(o1 and so on) don't support it** | -| MARSHOAI_ADDITIONAL_PROMPT | `str` | | Marsho's external system prompt | -| MARSHOAI_POKE_SUFFIX | `str` | `揉了揉你的猫耳` | When double click Marsho who connected to OneBot adapter, the chat content. When it's empty string, double click function is off. Such as, the default content is `*[昵称]揉了揉你的猫耳。` | -| MARSHOAI_AZURE_ENDPOINT | `str` | `https://models.inference.ai.azure.com` | OpenAI standard API | -| MARSHOAI_TEMPERATURE | `float` | `null` | temperature parameter | -| MARSHOAI_TOP_P | `float` | `null` | Nucleus Sampling parameter | -| MARSHOAI_MAX_TOKENS | `int` | `null` | Max token number | -| MARSHOAI_ADDITIONAL_IMAGE_MODELS | `list` | `[]` | External image-support model list, such as `hunyuan-vision` | - -#### Feature Switches - -| Option | Type | Default | Description | -| --------------------------------- | ------ | ------ | -------------------------- | -| MARSHOAI_ENABLE_SUPPORT_IMAGE_TIP | `bool` | `true` | When on, if user send request with photo and model don't support that, remind the user | -| MARSHOAI_ENABLE_NICKNAME_TIP | `bool` | `true` | When on, if user haven't set username, remind user to set | -| MARSHOAI_ENABLE_PRAISES | `bool` | `true` | Turn on Praise list or not | -| MARSHOAI_ENABLE_TOOLS | `bool` | `true` | Turn on Marsho Tools or not | -| MARSHOAI_LOAD_BUILTIN_TOOLS | `bool` | `true` | Loading the built-in toolkit or not | -| MARSHOAI_TOOLSET_DIR | `list` | `[]` | List of external toolset directory | -| MARSHOAI_DISABLED_TOOLKITS | `list` | `[]` | List of disabled toolkits' name | -| MARSHOAI_ENABLE_RICHTEXT_PARSE | `bool` | `true` | Turn on auto parse rich text feature(including image, LaTeX equation) | -| MARSHOAI_SINGLE_LATEX_PARSE | `bool` | `false`| Render single-line equation or not | +## 😼 Usage +Please read [Documentation](https://marsho.liteyuki.icu/start/install) ## ❤ Thanks&Copyright -This project uses the following code from other projects: -- [nonebot-plugin-latex](https://github.com/EillesWan/nonebot-plugin-latex) +This project uses the following code from other projects: +- [nonebot-plugin-latex](https://github.com/EillesWan/nonebot-plugin-latex) -"Marsho" logo contributed by [@Asankilp](https://github.com/Asankilp), -licensed under [CC BY-NC-SA 4.0](http://creativecommons.org/licenses/by-nc-sa/4.0/) lisense. +"Marsho" logo contributed by [@Asankilp](https://github.com/Asankilp),licensed under [CC BY-NC-SA 4.0](http://creativecommons.org/licenses/by-nc-sa/4.0/) lisense. -"nonebot-plugin-marshoai" is licensed under [MIT](./LICENSE-MIT) license. -Some of the code is licensed under [Mulan PSL v2](./LICENSE-MULAN) license. - -## 🕊️ TODO - -- [x] [Melobot](https://github.com/Meloland/melobot) implementation -- [x] Congize chat initiator(know who are chatting with Marsho) (Initially implement) -- [ ] Optimize API (Not only GitHub Models) -- [ ] Persistent storage context by database +"nonebot-plugin-marshoai" is licensed under [MIT](./LICENSE-MIT) license. +Some of the code is licensed under [Mulan PSL v2](./LICENSE-MULAN) license. diff --git a/docs/en/start/install.md b/docs/en/start/install.md old mode 100755 new mode 100644 index e69de29b..afa352d6 --- a/docs/en/start/install.md +++ b/docs/en/start/install.md @@ -0,0 +1,141 @@ +## 💿 Install + +
+Install with nb-cli + +Open shell under the root directory of nonebot2, input the command below. + + nb plugin install nonebot-plugin-marshoai + +
+ +
+Install with pack manager + +Open shell under the plugin directory of nonebot2, input corresponding command according to your pack manager. + +
+pip + + pip install nonebot-plugin-marshoai + +
+
+pdm + + pdm add nonebot-plugin-marshoai + +
+
+poetry + + poetry add nonebot-plugin-marshoai + +
+
+conda + + conda install nonebot-plugin-marshoai + +
+ +Open the `pyproject.toml` file under nonebot2's root directory, Add to`[tool.nonebot]`. + + plugins = ["nonebot_plugin_marshoai"] + +
+ +## 🤖 Get token(GitHub Models) + +- Create new [personal access token](https://github.com/settings/tokens/new),**Don't need any permissions**. +- Copy the new token, add to the `.env` file's `marshoai_token` option. + +## 🎉 Usage + +End `marsho` in order to get direction for use(If you configured the custom command, please use the configured one). + +#### 👉 Double click avatar + +When nonebot linked to OneBot v11 adapter, can recieve double click and response to it. More detail in the `MARSHOAI_POKE_SUFFIX` option. + +## 🛠️ ~~MarshoTools~~ (Deprecated) + +MarshoTools is a feature added in `v0.5.0`, support loading external function library to provide Function Call for Marsho. + +## 🧩 Marsho Plugin +Marsho Plugin is a feature added in `v1.0.0`, replacing the old MarshoTools feature. [Documentation](https://marsho.liteyuki.icu/dev/extension) + +## 👍 Praise list + +Praise list stored in the `praises.json` in plugin directory(This directory will putput to log when Bot start), it'll automatically generate when option is `true`, include character name and advantage two basic data. + +The character stored in it would be “know” and “like” by Marsho. + +It's structure is similar to: + +```json +{ + "like": [ + { + "name": "Asankilp", + "advantages": "赋予了Marsho猫娘人格,使用vim与vscode为Marsho写了许多代码,使Marsho更加可爱" + }, + { + "name": "神羽(snowykami)", + "advantages": "人脉很广,经常找小伙伴们开银趴,很会写后端代码" + }, + ... + ] +} +``` + +## ⚙️ Configurable options + +Add options in the `.env` file from the diagram below in nonebot2 project. + +#### plugin behaviour + +| Option | Type | Default | Description | +| ------------------------ | ------ | ------- | ---------------- | +| MARSHOAI_USE_YAML_CONFIG | `bool` | `false` | Use YAML config format | +| MARSHOAI_DEVMODE | `bool` | `true` | Turn on Development Mode or not | + +#### Marsho usage + +| Option | Type | Default | Description | +| --------------------- | ---------- | ----------- | ----------------- | +| MARSHOAI_DEFAULT_NAME | `str` | `marsho` | Command to call Marsho | +| MARSHOAI_ALIASES | `set[str]` | `set{"Marsho"}` | Other name(Alias) to call Marsho | +| MARSHOAI_AT | `bool` | `false` | Call by @ or not | +| MARSHOAI_MAIN_COLOUR | `str` | `FFAAAA` | Theme color, used by some tools and features | + +#### AI call + +| Option | Type | Default | Description | +| -------------------------------- | ------- | --------------------------------------- | --------------------------------------------------------------------------------------------- | +| MARSHOAI_TOKEN | `str` | | The token needed to call AI API | +| MARSHOAI_DEFAULT_MODEL | `str` | `gpt-4o-mini` | The default model of Marsho | +| MARSHOAI_PROMPT | `str` | Catgirl Marsho's character prompt | Marsho's basic system prompt **※Some models(o1 and so on) don't support it** | +| MARSHOAI_ADDITIONAL_PROMPT | `str` | | Marsho's external system prompt | +| MARSHOAI_POKE_SUFFIX | `str` | `揉了揉你的猫耳` | When double click Marsho who connected to OneBot adapter, the chat content. When it's empty string, double click function is off. Such as, the default content is `*[昵称]揉了揉你的猫耳。` | +| MARSHOAI_AZURE_ENDPOINT | `str` | `https://models.inference.ai.azure.com` | OpenAI standard API | +| MARSHOAI_TEMPERATURE | `float` | `null` | temperature parameter | +| MARSHOAI_TOP_P | `float` | `null` | Nucleus Sampling parameter | +| MARSHOAI_MAX_TOKENS | `int` | `null` | Max token number | +| MARSHOAI_ADDITIONAL_IMAGE_MODELS | `list` | `[]` | External image-support model list, such as `hunyuan-vision` | + +#### Feature Switches + +| Option | Type | Default | Description | +| --------------------------------- | ------ | ------ | -------------------------- | +| MARSHOAI_ENABLE_SUPPORT_IMAGE_TIP | `bool` | `true` | When on, if user send request with photo and model don't support that, remind the user | +| MARSHOAI_ENABLE_NICKNAME_TIP | `bool` | `true` | When on, if user haven't set username, remind user to set | +| MARSHOAI_ENABLE_PRAISES | `bool` | `true` | Turn on Praise list or not | +| MARSHOAI_ENABLE_TOOLS | `bool` | `false` | Turn on Marsho Tools or not | +| MARSHOAI_ENABLE_PLUGINS | `bool` | `true` | Turn on Marsho Plugins or not +| MARSHOAI_PLUGIN_DIRS | `list[str]` | `[]` | List of plugins directory | +| MARSHOAI_LOAD_BUILTIN_TOOLS | `bool` | `true` | Loading the built-in toolkit or not | +| MARSHOAI_TOOLSET_DIR | `list` | `[]` | List of external toolset directory | +| MARSHOAI_DISABLED_TOOLKITS | `list` | `[]` | List of disabled toolkits' name | +| MARSHOAI_ENABLE_RICHTEXT_PARSE | `bool` | `true` | Turn on auto parse rich text feature(including image, LaTeX equation) | +| MARSHOAI_SINGLE_LATEX_PARSE | `bool` | `false`| Render single-line equation or not | diff --git a/docs/zh/start/install.md b/docs/zh/start/install.md old mode 100755 new mode 100644 index 18ad38b5..479ea5e2 --- a/docs/zh/start/install.md +++ b/docs/zh/start/install.md @@ -60,8 +60,11 @@ title: 安装 当 nonebot 连接到支持的 OneBot v11 实现端时,可以接收头像双击戳一戳消息并进行响应。详见`MARSHOAI_POKE_SUFFIX`配置项。 -## 🛠️ 小棉工具 -小棉工具(MarshoTools)是`v0.5.0`版本的新增功能,支持加载外部函数库来为 Marsho 提供 Function Call 功能。[使用文档] +## 🛠️ ~~小棉工具~~(已弃用) +小棉工具(MarshoTools)是`v0.5.0`版本的新增功能,支持加载外部函数库来为 Marsho 提供 Function Call 功能。 + +## 🧩 小棉插件 +小棉插件是`v1.0.0`的新增功能,替代旧的小棉工具功能。[使用文档](https://marsho.liteyuki.icu/dev/extension) ## 👍 夸赞名单 @@ -95,6 +98,7 @@ title: 安装 | 配置项 | 类型 | 默认值 | 说明 | | ------------------------ | ------ | ------- | ---------------- | | MARSHOAI_USE_YAML_CONFIG | `bool` | `false` | 是否使用 YAML 配置文件格式 | +| MARSHOAI_DEVMODE | `bool` | `false` | 是否启用开发者模式 | #### Marsho 使用方式 @@ -127,7 +131,9 @@ title: 安装 | MARSHOAI_ENABLE_SUPPORT_IMAGE_TIP | `bool` | `true` | 启用后用户发送带图请求时若模型不支持图片,则提示用户 | | MARSHOAI_ENABLE_NICKNAME_TIP | `bool` | `true` | 启用后用户未设置昵称时提示用户设置 | | MARSHOAI_ENABLE_PRAISES | `bool` | `true` | 是否启用夸赞名单功能 | -| MARSHOAI_ENABLE_TOOLS | `bool` | `true` | 是否启用小棉工具 | +| MARSHOAI_ENABLE_TOOLS | `bool` | `false` | 是否启用小棉工具 | +| MARSHOAI_ENABLE_PLUGINS | `bool` | `true` | 是否启用小棉插件 | +| MARSHOAI_PLUGIN_DIRS | `list[str]` | `[]` | 插件目录路径列表 | | MARSHOAI_LOAD_BUILTIN_TOOLS | `bool` | `true` | 是否加载内置工具包 | | MARSHOAI_TOOLSET_DIR | `list` | `[]` | 外部工具集路径列表 | | MARSHOAI_DISABLED_TOOLKITS | `list` | `[]` | 禁用的工具包包名列表 | diff --git a/nonebot_plugin_marshoai/azure.py b/nonebot_plugin_marshoai/azure.py old mode 100755 new mode 100644 index 6e7efecc..6c397198 --- a/nonebot_plugin_marshoai/azure.py +++ b/nonebot_plugin_marshoai/azure.py @@ -106,9 +106,13 @@ async def _preload_tools(): @driver.on_startup async def _preload_plugins(): """启动钩子加载插件""" - marshoai_plugin_dirs = config.marshoai_plugin_dirs # 外部插件目录列表 - marshoai_plugin_dirs.insert(0, Path(__file__).parent / "plugins") # 预置插件目录 - load_plugins(*marshoai_plugin_dirs) + if config.marshoai_enable_plugins: + marshoai_plugin_dirs = config.marshoai_plugin_dirs # 外部插件目录列表 + marshoai_plugin_dirs.insert(0, Path(__file__).parent / "plugins") # 预置插件目录 + load_plugins(*marshoai_plugin_dirs) + logger.info( + "如果启用小棉插件后使用的模型出现报错,请尝试将 MARSHOAI_ENABLE_PLUGINS 设为 false。" + ) @add_usermsg_cmd.handle() diff --git a/nonebot_plugin_marshoai/config.py b/nonebot_plugin_marshoai/config.py old mode 100755 new mode 100644 index c4c1239c..941569c5 --- a/nonebot_plugin_marshoai/config.py +++ b/nonebot_plugin_marshoai/config.py @@ -36,7 +36,8 @@ class ConfigModel(BaseModel): marshoai_enable_support_image_tip: bool = True marshoai_enable_praises: bool = True marshoai_enable_time_prompt: bool = True - marshoai_enable_tools: bool = True + marshoai_enable_tools: bool = False + marshoai_enable_plugins: bool = True marshoai_load_builtin_tools: bool = True marshoai_toolset_dir: list = [] marshoai_disabled_toolkits: list = [] diff --git a/nonebot_plugin_marshoai/config_example.yaml b/nonebot_plugin_marshoai/config_example.yaml old mode 100755 new mode 100644 index f72a13fb..8e544d2d --- a/nonebot_plugin_marshoai/config_example.yaml +++ b/nonebot_plugin_marshoai/config_example.yaml @@ -34,7 +34,9 @@ marshoai_enable_support_image_tip: true # 是否启用支持图片提示。 marshoai_enable_praises: true # 是否启用夸赞名单功能。 -marshoai_enable_tools: true # 是否启用工具支持。 +marshoai_enable_tools: false # 是否启用工具支持。 + +marshoai_enable_plugins: true # 是否启用插件功能。 marshoai_load_builtin_tools: true # 是否加载内置工具。 @@ -42,6 +44,10 @@ marshoai_toolset_dir: [] # 工具集路径。 marshoai_disabled_toolkits: [] # 已禁用的工具包列表。 +marshoai_plugin_dirs: [] # 插件路径。 + +marshoai_devmode: false # 是否启用开发者模式。 + marshoai_azure_endpoint: "https://models.inference.ai.azure.com" # OpenAI 标准格式 API 的端点。 # 模型参数配置 @@ -54,3 +60,4 @@ marshoai_additional_image_models: [] # 额外的图片模型列表,默认空 # 腾讯云的API密钥,未设置时为空。 marshoai_tencent_secretid: null marshoai_tencent_secretkey: null + diff --git a/nonebot_plugin_marshoai/plugin/__init__.py b/nonebot_plugin_marshoai/plugin/__init__.py old mode 100755 new mode 100644 index 1de4dd97..232f1a16 --- a/nonebot_plugin_marshoai/plugin/__init__.py +++ b/nonebot_plugin_marshoai/plugin/__init__.py @@ -1,4 +1,4 @@ -"""该功能目前正在开发中,暂时不可用,受影响的文件夹 `plugin`, `plugins` +"""该功能目前~~正在开发中~~开发基本完成,暂时~~不~~可用,受影响的文件夹 `plugin`, `plugins` """ from nonebot import logger @@ -8,4 +8,4 @@ from .load import * from .models import * from .utils import * -logger.opt(colors=True).info("MarshoAI 插件功能开发中,用户请忽略相关日志") +#logger.opt(colors=True).info("MarshoAI 插件功能开发中,用户请忽略相关日志") diff --git a/resources/marsho-new.png b/resources/marsho-new.png new file mode 100644 index 00000000..34f2a7ba Binary files /dev/null and b/resources/marsho-new.png differ