mirror of https://github.com/Mai-with-u/MaiBot.git
commit
ba5837503e
|
|
@ -7,7 +7,7 @@ RUN mv env.example config/.env \
|
||||||
&& mv src/plugins/chat/bot_config_toml config/bot_config.toml
|
&& mv src/plugins/chat/bot_config_toml config/bot_config.toml
|
||||||
RUN ln -s /MaiMBot/config/.env /MaiMBot/.env \
|
RUN ln -s /MaiMBot/config/.env /MaiMBot/.env \
|
||||||
&& ln -s /MaiMBot/config/bot_config.toml /MaiMBot/src/plugins/chat/bot_config.toml
|
&& ln -s /MaiMBot/config/bot_config.toml /MaiMBot/src/plugins/chat/bot_config.toml
|
||||||
RUN pip install -r requirements.txt
|
RUN pip install --upgrade -r requirements.txt
|
||||||
VOLUME [ "/MaiMBot/config" ]
|
VOLUME [ "/MaiMBot/config" ]
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
ENTRYPOINT [ "nb","run" ]
|
ENTRYPOINT [ "nb","run" ]
|
||||||
33
README.md
33
README.md
|
|
@ -52,11 +52,9 @@ NAPCAT_UID=$(id -u) NAPCAT_GID=$(id -g) docker compose restart
|
||||||
|
|
||||||
#### 手动运行
|
#### 手动运行
|
||||||
1. **创建Python环境**
|
1. **创建Python环境**
|
||||||
推荐使用conda或其他环境管理来管理你的python环境
|
推荐使用conda或其他虚拟环境进行依赖安装,防止出现依赖版本冲突问题
|
||||||
```bash
|
```bash
|
||||||
# 安装requirements(还没检查好,可能有包漏了)
|
# 安装requirements
|
||||||
conda activate 你的环境
|
|
||||||
cd 对应路径
|
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
2. **MongoDB设置**
|
2. **MongoDB设置**
|
||||||
|
|
@ -68,8 +66,8 @@ NAPCAT_UID=$(id -u) NAPCAT_GID=$(id -g) docker compose restart
|
||||||
- 在Napcat的网络设置中添加ws反向代理:ws://localhost:8080/onebot/v11/ws
|
- 在Napcat的网络设置中添加ws反向代理:ws://localhost:8080/onebot/v11/ws
|
||||||
|
|
||||||
4. **配置文件设置**
|
4. **配置文件设置**
|
||||||
- 把env.example改成.env,并填上你的apikey(硅基流动或deepseekapi)
|
- 将.env文件打开,填上你的apikey(硅基流动或deepseekapi)
|
||||||
- 把bot_config_toml改名为bot_config.toml,并填写相关内容,不然无法正常运行
|
- 将bot_config.toml文件打开,并填写相关内容,不然无法正常运行
|
||||||
|
|
||||||
#### .env 文件配置说明
|
#### .env 文件配置说明
|
||||||
```ini
|
```ini
|
||||||
|
|
@ -92,14 +90,10 @@ NAPCAT_UID=$(id -u) NAPCAT_GID=$(id -g) docker compose restart
|
||||||
MONGODB_PASSWORD="" # MongoDB密码(可选)
|
MONGODB_PASSWORD="" # MongoDB密码(可选)
|
||||||
MONGODB_AUTH_SOURCE="" # MongoDB认证源(可选)
|
MONGODB_AUTH_SOURCE="" # MongoDB认证源(可选)
|
||||||
|
|
||||||
# API密钥配置
|
#api配置项,建议siliconflow必填,识图需要这个
|
||||||
CHAT_ANY_WHERE_KEY= # ChatAnyWhere API密钥
|
SILICONFLOW_KEY=
|
||||||
SILICONFLOW_KEY= # 硅基流动 API密钥(必填)
|
|
||||||
DEEP_SEEK_KEY= # DeepSeek API密钥(必填)
|
|
||||||
|
|
||||||
# API地址配置
|
|
||||||
CHAT_ANY_WHERE_BASE_URL=https://api.chatanywhere.tech/v1
|
|
||||||
SILICONFLOW_BASE_URL=https://api.siliconflow.cn/v1/
|
SILICONFLOW_BASE_URL=https://api.siliconflow.cn/v1/
|
||||||
|
DEEP_SEEK_KEY=
|
||||||
DEEP_SEEK_BASE_URL=https://api.deepseek.com/v1
|
DEEP_SEEK_BASE_URL=https://api.deepseek.com/v1
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -158,9 +152,8 @@ NAPCAT_UID=$(id -u) NAPCAT_GID=$(id -g) docker compose restart
|
||||||
```
|
```
|
||||||
|
|
||||||
5. **运行麦麦**
|
5. **运行麦麦**
|
||||||
|
在含有bot.py程序的目录下运行(如果使用了虚拟环境需要先进入虚拟环境)
|
||||||
```bash
|
```bash
|
||||||
conda activate 你的环境
|
|
||||||
cd 对应路径
|
|
||||||
nb run
|
nb run
|
||||||
```
|
```
|
||||||
6. **运行其他组件**
|
6. **运行其他组件**
|
||||||
|
|
@ -205,3 +198,13 @@ NAPCAT_UID=$(id -u) NAPCAT_GID=$(id -g) docker compose restart
|
||||||
纯编程外行,面向cursor编程,很多代码史一样多多包涵
|
纯编程外行,面向cursor编程,很多代码史一样多多包涵
|
||||||
|
|
||||||
> ⚠️ **警告**:本应用生成内容来自人工智能模型,由 AI 生成,请仔细甄别,请勿用于违反法律的用途,AI生成内容不代表本人观点和立场。
|
> ⚠️ **警告**:本应用生成内容来自人工智能模型,由 AI 生成,请仔细甄别,请勿用于违反法律的用途,AI生成内容不代表本人观点和立场。
|
||||||
|
|
||||||
|
## 致谢
|
||||||
|
[nonebot2](https://github.com/nonebot/nonebot2): 跨平台 Python 异步聊天机器人框架
|
||||||
|
[NapCat](https://github.com/NapNeko/NapCatQQ): 现代化的基于 NTQQ 的 Bot 协议端实现
|
||||||
|
|
||||||
|
### 贡献者
|
||||||
|
|
||||||
|
感谢各位大佬!
|
||||||
|
|
||||||
|
[](https://github.com/SengokuCola/MaiMBot/graphs/contributors)
|
||||||
|
|
|
||||||
|
|
@ -7,8 +7,8 @@ password = "" # 默认空值
|
||||||
auth_source = "" # 默认空值
|
auth_source = "" # 默认空值
|
||||||
|
|
||||||
[bot]
|
[bot]
|
||||||
qq = #填入你的机器人QQ
|
qq = 123456 #填入你的机器人QQ
|
||||||
nickname = "麦麦"
|
nickname = "麦麦" #你希望bot被称呼的名字
|
||||||
|
|
||||||
[message]
|
[message]
|
||||||
min_text_length = 2 # 与麦麦聊天时麦麦只会回答文本大于等于此数的消息
|
min_text_length = 2 # 与麦麦聊天时麦麦只会回答文本大于等于此数的消息
|
||||||
|
|
@ -24,7 +24,7 @@ enable_pic_translate = false
|
||||||
|
|
||||||
|
|
||||||
[response]
|
[response]
|
||||||
api_using = "siliconflow" # 选择大模型API
|
api_using = "siliconflow" # 选择大模型API,可选值为siliconflow,deepseek,建议使用siliconflow,因为识图api目前只支持siliconflow的deepseek-vl2模型
|
||||||
model_r1_probability = 0.8 # 麦麦回答时选择R1模型的概率
|
model_r1_probability = 0.8 # 麦麦回答时选择R1模型的概率
|
||||||
model_v3_probability = 0.1 # 麦麦回答时选择V3模型的概率
|
model_v3_probability = 0.1 # 麦麦回答时选择V3模型的概率
|
||||||
model_r1_distill_probability = 0.1 # 麦麦回答时选择R1蒸馏模型的概率
|
model_r1_distill_probability = 0.1 # 麦麦回答时选择R1蒸馏模型的概率
|
||||||
|
|
@ -36,13 +36,13 @@ enable_advance_output = true # 开启后输出更多日志,false关闭true开启
|
||||||
[groups]
|
[groups]
|
||||||
|
|
||||||
talk_allowed = [
|
talk_allowed = [
|
||||||
#可以回复消息的群
|
123456,12345678
|
||||||
]
|
] #可以回复消息的群
|
||||||
|
|
||||||
talk_frequency_down = [
|
talk_frequency_down = [
|
||||||
#降低回复频率的群
|
123456,12345678
|
||||||
]
|
] #降低回复频率的群
|
||||||
|
|
||||||
ban_user_id = [
|
ban_user_id = [
|
||||||
#禁止回复消息的QQ号
|
123456,12345678
|
||||||
]
|
] #禁止回复消息的QQ号
|
||||||
|
|
@ -32,7 +32,7 @@ services:
|
||||||
environment:
|
environment:
|
||||||
- tz=Asia/Shanghai
|
- tz=Asia/Shanghai
|
||||||
expose:
|
expose:
|
||||||
- "8080:8080"
|
- "8080"
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
depends_on:
|
||||||
- mongodb
|
- mongodb
|
||||||
|
|
|
||||||
|
|
@ -15,10 +15,8 @@ MONGODB_USERNAME = "" # 默认空值
|
||||||
MONGODB_PASSWORD = "" # 默认空值
|
MONGODB_PASSWORD = "" # 默认空值
|
||||||
MONGODB_AUTH_SOURCE = "" # 默认空值
|
MONGODB_AUTH_SOURCE = "" # 默认空值
|
||||||
|
|
||||||
#key and url
|
#api配置项
|
||||||
CHAT_ANY_WHERE_KEY=
|
|
||||||
SILICONFLOW_KEY=
|
SILICONFLOW_KEY=
|
||||||
CHAT_ANY_WHERE_BASE_URL=https://api.chatanywhere.tech/v1
|
|
||||||
SILICONFLOW_BASE_URL=https://api.siliconflow.cn/v1/
|
SILICONFLOW_BASE_URL=https://api.siliconflow.cn/v1/
|
||||||
DEEP_SEEK_KEY=
|
DEEP_SEEK_KEY=
|
||||||
DEEP_SEEK_BASE_URL=https://api.deepseek.com/v1
|
DEEP_SEEK_BASE_URL=https://api.deepseek.com/v1
|
||||||
|
|
|
||||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
|
|
@ -108,7 +108,7 @@ class BotConfig:
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
global_config = BotConfig.load_config("./src/plugins/chat/bot_config.toml")
|
global_config = BotConfig.load_config(".bot_config.toml")
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
current_dir = os.path.dirname(os.path.abspath(__file__))
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,10 @@ Database.initialize(
|
||||||
|
|
||||||
class ScheduleGenerator:
|
class ScheduleGenerator:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.llm_scheduler = LLMModel(model_name="Pro/deepseek-ai/DeepSeek-V3")
|
if global_config.API_USING == "siliconflow":
|
||||||
|
self.llm_scheduler = LLMModel(model_name="Pro/deepseek-ai/DeepSeek-V3")
|
||||||
|
elif global_config.API_USING == "deepseek":
|
||||||
|
self.llm_scheduler = LLMModel(model_name="deepseek-chat",api_using="deepseek")
|
||||||
self.db = Database.get_instance()
|
self.db = Database.get_instance()
|
||||||
|
|
||||||
today = datetime.datetime.now()
|
today = datetime.datetime.now()
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,19 @@ load_dotenv()
|
||||||
|
|
||||||
class LLMModel:
|
class LLMModel:
|
||||||
# def __init__(self, model_name="deepseek-ai/DeepSeek-R1-Distill-Qwen-32B", **kwargs):
|
# def __init__(self, model_name="deepseek-ai/DeepSeek-R1-Distill-Qwen-32B", **kwargs):
|
||||||
def __init__(self, model_name="Pro/deepseek-ai/DeepSeek-R1", **kwargs):
|
def __init__(self, model_name="Pro/deepseek-ai/DeepSeek-R1",api_using=None, **kwargs):
|
||||||
self.model_name = model_name
|
if api_using == "deepseek":
|
||||||
|
self.api_key = os.getenv("DEEPSEEK_API_KEY")
|
||||||
|
self.base_url = os.getenv("DEEPSEEK_BASE_URL")
|
||||||
|
if model_name != "Pro/deepseek-ai/DeepSeek-R1":
|
||||||
|
self.model_name = model_name
|
||||||
|
else:
|
||||||
|
self.model_name = "deepseek-reasoner"
|
||||||
|
else:
|
||||||
|
self.api_key = os.getenv("SILICONFLOW_KEY")
|
||||||
|
self.base_url = os.getenv("SILICONFLOW_BASE_URL")
|
||||||
|
self.model_name = model_name
|
||||||
self.params = kwargs
|
self.params = kwargs
|
||||||
self.api_key = os.getenv("SILICONFLOW_KEY")
|
|
||||||
self.base_url = os.getenv("SILICONFLOW_BASE_URL")
|
|
||||||
|
|
||||||
def generate_response(self, prompt: str) -> Tuple[str, str]:
|
def generate_response(self, prompt: str) -> Tuple[str, str]:
|
||||||
"""根据输入的提示生成模型的响应"""
|
"""根据输入的提示生成模型的响应"""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue