Files
mini-openclaw/INSTALL_AND_RUN.md
NathanAlex7 42ce992a0f chore: mini-openclaw 初始版本
Next.js 前端 + FastAPI/LangChain 后端透明 agent平台
- 含 .gitignore, 敏感文件(sessions数据/.env/venv等)已排除
- 待后续添加 trajectory 自进化机制
2026-09-01 16:40:10 +08:00

124 lines
2.5 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# mini-OpenClaw 安装和运行指南
## 当前状态
- ✅ 后端 `.env` 已配置(使用公司 DeepSeek 网关)
- ⏳ 后端依赖未安装(需要创建 venv 并安装)
- ⏳ 前端依赖未安装(需要 npm install)
## 快速安装(推荐)
### 方式一:使用已有脚本
在项目根目录打开命令行,执行:
```cmd
install-simple.bat
```
或者分别执行后端和前端:
**后端安装:**
```cmd
cd backend
python -m venv venv
call venv\Scripts\activate.bat
pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
cd ..
```
**前端安装:**
```cmd
npm install --registry=https://registry.npmmirror.com
```
### 方式二:执行新创建的脚本
```cmd
do_setup.bat
```
然后安装前端:
```cmd
npm install --registry=https://registry.npmmirror.com
```
## 启动服务
### 启动后端
```cmd
cd backend
call venv\Scripts\activate.bat
uvicorn app:app --host 0.0.0.0 --port 8002
```
或使用启动脚本:
```cmd
start-backend.bat
```
后端地址:http://localhost:8002
API 文档:http://localhost:8002/docs
### 启动前端
```cmd
npm run dev
```
或使用启动脚本:
```cmd
start-frontend.bat
```
前端地址:http://localhost:3000(或 3001)
## 验证安装
后端验证:
```cmd
cd backend
call venv\Scripts\activate.bat
python -c "import fastapi; import langchain; import llama_index; print('✓ OK')"
```
## 配置说明
### 后端配置文件:`backend/.env`
```env
OPENAI_API_KEY=oyW5CmX5j8eY62aRMSGd8FHWZTYAumI1Hxds3hdcgvJAtMv0
OPENAI_BASE_URL=http://49.232.133.151/v1
MODEL_NAME=deepseek-v4-flash
EMBEDDING_MODEL=text-embedding-3-small
PORT=8002
```
### 前端配置
前端 API 配置在 `src/lib/api.ts`,默认指向 `http://localhost:8002/api`
## 下一步
安装完成后:
1. 启动后端(端口 8002)
2. 启动前端(端口 3000/3001)
3. 打开浏览器访问前端地址
4. 测试聊天功能
5. 测试 skills(如 weather、fetch_url)
## 故障排除
### Python 版本
需要 Python 3.8+,本机有:
- `C:\Users\666\AppData\Local\hermes\hermes-agent\venv\Scripts\python.exe`
- `F:\Program Files\anaconda\python.exe`
### 网络问题
- 使用清华镜像:`-i https://pypi.tuna.tsinghua.edu.cn/simple`
- 使用淘宝镜像:`--registry=https://registry.npmmirror.com`
### 端口占用
如果 8002 或 3000 被占用,可以修改:
- 后端:修改 `backend/.env` 中的 `PORT`
- 前端:修改 `package.json` 中的 dev 脚本