summaryrefslogtreecommitdiff
path: root/INSTALL.md
blob: d003f485b4d1abff2c60601778c29055a4b5ca2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# MiMo Web Search — 安装说明(给 Agent 看)

> **提示**:如果用户已经在使用 MiMo 作为 LLM provider(如 Token Plan)或已安装其他 MiMo 插件(如 mimo-asr、mimo-tts),`XIAOMI_API_KEY` 和 `XIAOMI_BASE_URL` 很可能已配置。请先检查现有的 `.env` 配置,直接复用,无需重复询问 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"
```