Merge branch 'dev' of https://github.com/MaiM-with-u/MaiBot into dev
This commit is contained in:
@@ -10,8 +10,6 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./docker-config/adapters/config.toml:/adapters/config.toml
|
- ./docker-config/adapters/config.toml:/adapters/config.toml
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
|
||||||
- mongodb
|
|
||||||
networks:
|
networks:
|
||||||
- maim_bot
|
- maim_bot
|
||||||
core:
|
core:
|
||||||
@@ -32,23 +30,6 @@ services:
|
|||||||
- ./docker-config/mmc:/MaiMBot/config # 持久化bot配置文件
|
- ./docker-config/mmc:/MaiMBot/config # 持久化bot配置文件
|
||||||
- ./data/MaiMBot:/MaiMBot/data # NapCat 和 NoneBot 共享此卷,否则发送图片会有问题
|
- ./data/MaiMBot:/MaiMBot/data # NapCat 和 NoneBot 共享此卷,否则发送图片会有问题
|
||||||
restart: always
|
restart: always
|
||||||
depends_on:
|
|
||||||
- mongodb
|
|
||||||
networks:
|
|
||||||
- maim_bot
|
|
||||||
mongodb:
|
|
||||||
container_name: maim-bot-mongo
|
|
||||||
environment:
|
|
||||||
- TZ=Asia/Shanghai
|
|
||||||
# - MONGO_INITDB_ROOT_USERNAME=your_username # 此处配置mongo用户
|
|
||||||
# - MONGO_INITDB_ROOT_PASSWORD=your_password # 此处配置mongo密码
|
|
||||||
# ports:
|
|
||||||
# - "27017:27017"
|
|
||||||
restart: always
|
|
||||||
volumes:
|
|
||||||
- mongodb:/data/db # 持久化mongodb数据
|
|
||||||
- mongodbCONFIG:/data/configdb # 持久化mongodb配置文件
|
|
||||||
image: mongo:latest
|
|
||||||
networks:
|
networks:
|
||||||
- maim_bot
|
- maim_bot
|
||||||
napcat:
|
napcat:
|
||||||
@@ -70,6 +51,3 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
maim_bot:
|
maim_bot:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
volumes:
|
|
||||||
mongodb:
|
|
||||||
mongodbCONFIG:
|
|
||||||
BIN
requirements.txt
BIN
requirements.txt
Binary file not shown.
@@ -14,6 +14,12 @@ import toml # 导入 toml 库
|
|||||||
from src.common.database.database_model import ActionRecords
|
from src.common.database.database_model import ActionRecords
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
# 以下为类型注解需要
|
||||||
|
from src.chat.message_receive.chat_stream import ChatStream
|
||||||
|
from src.chat.focus_chat.expressors.default_expressor import DefaultExpressor
|
||||||
|
from src.chat.focus_chat.replyer.default_replyer import DefaultReplyer
|
||||||
|
from src.chat.focus_chat.info.obs_info import ObsInfo
|
||||||
|
|
||||||
logger = get_logger("plugin_action")
|
logger = get_logger("plugin_action")
|
||||||
|
|
||||||
|
|
||||||
@@ -125,8 +131,8 @@ class PluginAction(BaseAction):
|
|||||||
bool: 是否发送成功
|
bool: 是否发送成功
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
expressor = self._services.get("expressor")
|
expressor: DefaultExpressor = self._services.get("expressor")
|
||||||
chat_stream = self._services.get("chat_stream")
|
chat_stream: ChatStream = self._services.get("chat_stream")
|
||||||
|
|
||||||
if not expressor or not chat_stream:
|
if not expressor or not chat_stream:
|
||||||
logger.error(f"{self.log_prefix} 无法发送消息:缺少必要的内部服务")
|
logger.error(f"{self.log_prefix} 无法发送消息:缺少必要的内部服务")
|
||||||
@@ -183,8 +189,8 @@ class PluginAction(BaseAction):
|
|||||||
Returns:
|
Returns:
|
||||||
bool: 是否发送成功
|
bool: 是否发送成功
|
||||||
"""
|
"""
|
||||||
expressor = self._services.get("expressor")
|
expressor: DefaultExpressor = self._services.get("expressor")
|
||||||
chat_stream = self._services.get("chat_stream")
|
chat_stream: ChatStream = self._services.get("chat_stream")
|
||||||
|
|
||||||
if not expressor or not chat_stream:
|
if not expressor or not chat_stream:
|
||||||
logger.error(f"{self.log_prefix} 无法发送消息:缺少必要的内部服务")
|
logger.error(f"{self.log_prefix} 无法发送消息:缺少必要的内部服务")
|
||||||
@@ -239,8 +245,8 @@ class PluginAction(BaseAction):
|
|||||||
Returns:
|
Returns:
|
||||||
bool: 是否发送成功
|
bool: 是否发送成功
|
||||||
"""
|
"""
|
||||||
replyer = self._services.get("replyer")
|
replyer: DefaultReplyer = self._services.get("replyer")
|
||||||
chat_stream = self._services.get("chat_stream")
|
chat_stream: ChatStream = self._services.get("chat_stream")
|
||||||
|
|
||||||
if not replyer or not chat_stream:
|
if not replyer or not chat_stream:
|
||||||
logger.error(f"{self.log_prefix} 无法发送消息:缺少必要的内部服务")
|
logger.error(f"{self.log_prefix} 无法发送消息:缺少必要的内部服务")
|
||||||
@@ -291,7 +297,7 @@ class PluginAction(BaseAction):
|
|||||||
Returns:
|
Returns:
|
||||||
str: 聊天类型 ("group" 或 "private")
|
str: 聊天类型 ("group" 或 "private")
|
||||||
"""
|
"""
|
||||||
chat_stream = self._services.get("chat_stream")
|
chat_stream: ChatStream = self._services.get("chat_stream")
|
||||||
if chat_stream and hasattr(chat_stream, "group_info"):
|
if chat_stream and hasattr(chat_stream, "group_info"):
|
||||||
return "group" if chat_stream.group_info else "private"
|
return "group" if chat_stream.group_info else "private"
|
||||||
return "unknown"
|
return "unknown"
|
||||||
@@ -311,6 +317,7 @@ class PluginAction(BaseAction):
|
|||||||
if observations and len(observations) > 0:
|
if observations and len(observations) > 0:
|
||||||
obs = observations[0]
|
obs = observations[0]
|
||||||
if hasattr(obs, "get_talking_message"):
|
if hasattr(obs, "get_talking_message"):
|
||||||
|
obs: ObsInfo
|
||||||
raw_messages = obs.get_talking_message()
|
raw_messages = obs.get_talking_message()
|
||||||
# 转换为简化格式
|
# 转换为简化格式
|
||||||
for msg in raw_messages[-count:]:
|
for msg in raw_messages[-count:]:
|
||||||
@@ -402,7 +409,7 @@ class PluginAction(BaseAction):
|
|||||||
action_prompt_display: 动作显示内容
|
action_prompt_display: 动作显示内容
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
chat_stream = self._services.get("chat_stream")
|
chat_stream: ChatStream = self._services.get("chat_stream")
|
||||||
if not chat_stream:
|
if not chat_stream:
|
||||||
logger.error(f"{self.log_prefix} 无法存储action信息:缺少chat_stream服务")
|
logger.error(f"{self.log_prefix} 无法存储action信息:缺少chat_stream服务")
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user