2024-11-26 13:00:04 +08:00
<!-- suppress LongLine -->
< div align = "center" >
< a href = "https://v2.nonebot.dev/store" > < img src = "https://raw.githubusercontent.com/LiteyukiStudio/nonebot-plugin-marshoai/refs/heads/main/resources/marsho-new.svg" width = "800" height = "430" alt = "NoneBotPluginLogo" > < / a >
< br >
< / div >
< div align = "center" >
# nonebot-plugin-marshoai
2024-11-26 14:08:30 +08:00
_✨ A chat bot plugin which use OpenAI standard API ✨_
2024-11-26 13:00:04 +08:00
< 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 >
2024-11-26 14:08:30 +08:00
## 📖 Indroduction
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
A plugin made by call OpenAI standard API(Such as drive by Azure OpenAI, GitHub Models provides AI logic API)
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
Plugin internally installed the catgirl character of Marsho, is able to have a cute conversation!
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
*Who don't like a cute catgirl with fast answer speed? *
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
**Support for adapters other than OneBot and non-Github Models APIs is not fully verified.**
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
[Melobot implementation ](https://github.com/LiteyukiStudio/marshoai-melo )
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
## 🐱 Character setting
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
#### Basic information
- Name : Marsho
- Birthday : September 6th
#### Hobbies
- 🌞 Melt in sunshine
- 🤱 Coquetry~ who don't like that~
- 🍫 Eating snacks! Meat is yummy!
- 🐾 Play! I like play with friends!
## 💿 Install
2024-11-26 13:00:04 +08:00
< details open >
2024-11-26 14:08:30 +08:00
< summary > Install with nb-cli< / summary >
Open cmd under the root directory of nonebot2, input the instruction below.
2024-11-26 13:00:04 +08:00
nb plugin install nonebot-plugin-marshoai
< / details >
< details >
2024-11-26 14:08:30 +08:00
< summary > Install with pack manager< / summary >
Open cmd under the plugin directory of nonebot2, input corresponding instruction by your pack manager.
2024-11-26 13:00:04 +08:00
< 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 >
2024-11-26 14:08:30 +08:00
Open the `pyproject.toml` file under nonebot2's root directory, Add to`[tool.nonebot]`.
2024-11-26 13:00:04 +08:00
plugins = ["nonebot_plugin_marshoai"]
< / details >
2024-11-26 14:08:30 +08:00
## 🤖 Get token(GitHub Models)
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
- Create new [personal access token ](https://github.com/settings/tokens/new ), **Don't need any access rights**。
- Copy the new token, add to the `.env` file's `marshoai_token` option.
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
## 🎉 Usage
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
End `marsho` in order to get direction for use(If you optimise the instruction, please use the optimised one).
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
#### 👉 Double click avatar
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
When nonebot linked to OneBot v11, can recieve double click and response to it. More detail in the `MARSHOAI_POKE_SUFFIX` option.
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
## 🛠️ MarshoTools
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
MarshoTools is a function added in `v0.5.0` , support loading external function library to provide Function Call for Marsho. [Usage document ](./README_TOOLS_EN.md )
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
## 👍 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:
2024-11-26 13:00:04 +08:00
```json
{
"like": [
{
"name": "Asankilp",
"advantages": "赋予了Marsho猫娘人格, 使用vim与vscode为Marsho写了许多代码, 使Marsho更加可爱"
},
{
"name": "神羽(snowykami)",
"advantages": "人脉很广,经常找小伙伴们开银趴,很会写后端代码"
},
...
]
}
```
2024-11-26 14:08:30 +08:00
## ⚙️ Configurable options
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
In nonebot2,Add options in the `.env` file from the diagram below.
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
#### plugin behaviour
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
| Option | Type | Default | Describe |
2024-11-26 13:00:04 +08:00
| ------------------------ | ------ | ------- | ---------------- |
2024-11-26 14:08:30 +08:00
| MARSHOAI_USE_YAML_CONFIG | `bool` | `false` | Use YAML to configurate file format or not|
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
#### How to use Marsho
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
| Option | Type | Default | Describe |
2024-11-26 13:00:04 +08:00
| --------------------- | ---------- | ----------- | ----------------- |
2024-11-26 14:08:30 +08:00
| MARSHOAI_DEFAULT_NAME | `str` | `marsho` | Instruction to call Marsho |
| MARSHOAI_ALIASES | `set[str]` | `set{"Marsho"}` | Other name to call Marsho |
| MARSHOAI_AT | `bool` | `false` | Call by @ or not |
2024-11-26 13:00:04 +08:00
#### AI 调用
2024-11-26 14:08:30 +08:00
| Option | Type | Default | Describe |
2024-11-26 13:00:04 +08:00
| -------------------------------- | ------- | --------------------------------------- | --------------------------------------------------------------------------------------------- |
2024-11-26 14:08:30 +08:00
| 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 call-words | Marsho's basic system call-words ** ※Some models(o1 and so on) don't support it** |
| MARSHOAI_ADDITIONAL_PROMPT | `str` | | Marsho's external system call-words |
| MARSHOAI_POKE_SUFFIX | `str` | `揉了揉你的猫耳` | 对 When OneBot user connected by Marsho double click, the 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` | logical generate diverse(temperature) parameter |
| MARSHOAI_TOP_P | `float` | `null` | Logical core sampling parameter |
| MARSHOAI_MAX_TOKENS | `int` | `null` | Max token number |
| MARSHOAI_ADDITIONAL_IMAGE_MODELS | `list` | `[]` | External image-support model list, such as `hunyuan-vision` |
#### Swithes
| Option | Type | Default | Description |
2024-11-26 13:00:04 +08:00
| --------------------------------- | ------ | ------ | -------------------------- |
2024-11-26 14:08:30 +08:00
| 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 tool pack or not |
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
## ❤ Thanks&Copyright
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
"Marsho" logo contributed by [@Asankilp ](https://github.com/Asankilp ),
Based on [CC BY-NC-SA 4.0 ](http://creativecommons.org/licenses/by-nc-sa/4.0/ ) lisense.
2024-11-26 13:00:04 +08:00
2024-11-26 14:08:30 +08:00
"nonebot-plugin-marshoai" is based on [MIT ](./LICENSE ) license.
2024-11-26 13:00:04 +08:00
## 🕊️ TODO
2024-11-26 14:08:30 +08:00
- [x] Achieve [Melobot ](https://github.com/Meloland/melobot )
- [x] Congize chat initiator(know who are chatting with Marsho) (Initially acieved)
- [ ] Optimize API (Not only GitHub Models)
- [ ] 上下文通过数据库持久化存储Store context by database