docs: 简化 README 中的安装说明
将详细的安装和配置步骤移至官方文档,并在 README 中提供直接链接。这使得 README 更加简洁,并引导用户访问最新的、更全面的部署指南。
This commit is contained in:
20
README.md
20
README.md
@@ -124,22 +124,10 @@
|
||||
|
||||
</div>
|
||||
|
||||
```bash
|
||||
# 1. 克隆项目到本地
|
||||
git clone https://github.com/MoFox-Studio/MoFox_Bot.git
|
||||
cd MoFox_Bot
|
||||
|
||||
# 2. 安装依赖
|
||||
pip install -r requirements.txt
|
||||
|
||||
# 3. 配置机器人
|
||||
# 首先,复制配置文件模板
|
||||
cp config/bot_config.toml.example config/bot_config.toml
|
||||
# 然后,根据你的需求编辑 config/bot_config.toml 文件
|
||||
|
||||
# 4. 启动机器人
|
||||
python bot.py
|
||||
```
|
||||
> [!NOTE]
|
||||
> 详细的安装和配置步骤,请务必参考我们的官方文档:
|
||||
> * **Windows 用户部署指南**: [https://mofox-studio.github.io/MoFox-Bot-Docs/docs/deployment_guide.html](https://mofox-studio.github.io/MoFox-Bot-Docs/docs/deployment_guide.html)
|
||||
> * **`bot_config.toml` 究极详细教程**: [https://mofox-studio.github.io/MoFox-Bot-Docs/docs/guides/bot_config_guide.html](https://mofox-studio.github.io/MoFox-Bot-Docs/docs/guides/bot_config_guide.html)
|
||||
|
||||
<div align="center">
|
||||
|
||||
|
||||
16
src/plugins/built_in/set_typing_status/_manifest.json
Normal file
16
src/plugins/built_in/set_typing_status/_manifest.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "Set Typing Status",
|
||||
"description": "一个在LLM生成回复时设置私聊输入状态的插件。",
|
||||
"version": "1.0.0",
|
||||
"author": {
|
||||
"name": "Kilo Code"
|
||||
},
|
||||
"license": "MIT",
|
||||
"homepage_url": "",
|
||||
"repository_url": "",
|
||||
"keywords": ["typing", "status", "private chat"],
|
||||
"categories": ["utility"],
|
||||
"host_application": {
|
||||
"min_version": "1.0.0"
|
||||
}
|
||||
}
|
||||
64
src/plugins/built_in/set_typing_status/plugin.py
Normal file
64
src/plugins/built_in/set_typing_status/plugin.py
Normal file
@@ -0,0 +1,64 @@
|
||||
from typing import List, Tuple, Type
|
||||
import logging
|
||||
|
||||
from src.plugin_system import (
|
||||
BasePlugin,
|
||||
register_plugin,
|
||||
ComponentInfo,
|
||||
BaseEventHandler,
|
||||
EventType,
|
||||
)
|
||||
from src.plugin_system.base.base_event import HandlerResult
|
||||
from src.plugin_system.apis import send_api
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class SetTypingStatusHandler(BaseEventHandler):
|
||||
"""在LLM处理私聊消息后设置“正在输入”状态的事件处理器。"""
|
||||
|
||||
handler_name = "set_typing_status_handler"
|
||||
handler_description = "在LLM生成回复后,将用户的聊天状态设置为“正在输入”。"
|
||||
init_subscribe = [EventType.POST_LLM]
|
||||
|
||||
async def execute(self, params: dict) -> HandlerResult:
|
||||
message = params.get("message")
|
||||
if not message or not message.is_private_message:
|
||||
return HandlerResult(success=True, continue_process=True)
|
||||
|
||||
user_id = message.message_info.user_info.user_id
|
||||
if not user_id:
|
||||
return HandlerResult(success=False, continue_process=True, message="无法获取用户ID")
|
||||
|
||||
try:
|
||||
params = {"user_id": user_id,"event_type": 1}
|
||||
await send_api.adapter_command_to_stream(
|
||||
action="set_input_status",
|
||||
params=params,
|
||||
stream_id=message.stream_id,
|
||||
)
|
||||
logger.debug(f"成功为用户 {user_id} 设置“正在输入”状态。")
|
||||
return HandlerResult(success=True, continue_process=True)
|
||||
except Exception as e:
|
||||
logger.error(f"为用户 {user_id} 设置“正在输入”状态时出错: {e}")
|
||||
return HandlerResult(success=False, continue_process=True, message=str(e))
|
||||
|
||||
|
||||
@register_plugin
|
||||
class SetTypingStatusPlugin(BasePlugin):
|
||||
"""一个在LLM生成回复时设置私聊输入状态的插件。"""
|
||||
|
||||
plugin_name = "set_typing_status"
|
||||
enable_plugin = True
|
||||
dependencies = []
|
||||
python_dependencies = []
|
||||
config_file_name = ""
|
||||
|
||||
config_schema = {}
|
||||
|
||||
def get_plugin_components(self) -> List[Tuple[ComponentInfo, Type]]:
|
||||
"""注册插件的功能组件。"""
|
||||
return [(SetTypingStatusHandler.get_handler_info(), SetTypingStatusHandler)]
|
||||
|
||||
def register_plugin(self) -> bool:
|
||||
return True
|
||||
Reference in New Issue
Block a user