doc-forge-reds/README.md

79 lines
3.0 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.

# AI 智能文档生成系统 (Doc Forge Reds)
## 项目简介
Doc Forge Reds 是一款外部 Web 工具,支持上传 Word 模板、在线编辑与预览,通过可视化方式标注文档中需要 AI 生成内容的区域,并可配置不同的 AI 模型进行内容生成。系统提供模型管理、模板管理、生成点管理、异步任务执行等完整功能,最终导出的文档保持原样式。
## 核心功能
- 📤 上传 Word 模板,在线编辑并预览
- 🎯 框选标注生成点,配置提示词、参考文件和指定 AI 模型
- 🤖 AI 模型管理多供应商OpenAI、Azure、自定义
- ⚙️ 异步任务生成,状态追踪,结果下载
## 技术栈
- **前端**React 18 + TypeScript + Ant Design + TinyMCE
- **后端**Python 3.12 + FastAPI + SQLAlchemy
- **异步任务**Celery + Redis
- **数据库**PostgreSQL 16
- **文档处理**Mammoth + python-docx + reportlab
- **部署**Docker + Docker Compose + Nginx
## 快速开始
### 环境要求
- Docker & Docker Compose
- Python 3.12+ (本地开发)
- Node.js 22+ (本地开发)
### 生产部署(一键启动)
```bash
cp .env.example .env # 编辑 SECRET_KEY
./deploy.sh # 构建镜像 + 启动 + 数据库迁移
```
访问 `http://localhost:3000`
### 本地开发
```bash
# 1. 启动依赖服务
docker compose up -d postgres redis
# 2. 后端
cd backend
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
alembic upgrade head
uvicorn app.main:app --reload
# 3. Celery Worker新终端
cd backend && source venv/bin/activate
celery -A app.tasks.celery_app worker --loglevel=info
# 4. 前端(新终端)
cd web && npm install && npm run dev
```
## 项目目录结构
```
.
├── backend/ # Python 后端
│ ├── app/
│ │ ├── api/ # API 路由
│ │ ├── core/ # 配置、安全、数据库
│ │ ├── models/ # ORM 模型
│ │ ├── schemas/ # Pydantic 模式
│ │ ├── services/ # 业务逻辑
│ │ ├── tasks/ # Celery 任务
│ │ └── main.py
│ ├── migrations/ # Alembic 迁移
│ ├── requirements.txt
│ └── Dockerfile
├── web/ # React 前端
│ ├── src/
│ │ ├── api/ # API 调用封装
│ │ ├── components/ # 可复用 UI
│ │ ├── pages/ # 页面
│ │ ├── hooks/ # 自定义 Hooks
│ │ └── store/ # 状态管理
│ ├── package.json
│ └── Dockerfile
├── docker-compose.yml
└── docs/ # 项目文档
```
## 文档索引
- [技术方案概述](docs/技术方案概述.md)
- [数据库设计](docs/数据库设计.md)
- [API 设计](docs/API设计.md)
- [任务拆解清单](docs/任务拆解清单.md)
- [部署指南](docs/部署指南.md)