mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2024-11-27 07:15:03 +08:00
Nonebot2插件构建准备
This commit is contained in:
parent
e408a48e42
commit
f5e8f435f4
1
.gitignore
vendored
1
.gitignore
vendored
@ -163,3 +163,4 @@ cython_debug/
|
|||||||
#.idea/
|
#.idea/
|
||||||
bot.py
|
bot.py
|
||||||
pdm.lock
|
pdm.lock
|
||||||
|
praises.json
|
128
README.md
Normal file
128
README.md
Normal file
@ -0,0 +1,128 @@
|
|||||||
|
<div align="center">
|
||||||
|
<a href="https://v2.nonebot.dev/store"><img src="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/blob/resources/nbp_logo.png" width="180" height="180" alt="NoneBotPluginLogo"></a>
|
||||||
|
<br>
|
||||||
|
<p><img src="https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/blob/resources/NoneBotPlugin.svg" width="240" alt="NoneBotPluginText"></p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|
# nonebot-plugin-marshoai
|
||||||
|
|
||||||
|
_✨ 使用 Azure OpenAI 推理服务的聊天机器人插件 ✨_
|
||||||
|
|
||||||
|
<a href="./LICENSE">
|
||||||
|
<img src="https://img.shields.io/github/license/LiteyukiStudio/nonebot-plugin-marshoai.svg" alt="license">
|
||||||
|
</a>
|
||||||
|
<a href="https://pypi.python.org/pypi/nonebot-plugin-marshoai">
|
||||||
|
<img src="https://img.shields.io/pypi/v/nonebot-plugin-marshoai.svg" alt="pypi">
|
||||||
|
</a>
|
||||||
|
<img src="https://img.shields.io/badge/python-3.9+-blue.svg" alt="python">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
## 📖 介绍
|
||||||
|
|
||||||
|
通过调用由 Azure OpenAI 驱动,GitHub Models 提供访问的生成式 AI 推理 API 来实现聊天的插件。
|
||||||
|
插件内置了猫娘小棉(Marsho)的人物设定,可以进行可爱的聊天!
|
||||||
|
*谁不喜欢回复消息快又可爱的猫娘呢?*
|
||||||
|
**※对 Azure AI Studio等的支持待定。**
|
||||||
|
|
||||||
|
## 🐱 设定
|
||||||
|
#### 基本信息
|
||||||
|
|
||||||
|
- 名字:小棉(Marsho)
|
||||||
|
- 生日:9月6日
|
||||||
|
|
||||||
|
#### 喜好
|
||||||
|
|
||||||
|
- 🌞 晒太阳晒到融化
|
||||||
|
- 🤱 撒娇啊~谁不喜欢呢~
|
||||||
|
- 🍫 吃零食!肉肉好吃!
|
||||||
|
- 🐾 玩!我喜欢和朋友们一起玩!
|
||||||
|
|
||||||
|
## 💿 安装
|
||||||
|
|
||||||
|
<details open>
|
||||||
|
<summary>使用 nb-cli 安装</summary>
|
||||||
|
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
|
||||||
|
|
||||||
|
nb plugin install nonebot-plugin-marshoai
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>使用包管理器安装</summary>
|
||||||
|
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>pip</summary>
|
||||||
|
|
||||||
|
pip install nonebot-plugin-marshoai
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>pdm</summary>
|
||||||
|
|
||||||
|
pdm add nonebot-plugin-marshoai
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>poetry</summary>
|
||||||
|
|
||||||
|
poetry add nonebot-plugin-marshoai
|
||||||
|
|
||||||
|
</details>
|
||||||
|
<details>
|
||||||
|
<summary>conda</summary>
|
||||||
|
|
||||||
|
conda install nonebot-plugin-marshoai
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分追加写入
|
||||||
|
|
||||||
|
plugins = ["nonebot_plugin_marshoai"]
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## 🤖 获取 token
|
||||||
|
- 如果你未获取GitHub Models的早期访问权限,请前往[GitHub Marketplace中的Models分页](https://github.com/marketplace/models),点击`Get early access`按钮获取早期访问权限。
|
||||||
|
- [新建一个personal access token](https://github.com/settings/tokens/new),**不需要给予任何权限**。
|
||||||
|
- 将新建的 token 复制,添加到`MARSHOAI_TOKEN`配置项中。
|
||||||
|
## 🎉 使用
|
||||||
|
|
||||||
|
发送`marsho`指令可以获取使用说明
|
||||||
|
|
||||||
|
## 👍 夸赞名单
|
||||||
|
夸赞名单存储于 Bot 工作目录的`praises.json`下,当配置项为`true`时发起一次聊天后自动生成,包含人物名字与人物优点两个基本数据。
|
||||||
|
存储于其中的人物会被 Marsho “认识”和“喜欢”。
|
||||||
|
其结构类似于:
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"like": [
|
||||||
|
{
|
||||||
|
"name": "Asankilp",
|
||||||
|
"advantages": "赋予了Marsho猫娘人格,使用vim与vscode为Marsho写了许多代码,使Marsho更加可爱"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "神羽(snowykami)",
|
||||||
|
"advantages": "人脉很广,经常找小伙伴们开银趴,很会写后端代码"
|
||||||
|
},
|
||||||
|
...
|
||||||
|
]
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
## ⚙️ 配置
|
||||||
|
|
||||||
|
在 nonebot2 项目的`.env`文件中添加下表中的配置
|
||||||
|
|
||||||
|
| 配置项 | 必填 | 默认值 | 说明 |
|
||||||
|
| :---------------: | :--: | :----: | :----------------------------------------------------------: |
|
||||||
|
| MARSHOAI_TOKEN | 是 | 无 | 调用 API 必需的 token |
|
||||||
|
| MARSHOAI_DEFAULT_MODEL | 否 | `gpt-4o` | Marsho 默认调用的模型 |
|
||||||
|
| MARSHOAI_PROMPT | 否 | 猫娘 Marsho 人设提示词 | Marsho 的基本系统提示词 |
|
||||||
|
| MARSHOAI_ADDITIONAL_PROMPT | 否 | 无 | Marsho 的扩展系统提示词 |
|
||||||
|
| MARSHOAI_ENABLE_PRAISES | 否 | `true` | 是否启用夸赞名单功能 |
|
||||||
|
| MARSHOAI_ENABLE_TIME_PROMPT | 否 | `true` | 是否启用实时更新的日期与时间(精确到秒)与农历日期系统提示词 |
|
||||||
|
| MARSHOAI_AZURE_ENDPOINT | 否 | `https://models.inference.ai.azure.com` | 调用 Azure OpenAI 服务的 API 终结点 |
|
40
pyproject.toml
Normal file
40
pyproject.toml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
[project]
|
||||||
|
name = "nonebot-plugin-marshoai"
|
||||||
|
version = "0.1"
|
||||||
|
description = "Nonebot2插件,从哔哩哔哩会员购获取简易展览数据"
|
||||||
|
readme = "README.md"
|
||||||
|
requires-python = "<4.0,>=3.9"
|
||||||
|
authors = [{ name = "Asankilp", email = "asankilp@outlook.com" }]
|
||||||
|
dependencies = [
|
||||||
|
"nonebot2[fastapi, websockets]>=2.2.0",
|
||||||
|
"nonebot-plugin-alconna>=0.48.0",
|
||||||
|
"azure-ai-inference>=1.0.0b4",
|
||||||
|
"zhDatetime>=1.1.0",
|
||||||
|
"aiohttp>=3.9"
|
||||||
|
]
|
||||||
|
license = { text = "MIT" }
|
||||||
|
|
||||||
|
[project.urls]
|
||||||
|
Homepage = "https://github.com/LiteyukiStudio/nonebot-plugin-marshoai"
|
||||||
|
|
||||||
|
|
||||||
|
[tool.nonebot]
|
||||||
|
plugins = ["nonebot_plugin_marshoai"]
|
||||||
|
adapters = [
|
||||||
|
{ name = "OneBot V11", module_name = "nonebot.adapters.onebot.v11" },
|
||||||
|
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
[tool.pdm]
|
||||||
|
distribution = true
|
||||||
|
|
||||||
|
[tool.pdm.version]
|
||||||
|
source = "file"
|
||||||
|
path = "nonebot_plugin_marshoai/__init__.py"
|
||||||
|
|
||||||
|
[tool.pdm.build]
|
||||||
|
includes = []
|
||||||
|
[build-system]
|
||||||
|
requires = ["pdm-backend"]
|
||||||
|
build-backend = "pdm.backend"
|
Loading…
Reference in New Issue
Block a user