Files
param-auto-manager/README.md
T
hz4th_coder b7b09251f8 初始化参数数据自动化管理系统
功能:
- 文章内容库管理
- 待处理产品列表管理
- 自动处理流程
- 智能搜索和数据提取
- ParamHub API集成
- 定时任务调度

部署端口: 16043
2026-07-12 01:07:26 +08:00

270 lines
5.7 KiB
Markdown
Raw 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.
# Param Auto Manager - 参数数据自动化管理系统
自动管理参数数据网站的系统,支持从内容库和互联网搜索数据,自动处理产品并提交到后台管理待审核区。
## 功能特性
- 📚 **内容库管理**:存储和管理搜索获取的相关文章内容
- 🔄 **自动处理流程**:自动从待处理列表中提取产品并处理
- 🔍 **智能搜索**:从内容库和互联网搜索相关数据
- 📝 **数据提取**:根据产品类别提取和填充字段
-**审核提交**:自动提交到ParamHub后台管理待审核区
- 🕐 **定时任务**:支持定时自动处理产品
## 系统架构
```
param-auto-manager/
├── app.py # 主应用入口
├── config.py # 配置文件
├── requirements.txt # Python依赖
├── models/
│ └── database.py # 数据库模型
├── routes/
│ ├── articles.py # 文章内容库API
│ ├── products.py # 产品处理API
│ └── system.py # 系统管理API
├── services/
│ ├── search_service.py # 搜索服务
│ ├── process_service.py # 数据处理服务
│ └── paramhub_client.py # ParamHub API客户端
├── utils/
│ └── scheduler.py # 定时任务调度器
├── data/ # 数据库文件目录
└── logs/ # 日志文件目录
```
## 安装依赖
```bash
cd works/param-auto-manager
pip install -r requirements.txt
```
## 启动服务
```bash
# 方式1: 使用启动脚本
chmod +x start.sh
./start.sh
# 方式2: 直接运行
python3 app.py
```
服务将在端口 **16043** 启动。
## API 文档
### 文章内容库 API (`/api/articles`)
#### 获取文章列表
```
GET /api/articles?limit=100&offset=0
```
#### 搜索文章
```
GET /api/articles/search?q=关键词&category=分类
```
#### 获取文章详情
```
GET /api/articles/{article_id}
```
#### 创建文章
```
POST /api/articles
Content-Type: application/json
{
"product_names": ["产品A", "产品B"],
"category": "AI模型",
"keywords": ["关键词1", "关键词2"],
"summary": "文章摘要",
"content": "文章内容",
"source": "来源",
"url": "原文链接"
}
```
#### 从URL抓取文章
```
POST /api/articles/fetch
Content-Type: application/json
{
"url": "https://example.com/article",
"product_names": ["产品A"],
"category": "分类"
}
```
#### 删除文章
```
DELETE /api/articles/{article_id}
```
### 产品处理 API (`/api/products`)
#### 获取待处理产品列表
```
GET /api/products/pending?limit=20&order_by=priority
```
#### 添加待处理产品
```
POST /api/products/pending
Content-Type: application/json
{
"product_name": "产品名称",
"category": "分类",
"subcategory": "子分类",
"priority": 10,
"source": "manual"
}
```
#### 批量添加待处理产品
```
POST /api/products/pending
Content-Type: application/json
[
{"product_name": "产品1", "category": "分类"},
{"product_name": "产品2", "category": "分类"}
]
```
#### 移除待处理产品
```
DELETE /api/products/pending/{product_name}
```
#### 获取处理中的产品
```
GET /api/products/processing
```
#### 获取处理历史
```
GET /api/products/history?limit=100
```
#### 获取指定产品的处理历史
```
GET /api/products/history/{product_name}
```
#### 处理单个产品
```
POST /api/products/process
Content-Type: application/json
{
"product_name": "产品名称",
"category": "分类",
"subcategory": "子分类"
}
```
#### 批量处理产品
```
POST /api/products/process/batch
Content-Type: application/json
{
"limit": 5
}
```
### 系统管理 API (`/api/system`)
#### 获取系统配置
```
GET /api/system/config
```
#### 更新系统配置
```
PUT /api/system/config
Content-Type: application/json
{
"auto_process_enabled": "true",
"process_interval": "300",
"batch_size": "5"
}
```
#### 获取系统统计
```
GET /api/system/stats
```
#### 健康检查
```
GET /api/system/health
```
## 处理流程
1. **添加待处理产品**:手动添加或系统自动发现新产品
2. **自动/手动触发处理**
- 从内容库搜索相关文章
- 从互联网搜索最新数据
- 提取产品具体内容
- 根据类别字段填充数据
- 提交到ParamHub待审核区
3. **发现新产品**:处理过程中自动发现并添加相关产品
## 数据库表结构
### articles (文章内容库)
- id, product_names, category, keywords, summary, content, source, url, fetch_date
### pending_products (待处理产品列表)
- id, product_name, category, subcategory, priority, source
### processing_products (处理中产品)
- id, product_name, category, subcategory, status, started_at
### process_history (处理历史)
- id, product_name, category, subcategory, status, review_id, details
## 配置说明
编辑 `config.py` 文件:
```python
PORT = 16043 # 服务端口
PARAMHUB_BASE_URL = 'http://localhost:16041' # ParamHub API地址
PARAMHUB_PASSWORD = 'admin123' # ParamHub管理员密码
SEARCH_MAX_RESULTS = 10 # 搜索最大结果数
PROCESS_INTERVAL = 300 # 自动处理间隔(秒)
BATCH_SIZE = 5 # 批量处理数量
```
## 注意事项
1. 确保 ParamHub 服务(端口16041)正常运行
2. 首次运行会自动创建数据库和表结构
3. 定时任务默认每5分钟执行一次自动处理
4. 可通过系统配置API调整自动处理参数
## 日志
日志文件位于 `logs/app.log`,包含:
- 系统启动信息
- 处理过程记录
- 错误和异常信息
## 版本历史
- v1.0.0 (2026-07-12): 初始版本
- 内容库管理
- 产品处理流程
- 定时任务调度
- ParamHub API集成