diff options
Diffstat (limited to 'INSTALL.md')
| -rw-r--r-- | INSTALL.md | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/INSTALL.md b/INSTALL.md new file mode 100644 index 0000000..807f817 --- /dev/null +++ b/INSTALL.md @@ -0,0 +1,113 @@ +# MiMo Web Search — 安装说明(给 Agent 看) + +> **提示**:如果你已经安装过其他 MiMo 插件(如 mimo-asr、mimo-tts)并已配置过 `XIAOMI_API_KEY` 和 `XIAOMI_BASE_URL`,可以直接复用已有的环境变量配置,无需重复询问 API Key 和端点。 + +## 前置条件 + +- Hermes Agent 已安装并可运行 +- Xiaomi MiMo API Key(获取地址:https://platform.xiaomimimo.com) +- 在 MiMo 控制台开通**联网服务插件**(付费功能) +- `httpx` Python 包 + +## 安装 + +> **注意**:`setup.sh` 仅供参考,请勿直接运行。请阅读以下步骤,根据用户的环境自行完成安装。 +> 以下命令中的 `~/.hermes` 仅为 Unix 典型路径,**不要硬编码**。安装前请先确认 Hermes 的实际安装目录(如 `$HERMES_HOME`、`$env:HERMES_HOME` 等)。 + +### 安装依赖 + +```bash +pip install httpx +``` + +### 安装插件 + +将插件文件复制到 Hermes 的插件目录并启用: + +```bash +mkdir -p ~/.hermes/plugins/web/mimo +cp plugin.yaml __init__.py provider.py ~/.hermes/plugins/web/mimo/ +hermes plugins enable web/mimo +``` + +```powershell +# Windows (PowerShell) +mkdir -Force "$env:USERPROFILE\.hermes\plugins\web\mimo" +cp plugin.yaml,__init__.py,provider.py "$env:USERPROFILE\.hermes\plugins\web\mimo\" +hermes plugins enable web/mimo +``` + +### 配置 Hermes + +在 Hermes 的 `config.yaml` 中启用: + +```yaml +plugins: + enabled: + - web-mimo + +web: + search_backend: "mimo" +``` + +### 配置环境变量 + +在 Hermes 的 `.env` 文件中设置: + +```env +XIAOMI_API_KEY=your-api-key-here +# 可选:Token Plan 国内端点 +XIAOMI_BASE_URL=https://token-plan-cn.xiaomimimo.com/v1 +``` + +> 中国站用户:`https://token-plan-cn.xiaomimimo.com/v1` +> 国际站用户:`https://api.xiaomimimo.com/v1` + +重启 Hermes 后,`web_search` 工具将使用 MiMo 作为搜索后端。 + +### 可选:安装独立测试脚本 + +```bash +cp test_search.py ~/test_search.py +chmod +x ~/test_search.py +``` + +```powershell +# Windows (PowerShell) +cp test_search.py "$env:USERPROFILE\test_search.py" +``` + +## 独立使用(不依赖 Hermes) + +```bash +export XIAOMI_API_KEY="your-api-key-here" +export XIAOMI_BASE_URL="https://token-plan-cn.xiaomimimo.com/v1" + +python3 test_search.py "小米17解锁" +python3 test_search.py "YU7 GT 价格" --limit 10 +python3 test_search.py "今天天气" --raw +``` + +```powershell +# Windows (PowerShell) +$env:XIAOMI_API_KEY="your-api-key-here" +$env:XIAOMI_BASE_URL="https://token-plan-cn.xiaomimimo.com/v1" + +python test_search.py "小米17解锁" +python test_search.py "YU7 GT 价格" --limit 10 +``` + +## 卸载 + +```bash +hermes plugins disable web/mimo +rm -rf ~/.hermes/plugins/web/mimo +rm -f ~/test_search.py +``` + +```powershell +# Windows (PowerShell) +hermes plugins disable web/mimo +rm -Recurse -Force "$env:USERPROFILE\.hermes\plugins\web\mimo" +rm -Force "$env:USERPROFILE\test_search.py" +``` |
