Compare commits

...

6 Commits

Author SHA1 Message Date
3f0ebd9327 更新 .gitignore,修改 pypi-publish.yml 以删除冲突发布触发条件;调整 marsho.py 中的命令名称;更新使用文档。 2025-02-12 09:58:43 +08:00
8ec3faf245 🔧 update command 2025-02-12 12:55:43 +08:00
pre-commit-ci[bot]
581ac2b3d1 [pre-commit.ci] pre-commit autoupdate (#9)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/psf/black: 24.4.2 → 25.1.0](https://github.com/psf/black/compare/24.4.2...25.1.0)
- https://github.com/timothycrosley/isorthttps://github.com/PyCQA/isort
- [github.com/PyCQA/isort: 5.13.2 → 6.0.0](https://github.com/PyCQA/isort/compare/5.13.2...6.0.0)
- [github.com/pre-commit/mirrors-mypy: v1.13.0 → v1.15.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.13.0...v1.15.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2025-02-11 13:48:54 +08:00
c97cf68393 🔥 移除对moonshot内置函数的临时兼容处理代码 2025-02-10 23:54:01 +08:00
685f813e22 更新使用文档链接并标记旧安装文档 2025-02-10 23:39:01 +08:00
Akarin~
c54b0cda3c 📝 添加QQ群 2025-02-08 23:30:04 +08:00
11 changed files with 2938 additions and 27 deletions

View File

@@ -1,9 +1,6 @@
name: Publish name: Publish
on: on:
push:
tags:
- 'v*'
release: release:
types: types:
- published - published

1
.gitignore vendored
View File

@@ -170,7 +170,6 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
bot.py bot.py
pdm.lock
praises.json praises.json
*.bak *.bak
config/ config/

8
.pre-commit-config.yaml Executable file → Normal file
View File

@@ -9,19 +9,19 @@ repos:
files: \.py$ files: \.py$
- repo: https://github.com/psf/black - repo: https://github.com/psf/black
rev: 24.4.2 rev: 25.1.0
hooks: hooks:
- id: black - id: black
args: [--config=./pyproject.toml] args: [--config=./pyproject.toml]
- repo: https://github.com/timothycrosley/isort - repo: https://github.com/PyCQA/isort
rev: 5.13.2 rev: 6.0.0
hooks: hooks:
- id: isort - id: isort
args: ["--profile", "black"] args: ["--profile", "black"]
- repo: https://github.com/pre-commit/mirrors-mypy - repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0 rev: v1.15.0
hooks: hooks:
- id: mypy - id: mypy

View File

@@ -10,6 +10,7 @@
_✨ 使用 OpenAI 标准格式 API 的聊天机器人插件 ✨_ _✨ 使用 OpenAI 标准格式 API 的聊天机器人插件 ✨_
[![QQ群](https://img.shields.io/badge/QQ群-1029557452-blue.svg?logo=QQ)](https://qm.qq.com/q/a13iwP5kAw)
[![NoneBot Registry](https://img.shields.io/endpoint?url=https%3A%2F%2Fnbbdg.lgc2333.top%2Fplugin%2Fnonebot-plugin-marshoai&style=flat-square)](https://registry.nonebot.dev/plugin/nonebot-plugin-marshoai:nonebot_plugin_marshoai) [![NoneBot Registry](https://img.shields.io/endpoint?url=https%3A%2F%2Fnbbdg.lgc2333.top%2Fplugin%2Fnonebot-plugin-marshoai&style=flat-square)](https://registry.nonebot.dev/plugin/nonebot-plugin-marshoai:nonebot_plugin_marshoai)
<a href="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"> <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">
@@ -21,6 +22,7 @@ _✨ 使用 OpenAI 标准格式 API 的聊天机器人插件 ✨_
<img src="https://img.shields.io/badge/Code%20Style-Black-121110.svg?style=flat-square" alt="codestyle"> <img src="https://img.shields.io/badge/Code%20Style-Black-121110.svg?style=flat-square" alt="codestyle">
</div> </div>
## 📖 介绍 ## 📖 介绍
通过调用 OpenAI 标准格式 API(例如 GitHub Models API) 来实现聊天的插件。 通过调用 OpenAI 标准格式 API(例如 GitHub Models API) 来实现聊天的插件。
@@ -45,7 +47,7 @@ _谁不喜欢回复消息快又可爱的猫娘呢_
## 😼 使用 ## 😼 使用
请查看[使用文档](https://marsho.liteyuki.icu/start/install) 请查看[使用文档](https://marsho.liteyuki.icu/start/use)
## ❤ 鸣谢&版权说明 ## ❤ 鸣谢&版权说明

View File

@@ -1,5 +1,5 @@
--- ---
title: 安装 title: 安装 (old)
--- ---
## 💿 安装 ## 💿 安装

View File

@@ -33,10 +33,12 @@ MarshoAI 兼容 DeepSeek-R1 模型,你可通过以下步骤来使用:
MARSHOAI_TOKEN="<你的 API Key>" MARSHOAI_TOKEN="<你的 API Key>"
MARSHOAI_AZURE_ENDPOINT="https://api.deepseek.com" MARSHOAI_AZURE_ENDPOINT="https://api.deepseek.com"
MARSHOAI_DEFAULT_MODEL="deepseek-reasoner" MARSHOAI_DEFAULT_MODEL="deepseek-reasoner"
MARSHOAI_ENABLE_PLUGINS=false
``` ```
你可修改 `MARSHOAI_DEFAULT_MODEL` 为 其它模型名来调用其它 DeepSeek 模型。 你可修改 `MARSHOAI_DEFAULT_MODEL` 为 其它模型名来调用其它 DeepSeek 模型。
:::tip :::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 部署本地模型 ### 使用 vLLM 部署本地模型

View File

@@ -1,5 +1,4 @@
"""该入口文件仅在nb run无法正常工作时使用 """该入口文件仅在nb run无法正常工作时使用"""
"""
import nonebot import nonebot
from nonebot import get_driver from nonebot import get_driver

View File

@@ -2,10 +2,11 @@ import re
from .config import config from .config import config
NAME: str = config.marshoai_default_name
USAGE: str = f"""用法: USAGE: str = f"""用法:
{config.marshoai_default_name} <聊天内容> : 与 Marsho 进行对话。当模型为 GPT-4o(-mini) 等时,可以带上图片进行对话。 {NAME} <聊天内容> : 与 Marsho 进行对话。当模型为 GPT-4o(-mini) 等时,可以带上图片进行对话。
nickname [昵称] : 为自己设定昵称设置昵称后Marsho 会根据你的昵称进行回答。使用'nickname reset'命令可清除自己设定的昵称。 nickname [昵称] : 为自己设定昵称设置昵称后Marsho 会根据你的昵称进行回答。使用'nickname reset'命令可清除自己设定的昵称。
reset : 重置当前会话的上下文。 ※需要加上命令前缀使用(默认为'/')。 {NAME}.reset : 重置当前会话的上下文。
超级用户命令(均需要加上命令前缀使用): 超级用户命令(均需要加上命令前缀使用):
changemodel <模型名> : 切换全局 AI 模型。 changemodel <模型名> : 切换全局 AI 模型。
contexts : 返回当前会话的上下文列表。 ※当上下文包含图片时,不要使用此命令。 contexts : 返回当前会话的上下文列表。 ※当上下文包含图片时,不要使用此命令。

View File

@@ -37,7 +37,6 @@ async def at_enable():
changemodel_cmd = on_command( changemodel_cmd = on_command(
"changemodel", permission=SUPERUSER, priority=10, block=True "changemodel", permission=SUPERUSER, priority=10, block=True
) )
resetmem_cmd = on_command("reset", priority=10, block=True)
# setprompt_cmd = on_command("prompt",permission=SUPERUSER) # setprompt_cmd = on_command("prompt",permission=SUPERUSER)
praises_cmd = on_command("praises", permission=SUPERUSER, priority=10, block=True) praises_cmd = on_command("praises", permission=SUPERUSER, priority=10, block=True)
add_usermsg_cmd = on_command("usermsg", 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, priority=10,
block=True, block=True,
) )
resetmem_cmd = on_alconna(
Alconna(
config.marshoai_default_name + ".reset",
),
priority=10,
block=True,
)
marsho_help_cmd = on_alconna( marsho_help_cmd = on_alconna(
Alconna( Alconna(
config.marshoai_default_name + ".help", config.marshoai_default_name + ".help",
@@ -340,13 +346,13 @@ async def marsho(
while choice.message.tool_calls != None: while choice.message.tool_calls != None:
# await UniMessage(str(response)).send() # await UniMessage(str(response)).send()
tool_calls = choice.message.tool_calls tool_calls = choice.message.tool_calls
try: # try:
if tool_calls[0]["function"]["name"].startswith("$"): # if tool_calls[0]["function"]["name"].startswith("$"):
choice.message.tool_calls[0][ # choice.message.tool_calls[0][
"type" # "type"
] = "builtin_function" # 兼容 moonshot AI 内置函数的临时方案 # ] = "builtin_function" # 兼容 moonshot AI 内置函数的临时方案
except: # except:
pass # pass
tool_msg.append(choice.message) tool_msg.append(choice.message)
for tool_call in tool_calls: for tool_call in tool_calls:
try: try:

View File

@@ -1,5 +1,4 @@
"""该功能目前~~正在开发中~~开发基本完成,暂时~~不~~可用,受影响的文件夹 `plugin`, `plugins` """该功能目前~~正在开发中~~开发基本完成,暂时~~不~~可用,受影响的文件夹 `plugin`, `plugins`"""
"""
from .func_call import * from .func_call import *
from .load import * from .load import *

2906
pdm.lock generated Normal file

File diff suppressed because it is too large Load Diff