mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-12-21 04:06:53 +00:00
Compare commits
6 Commits
v1.0.5
...
mod/comman
| Author | SHA1 | Date | |
|---|---|---|---|
| 3f0ebd9327 | |||
| 8ec3faf245 | |||
|
|
581ac2b3d1 | ||
| c97cf68393 | |||
| 685f813e22 | |||
|
|
c54b0cda3c |
3
.github/workflows/pypi-publish.yml
vendored
3
.github/workflows/pypi-publish.yml
vendored
@@ -1,9 +1,6 @@
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- 'v*'
|
||||
release:
|
||||
types:
|
||||
- published
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -170,7 +170,6 @@ cython_debug/
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
bot.py
|
||||
pdm.lock
|
||||
praises.json
|
||||
*.bak
|
||||
config/
|
||||
|
||||
8
.pre-commit-config.yaml
Executable file → Normal file
8
.pre-commit-config.yaml
Executable file → Normal file
@@ -9,19 +9,19 @@ repos:
|
||||
files: \.py$
|
||||
|
||||
- repo: https://github.com/psf/black
|
||||
rev: 24.4.2
|
||||
rev: 25.1.0
|
||||
hooks:
|
||||
- id: black
|
||||
args: [--config=./pyproject.toml]
|
||||
|
||||
- repo: https://github.com/timothycrosley/isort
|
||||
rev: 5.13.2
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 6.0.0
|
||||
hooks:
|
||||
- id: isort
|
||||
args: ["--profile", "black"]
|
||||
|
||||
- repo: https://github.com/pre-commit/mirrors-mypy
|
||||
rev: v1.13.0
|
||||
rev: v1.15.0
|
||||
hooks:
|
||||
- id: mypy
|
||||
|
||||
|
||||
@@ -8,8 +8,9 @@
|
||||
|
||||
# nonebot-plugin-marshoai
|
||||
|
||||
_✨ 使用 OpenAI 标准格式 API 的聊天机器人插件 ✨_
|
||||
_✨ 使用 OpenAI 标准格式 API 的聊天机器人插件 ✨_
|
||||
|
||||
[](https://qm.qq.com/q/a13iwP5kAw)
|
||||
[](https://registry.nonebot.dev/plugin/nonebot-plugin-marshoai:nonebot_plugin_marshoai)
|
||||
<a href="https://registry.nonebot.dev/plugin/nonebot-plugin-marshoai:nonebot_plugin_marshoai">
|
||||
<img src="https://img.shields.io/endpoint?url=https%3A%2F%2Fnbbdg.lgc2333.top%2Fplugin-adapters%2Fnonebot-plugin-marshoai&style=flat-square" alt="Supported Adapters">
|
||||
@@ -19,7 +20,8 @@ _✨ 使用 OpenAI 标准格式 API 的聊天机器人插件 ✨_
|
||||
</a>
|
||||
<img src="https://img.shields.io/badge/python-3.10+-blue.svg?style=flat-square" alt="python">
|
||||
<img src="https://img.shields.io/badge/Code%20Style-Black-121110.svg?style=flat-square" alt="codestyle">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
## 📖 介绍
|
||||
|
||||
@@ -45,7 +47,7 @@ _谁不喜欢回复消息快又可爱的猫娘呢?_
|
||||
|
||||
## 😼 使用
|
||||
|
||||
请查看[使用文档](https://marsho.liteyuki.icu/start/install)
|
||||
请查看[使用文档](https://marsho.liteyuki.icu/start/use)
|
||||
|
||||
## ❤ 鸣谢&版权说明
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: 安装
|
||||
title: 安装 (old)
|
||||
---
|
||||
|
||||
## 💿 安装
|
||||
|
||||
@@ -33,10 +33,12 @@ MarshoAI 兼容 DeepSeek-R1 模型,你可通过以下步骤来使用:
|
||||
MARSHOAI_TOKEN="<你的 API Key>"
|
||||
MARSHOAI_AZURE_ENDPOINT="https://api.deepseek.com"
|
||||
MARSHOAI_DEFAULT_MODEL="deepseek-reasoner"
|
||||
MARSHOAI_ENABLE_PLUGINS=false
|
||||
```
|
||||
你可修改 `MARSHOAI_DEFAULT_MODEL` 为 其它模型名来调用其它 DeepSeek 模型。
|
||||
:::tip
|
||||
如果使用 one-api 作为中转,你可将 `MARSHOAI_AZURE_ENDPOINT` 设置为 one-api 的地址,将 `MARSHOAI_TOKEN` 设为 one-api 配置的令牌,在 one-api 中添加 DeepSeek 渠道。
|
||||
如果使用 one-api 作为中转,你可将 `MARSHOAI_AZURE_ENDPOINT` 设置为 one-api 的地址,将 `MARSHOAI_TOKEN` 设为 one-api 配置的令牌,在 one-api 中添加 DeepSeek 渠道。
|
||||
同样可使用其它提供商(例如 [SiliconFlow](https://siliconflow.cn/))提供的 DeepSeek 等模型。
|
||||
:::
|
||||
|
||||
### 使用 vLLM 部署本地模型
|
||||
|
||||
3
main.py
3
main.py
@@ -1,5 +1,4 @@
|
||||
"""该入口文件仅在nb run无法正常工作时使用
|
||||
"""
|
||||
"""该入口文件仅在nb run无法正常工作时使用"""
|
||||
|
||||
import nonebot
|
||||
from nonebot import get_driver
|
||||
|
||||
@@ -2,10 +2,11 @@ import re
|
||||
|
||||
from .config import config
|
||||
|
||||
NAME: str = config.marshoai_default_name
|
||||
USAGE: str = f"""用法:
|
||||
{config.marshoai_default_name} <聊天内容> : 与 Marsho 进行对话。当模型为 GPT-4o(-mini) 等时,可以带上图片进行对话。
|
||||
{NAME} <聊天内容> : 与 Marsho 进行对话。当模型为 GPT-4o(-mini) 等时,可以带上图片进行对话。
|
||||
nickname [昵称] : 为自己设定昵称,设置昵称后,Marsho 会根据你的昵称进行回答。使用'nickname reset'命令可清除自己设定的昵称。
|
||||
reset : 重置当前会话的上下文。 ※需要加上命令前缀使用(默认为'/')。
|
||||
{NAME}.reset : 重置当前会话的上下文。
|
||||
超级用户命令(均需要加上命令前缀使用):
|
||||
changemodel <模型名> : 切换全局 AI 模型。
|
||||
contexts : 返回当前会话的上下文列表。 ※当上下文包含图片时,不要使用此命令。
|
||||
|
||||
@@ -37,7 +37,6 @@ async def at_enable():
|
||||
changemodel_cmd = on_command(
|
||||
"changemodel", permission=SUPERUSER, priority=10, block=True
|
||||
)
|
||||
resetmem_cmd = on_command("reset", priority=10, block=True)
|
||||
# setprompt_cmd = on_command("prompt",permission=SUPERUSER)
|
||||
praises_cmd = on_command("praises", permission=SUPERUSER, priority=10, block=True)
|
||||
add_usermsg_cmd = on_command("usermsg", permission=SUPERUSER, priority=10, block=True)
|
||||
@@ -60,6 +59,13 @@ marsho_cmd = on_alconna(
|
||||
priority=10,
|
||||
block=True,
|
||||
)
|
||||
resetmem_cmd = on_alconna(
|
||||
Alconna(
|
||||
config.marshoai_default_name + ".reset",
|
||||
),
|
||||
priority=10,
|
||||
block=True,
|
||||
)
|
||||
marsho_help_cmd = on_alconna(
|
||||
Alconna(
|
||||
config.marshoai_default_name + ".help",
|
||||
@@ -340,13 +346,13 @@ async def marsho(
|
||||
while choice.message.tool_calls != None:
|
||||
# await UniMessage(str(response)).send()
|
||||
tool_calls = choice.message.tool_calls
|
||||
try:
|
||||
if tool_calls[0]["function"]["name"].startswith("$"):
|
||||
choice.message.tool_calls[0][
|
||||
"type"
|
||||
] = "builtin_function" # 兼容 moonshot AI 内置函数的临时方案
|
||||
except:
|
||||
pass
|
||||
# try:
|
||||
# if tool_calls[0]["function"]["name"].startswith("$"):
|
||||
# choice.message.tool_calls[0][
|
||||
# "type"
|
||||
# ] = "builtin_function" # 兼容 moonshot AI 内置函数的临时方案
|
||||
# except:
|
||||
# pass
|
||||
tool_msg.append(choice.message)
|
||||
for tool_call in tool_calls:
|
||||
try:
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
"""该功能目前~~正在开发中~~开发基本完成,暂时~~不~~可用,受影响的文件夹 `plugin`, `plugins`
|
||||
"""
|
||||
"""该功能目前~~正在开发中~~开发基本完成,暂时~~不~~可用,受影响的文件夹 `plugin`, `plugins`"""
|
||||
|
||||
from .func_call import *
|
||||
from .load import *
|
||||
|
||||
Reference in New Issue
Block a user