tianzijian commited on
Commit
79e58de
·
verified ·
1 Parent(s): 8141c4e

Delete INTRO.md

Browse files
Files changed (1) hide show
  1. INTRO.md +0 -213
INTRO.md DELETED
@@ -1,213 +0,0 @@
1
- # Hermes Agent v0.9.0 on Hugging Face Spaces
2
-
3
- 智能AI代理,支持16个消息平台,持久化记忆,和Web管理界面。
4
-
5
- ## 功能
6
-
7
- - 🤖 AI 对话与工具调用
8
- - 🌐 Web Dashboard 管理
9
- - 💾 数据持久化到 Hugging Face Dataset
10
- - 🔔 支持消息网关(Telegram/Discord/Slack等)
11
- - ⚡ 自动唤醒保持在线
12
-
13
- ## 技术栈
14
-
15
- - Hermes Agent v0.9.0
16
- - FastAPI Web Dashboard
17
- - Hugging Face Datasets 持久化
18
- - Docker Spaces
19
-
20
- ## 数据目录映射
21
-
22
- | Hermes 目录 | Dataset 路径 | 说明 |
23
- |------------|-------------|------|
24
- | `~/.hermes/config.yaml` | `/config/config.yaml` | 核心配置 |
25
- | `~/.hermes/.env` | `/config/.env` | 环境变量 |
26
- | `~/.hermes/auth.json` | `/config/auth.json` | OAuth认证 |
27
- | `~/.hermes/SOUL.md` | `/personality/SOUL.md` | 代理人格 |
28
- | `~/.hermes/memories/` | `/memories/` | 持久记忆 |
29
- | `~/.hermes/skills/` | `/skills/` | 自定义技能 |
30
- | `~/.hermes/sessions/` | `/sessions/` | 会话历史 |
31
- | `~/.hermes/state.db` | `/state/state.db` | SQLite数据库 |
32
- | `~/.hermes/logs/` | `/logs/` | 日志文件 |
33
- | `~/.hermes/cron/` | `/cron/` | 定时任务 |
34
-
35
- ## 环境变量
36
-
37
- ```bash
38
- # 必需
39
- HF_DATASET_REPO=your-username/hermes-data
40
-
41
- # 可选
42
- HERMES_HOME=/data/.hermes
43
- SYNC_INTERVAL=300 # 同步间隔(秒)
44
- HF_TOKEN=your-huggingface-token # 用于访问私有 dataset
45
- ```
46
-
47
- ## 快速开始
48
-
49
- ### 1. 创建 Hugging Face Dataset
50
-
51
- ```bash
52
- # 创建一个新的 dataset 用于存储数据
53
- huggingface-cli repo create hermes-data --type dataset
54
- ```
55
-
56
- ### 2. 设置环境变量
57
-
58
- 在 Hugging Face Spaces 的 Settings 中设置:
59
- - `HF_DATASET_REPO`: 你的 dataset 名称 (例如: username/hermes-data)
60
- - `HF_TOKEN`: Hugging Face access token
61
-
62
- ### 3. 配置唤醒服务
63
-
64
- 使用 UptimeRobot 或 Cron-job.org 定期访问 Space URL 以保持在线。
65
-
66
- ## 部署步骤
67
-
68
- ### 部署到 Hugging Face Spaces
69
-
70
- #### 方式一:通过 Web 界面部署
71
-
72
- 1. **创建 Space**: 访问 https://huggingface.co/new-space
73
- - 选择 "Docker" SDK
74
- - 设置 Space 名称
75
- - 选择硬件配置(免费版即可开始)
76
-
77
- 2. **克隆 Space 仓库**:
78
- ```bash
79
- git clone https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME
80
- cd YOUR_SPACE_NAME
81
- ```
82
-
83
- 3. **复制项目文件**:
84
- ```bash
85
- # 复制所有项目文件到 Space 目录
86
- cp -r /path/to/hermes-spaces/* .
87
- ```
88
-
89
- 4. **配置环境变量**:
90
- - 在 Space Settings → Variables 中设置:
91
- - `HF_DATASET_REPO`: `your-username/hermes-data`
92
- - `HF_TOKEN`: `your-huggingface-token`
93
-
94
- 5. **提交并推送**:
95
- ```bash
96
- git add .
97
- git commit -m "Initial deployment"
98
- git push
99
- ```
100
-
101
- 6. **等待部署完成**:
102
- - 访问 `https://huggingface.co/spaces/YOUR_USERNAME/YOUR_SPACE_NAME`
103
- - 查看 Build 日志,等待部署完成
104
-
105
- #### 方式二:通过 GitHub Actions 自动部署
106
-
107
- 1. **Fork 本仓库** 到你的 GitHub 账号
108
-
109
- 2. **在 Hugging Face 创建 Space**:
110
- - 访问 https://huggingface.co/new-space
111
- - 选择 Docker SDK
112
- - 记下 Space 名称
113
-
114
- 3. **配置 GitHub Secrets**:
115
- - 进入 GitHub 仓库 → Settings → Secrets and variables → Actions
116
- - 添加以下 secrets:
117
- - `HF_TOKEN`: 你的 Hugging Face access token
118
- - `HF_SPACE_REPO`: `YOUR_USERNAME/YOUR_SPACE_NAME`
119
-
120
- 4. **推送代码到 main 分支**:
121
- ```bash
122
- git push origin main
123
- ```
124
-
125
- 5. **GitHub Actions 会自动部署**:
126
- - 查看 Actions 标签页查看部署进度
127
- - 部署完成后访问 Space URL
128
-
129
- ## 配置唤醒服务
130
-
131
- 由于 Hugging Face Spaces 免费版会在 48 小时无活动后休眠,建议配置外部唤醒服务:
132
-
133
- ### 使用 UptimeRobot(推荐)
134
-
135
- 1. 访问 https://uptimerobot.com 并注册账号
136
- 2. 点击 "Add New Monitor"
137
- 3. 配置如下:
138
- - **Monitor Type**: HTTP(s)
139
- - **Friendly Name**: Hermes Agent
140
- - **URL**: `https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space/health`
141
- - **Monitoring Interval**: 5 minutes
142
- 4. 点击 "Create Monitor"
143
-
144
- ### 使用 Cron-job.org(备选)
145
-
146
- 1. 访问 https://cron-job.org
147
- 2. 创建新的 cron job
148
- 3. 配置 URL: `https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space/health`
149
- 4. 设置每 5 分钟执行一次
150
-
151
- ## 首次使用
152
-
153
- 1. 访问 Space URL: `https://YOUR_USERNAME-YOUR_SPACE_NAME.hf.space`
154
- 2. 首次启动会创建默认配置,从 Dataset 恢复数据(如果存在)
155
- 3. 在 Web Dashboard 中配置:
156
- - API Keys(OpenAI, OpenRouter, etc.)
157
- - 消息网关(Telegram, Discord, etc.)
158
- - 代理人格(SOUL.md)
159
-
160
- ## 故障排除
161
-
162
- ### Space 无法启动
163
-
164
- 1. **检查构建日志**:
165
- - 访问 Space 页面 → Files → "Build logs"
166
- - 查看错误信息
167
-
168
- 2. **常见问题**:
169
- - **内存不足**: 升级到付费硬件(CPU Upgrade)
170
- - **依赖安装失败**: 检查 requirements.txt 格式
171
- - **权限错误**: 确保 Dockerfile 中设置了 USER appuser
172
-
173
- ### 数据未持久化
174
-
175
- 1. **检查环境变量**:
176
- - 确认 `HF_DATASET_REPO` 已正确设置
177
- - 确认 `HF_TOKEN` 有写入 Dataset 的权限
178
-
179
- 2. **检查 Dataset 权限**:
180
- - 确保 Dataset 是私有的(推荐)
181
- - 确保 Token 有 `write` 权限
182
-
183
- 3. **查看同步日志**:
184
- - 在 Space 的 Logs 中查看 data-sync 相关日志
185
-
186
- ### 消息网关断开
187
-
188
- 1. **这是正常现象**: Spaces 休眠后所有连接会断开
189
- 2. **解决方案**:
190
- - 升级到付费版保持持续运行
191
- - 或配置网关自动重连(在 Hermes 配置中设置)
192
-
193
- ## 文件说明
194
-
195
- - `Dockerfile` - Docker 镜像定义
196
- - `entrypoint.sh` - 容器启动脚本
197
- - `requirements.txt` - Python 依赖
198
- - `src/data_sync.py` - 数据同步服务
199
- - `.github/workflows/deploy.yml` - GitHub Actions 自动部署
200
-
201
- ## 许可证
202
-
203
- MIT License - 详见 LICENSE 文件
204
-
205
- ## 贡献
206
-
207
- 欢迎提交 Issue 和 Pull Request!
208
-
209
- ## 相关链接
210
-
211
- - [Hermes Agent 官方仓库](https://github.com/NousResearch/hermes-agent)
212
- - [Hugging Face Spaces 文档](https://huggingface.co/docs/hub/spaces-overview)
213
- - [Hermes Agent 文档](https://hermes-agent.com)