# RAG **Repository Path**: iron-mam/rag ## Basic Information - **Project Name**: RAG - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-18 - **Last Updated**: 2026-07-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # RAG Backend Service (Django + Docker) 基于 Django 构建的 RAG(Retrieval-Augmented Generation)后端服务, 集成 MongoDB 向量检索、PostgreSQL 业务数据存储,并通过 Docker Compose 统一部署。 --- ## ✨ 项目功能概述 - 提供统一的 **RAG 文件管理与问答接口** - 支持 Markdown / PDF / DOCX / TXT 文档索引 - 使用 MongoDB 作为向量存储(LangChain + Atlas Vector Search) - 提供 `/api/endpoints/` 自动枚举接口,用于接口自检与调试 - 默认对外 **隐藏 Django Admin 路由**,提升接口专业性 --- ## 📁 项目结构 ```text . ├── llm_exp/ # Django 项目配置 │ ├── asgi.py │ ├── endpoint_view.py # API 路由自动枚举(/api/endpoints/) │ ├── settings.py │ ├── urls.py │ └── wsgi.py │ ├── RAG/ # RAG 业务模块 │ ├── services/ │ │ ├── db.py # 数据库连接封装 │ │ ├── embeds.py # Embedding 接口(Ollama) │ │ ├── rag_core.py # RAG 核心逻辑(索引 / 检索 / 生成) │ │ ├── rag_docs.py # 文档处理相关逻辑 │ │ └── rag_public.py # 对外 RAG API │ ├── serializers.py │ ├── urls.py │ └── views.py │ ├── static/ │ └── rag/ # RAG 上传目录(运行时生成,仓库中为空) │ ├── docker-compose.yml # Docker 编排(Postgres + Mongo + Backend) ├── Dockerfile # 后端镜像构建 ├── requirements.txt └── manage.py ## 🚫 Not tracked in Git - `.venv/` local virtual environment - `database/` local Mongo/Postgres data - `.env` secrets - `static/rag/` uploaded runtime test files - `__pycache__/` and `*.pyc` ## 启动方式 docker compose up -d --build ## 启动完成后: Django Admin http://localhost:8000/admin/ Swagger API 文档 http://localhost:8000/api/docs/ 接口枚举(自检) http://localhost:8000/api/endpoints/ ## 接口枚举说明(/api/endpoints/) /api/endpoints/ 会动态扫描当前 Django 项目中的 URL 路由,并以 JSON 形式返回: + 当前可用接口数量 + 对外暴露的 API 路径 + 自动隐藏 /admin/ 等内部路由(默认) 该接口主要用于: + 项目自检 + 部署后快速确认接口是否正常加载 ## 说明 + RAG 测试文档属于运行时数据,未提交至仓库 + static/rag/ 目录仅作为占位,实际文件由接口动态生成 + 敏感配置统一通过 .env 管理