添加部署文档和说明
This commit is contained in:
+302
@@ -0,0 +1,302 @@
|
||||
# Param Auto Manager 部署文档
|
||||
|
||||
## 📦 系统概览
|
||||
|
||||
**参数数据自动化管理系统** - 自动管理参数数据网站的系统,支持从内容库和互联网搜索数据,自动处理产品并提交到后台管理待审核区。
|
||||
|
||||
---
|
||||
|
||||
## 🚀 快速部署
|
||||
|
||||
### 1. 系统要求
|
||||
- Python 3.10+
|
||||
- Flask
|
||||
- SQLite3
|
||||
- Git
|
||||
|
||||
### 2. 安装依赖
|
||||
|
||||
```bash
|
||||
cd works/param-auto-manager
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### 3. 启动服务
|
||||
|
||||
```bash
|
||||
# 方式1: 使用启动脚本
|
||||
./start.sh
|
||||
|
||||
# 方式2: 直接运行
|
||||
export PYTHONPATH="$HOME/.local/lib/python3.12/site-packages:$PYTHONPATH"
|
||||
python3 app.py
|
||||
```
|
||||
|
||||
### 4. 访问系统
|
||||
|
||||
- **前端界面**: http://localhost:16043 或 http://192.168.0.101:16043
|
||||
- **API接口**: http://localhost:16043/api
|
||||
|
||||
---
|
||||
|
||||
## 🌐 前端界面功能
|
||||
|
||||
### 主要功能模块
|
||||
|
||||
1. **统计面板**
|
||||
- 内容库文章数量
|
||||
- 待处理产品数量
|
||||
- 处理中产品数量
|
||||
- 最近成功/失败数量
|
||||
|
||||
2. **待处理产品列表**
|
||||
- 查看所有待处理产品
|
||||
- 添加单个/批量产品
|
||||
- 手动触发处理
|
||||
- 移除产品
|
||||
- 批量处理按钮
|
||||
|
||||
3. **内容库文章**
|
||||
- 查看所有文章
|
||||
- 搜索文章(关键词)
|
||||
- 添加新文章
|
||||
- 查看文章详情
|
||||
- 删除文章
|
||||
|
||||
4. **处理历史**
|
||||
- 查看处理历史记录
|
||||
- 状态显示(已提交/失败/错误)
|
||||
- 查看处理详情
|
||||
|
||||
5. **系统配置**
|
||||
- 自动处理开关
|
||||
- 处理间隔设置
|
||||
- 批量处理数量
|
||||
|
||||
---
|
||||
|
||||
## 🔌 API接口
|
||||
|
||||
### 文章内容库 API
|
||||
```bash
|
||||
# 获取文章列表
|
||||
GET /api/articles
|
||||
|
||||
# 搜索文章
|
||||
GET /api/articles/search?q=关键词
|
||||
|
||||
# 创建文章
|
||||
POST /api/articles
|
||||
{
|
||||
"product_names": ["产品1", "产品2"],
|
||||
"category": "分类",
|
||||
"keywords": ["关键词"],
|
||||
"summary": "摘要",
|
||||
"content": "内容",
|
||||
"source": "来源"
|
||||
}
|
||||
|
||||
# 删除文章
|
||||
DELETE /api/articles/{id}
|
||||
```
|
||||
|
||||
### 产品处理 API
|
||||
```bash
|
||||
# 待处理产品列表
|
||||
GET /api/products/pending
|
||||
|
||||
# 添加产品
|
||||
POST /api/products/pending
|
||||
{
|
||||
"product_name": "产品名称",
|
||||
"category": "分类",
|
||||
"priority": 10
|
||||
}
|
||||
|
||||
# 处理单个产品
|
||||
POST /api/products/process
|
||||
{
|
||||
"product_name": "产品名称"
|
||||
}
|
||||
|
||||
# 批量处理
|
||||
POST /api/products/process/batch
|
||||
{
|
||||
"limit": 5
|
||||
}
|
||||
|
||||
# 处理历史
|
||||
GET /api/products/history
|
||||
```
|
||||
|
||||
### 系统管理 API
|
||||
```bash
|
||||
# 系统统计
|
||||
GET /api/system/stats
|
||||
|
||||
# 系统配置
|
||||
GET /api/system/config
|
||||
PUT /api/system/config
|
||||
|
||||
# 健康检查
|
||||
GET /api/system/health
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ⚙️ Git仓库推送
|
||||
|
||||
### ⚠️ 注意事项
|
||||
|
||||
当前Git服务器不允许用户直接推送创建仓库(Push to create),需要管理员预先创建仓库。
|
||||
|
||||
### 推送步骤
|
||||
|
||||
**方式1: 管理员预先创建仓库**
|
||||
|
||||
1. 在Git服务器创建仓库:
|
||||
- 地址: `http://121.40.164.32:12007/hz4th_coder/param-auto-manager.git`
|
||||
- 账号: `hz4th_coder`
|
||||
|
||||
2. 推送代码:
|
||||
```bash
|
||||
cd works/param-auto-manager
|
||||
git remote add origin http://hz4th_coder:262e7dbfce09c8cc21fbacff2b450cc3f1c3e265@121.40.164.32:12007/hz4th_coder/param-auto-manager.git
|
||||
git push -u origin master
|
||||
git push origin v1.1.0
|
||||
```
|
||||
|
||||
**方式2: 请求管理员推送权限**
|
||||
|
||||
联系Git服务器管理员,开通用户的"Push to create"权限。
|
||||
|
||||
---
|
||||
|
||||
## 📊 使用示例
|
||||
|
||||
### 1. 通过前端界面操作
|
||||
|
||||
1. **添加待处理产品**
|
||||
- 点击"添加产品"按钮
|
||||
- 输入产品名称(如: GPT-4o)
|
||||
- 设置分类和优先级
|
||||
- 点击"添加"
|
||||
|
||||
2. **添加文章到内容库**
|
||||
- 点击"添加文章"按钮
|
||||
- 填写产品名称、摘要、内容等
|
||||
- 点击"添加"
|
||||
|
||||
3. **手动触发处理**
|
||||
- 在待处理产品列表找到产品
|
||||
- 点击"处理"按钮
|
||||
- 查看处理结果
|
||||
|
||||
### 2. 通过API操作
|
||||
|
||||
```bash
|
||||
# 添加产品
|
||||
curl -X POST http://localhost:16043/api/products/pending \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"product_name":"GPT-4o","category":"AI模型","priority":10}'
|
||||
|
||||
# 添加文章
|
||||
curl -X POST http://localhost:16043/api/articles \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"product_names": ["GPT-4o"],
|
||||
"category": "AI模型",
|
||||
"keywords": ["大模型","多模态"],
|
||||
"summary": "OpenAI多模态大模型",
|
||||
"content": "详细内容...",
|
||||
"source": "官方网站"
|
||||
}'
|
||||
|
||||
# 触发处理
|
||||
curl -X POST http://localhost:16043/api/products/process \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"product_name":"GPT-4o"}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔧 系统配置
|
||||
|
||||
配置文件: `config.py`
|
||||
|
||||
```python
|
||||
PORT = 16043 # 服务端口
|
||||
PARAMHUB_BASE_URL = 'http://localhost:16041' # ParamHub API地址
|
||||
PROCESS_INTERVAL = 300 # 自动处理间隔(秒)
|
||||
BATCH_SIZE = 5 # 批量处理数量
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📁 项目结构
|
||||
|
||||
```
|
||||
param-auto-manager/
|
||||
├── app.py # 主应用
|
||||
├── config.py # 配置文件
|
||||
├── models/
|
||||
│ └── database.py # 数据库模型
|
||||
├── routes/
|
||||
│ ├── articles.py # 文章API
|
||||
│ ├── products.py # 产品API
|
||||
│ └── system.py # 系统API
|
||||
├── services/
|
||||
│ ├── search_service.py # 搜索服务
|
||||
│ ├── process_service.py # 处理服务
|
||||
│ └── paramhub_client.py # ParamHub客户端
|
||||
├── templates/
|
||||
│ └── index.html # 前端页面
|
||||
├── static/
|
||||
│ ├── css/style.css # 样式文件
|
||||
│ └── js/app.js # JavaScript文件
|
||||
├── utils/
|
||||
│ └── scheduler.py # 定时任务
|
||||
├── data/ # 数据库文件
|
||||
└── logs/ # 日志文件
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## ✅ 当前部署状态
|
||||
|
||||
- **端口**: 16043 ✅
|
||||
- **状态**: 运行中
|
||||
- **PID**: 2710498
|
||||
- **前端**: http://192.168.0.101:16043 ✅
|
||||
- **API**: http://192.168.0.101:16043/api ✅
|
||||
- **数据库**: SQLite (param_auto.db) ✅
|
||||
- **定时任务**: 每5分钟自动处理 ✅
|
||||
|
||||
---
|
||||
|
||||
## 📝 版本历史
|
||||
|
||||
- **v1.1.0** (2026-07-12): 添加前端界面和操作页面
|
||||
- **v1.0.0** (2026-07-12): 初始版本,核心功能实现
|
||||
|
||||
---
|
||||
|
||||
## 🆘 常见问题
|
||||
|
||||
### Q: Git推送失败怎么办?
|
||||
A: 需要在Git服务器上预先创建仓库,或联系管理员开通推送权限。
|
||||
|
||||
### Q: 如何查看日志?
|
||||
A: 日志文件位于 `logs/app.log`
|
||||
|
||||
### Q: 如何停止服务?
|
||||
A: 运行 `./stop.sh` 或手动杀掉进程
|
||||
|
||||
### Q: 前端页面打不开?
|
||||
A: 检查服务是否启动,查看日志是否有错误
|
||||
|
||||
---
|
||||
|
||||
## 📞 支持
|
||||
|
||||
如有问题,请查看日志文件或联系系统管理员。
|
||||
Reference in New Issue
Block a user