Ayush-srivastava504/RepoSense

GitHub: Ayush-srivastava504/RepoSense

一个集 AI 代码审查、简历智能分析与多平台职位聚合的全栈生产级平台,帮助开发者高效检测代码问题并智能匹配求职机会。

Stars: 0 | Forks: 0

# RepoSense – AI 驱动的代码审查与简历智能分析平台 ## 概述 RepoSense 是一个**全栈生产级平台**,结合了智能职位聚合、简历分析和 AI 驱动的代码审查。其功能包括: - **职位爬虫**:从 9+ 个求职网站聚合职位信息 - **AI 代码审查**:即时提供关于代码质量、Bug 和可读性的上下文反馈 - **简历智能分析**:根据职位列表分析简历,并提供 AI 驱动的洞察 - **RAG 服务**:基于检索增强生成 提供具备上下文感知的文档和推荐 - **神经生成器**:本地 LLM 推理,以极低的资源开销进行内容生成 - **现代前端**:基于 Next.js 的 UI,支持 GitHub OAuth、实时终端和订阅管理 ## 核心特性 - **多平台职位聚合**:集成 9+ 个数据源并进行实时抓取 - **AI 驱动的代码分析**:支持多语言 (Python, TypeScript 等) 并提供置信度评分 - **简历解析与匹配**:提取技能和经验,并与职位机会进行匹配 - **语义搜索**:基于 FAISS 的向量嵌入,实现智能文档检索 - **低资源 LLM**:Qwen GGUF 量化模型 (~400MB) 可在 CPU/t2.micro 上运行 - **批处理**:每次请求可处理多达 50 个文件,延迟低于 1 秒 - **GitHub 集成**:支持 OAuth 2.0 登录、代码库浏览器及自动生成 README - **Razorpay 集成**:安全的支付处理,提供免费和高级版的订阅管理 - **生产就绪**:支持 Docker-Compose、Railway 部署以及全面的测试 - **可扩展架构**:支持添加自定义爬虫、分析规则和检测模式 ## 快速开始 ### 前置条件 - **Python** 3.11+ - **Node.js** 18+ - **PostgreSQL** 12+ - **Docker**(可选,但推荐使用) ### 5 分钟设置 ``` # 克隆仓库 git clone cd RepoSense # 安装并激活 Python 环境 cd services python -m venv venv source venv/bin/activate # Linux/Mac # 或 venv\Scripts\activate # Windows # 安装后端依赖 pip install -r requirements.txt # 初始化数据库 python run_migrations.py # 启动后端(打开 http://localhost:8000) python app.py # 在新终端中,启动前端 cd ../apps/web npm install npm run dev # Opens http://localhost:3000 ``` **大功告成!** 整个平台现已运行。访问 http://localhost:3000 即可查看 UI。 ### 使用 Docker(推荐用于生产环境) ``` # 使用 Docker Compose 启动所有服务 docker-compose -f infrastructure/docker/docker-compose.yml up -d # 查看日志 docker-compose logs -f api ``` 请参阅 [DEPLOYMENT_GUIDE.md](./docs/DEPLOYMENT_GUIDE.md) 获取生产环境部署说明。 ## 项目结构 ``` RepoSense/ ├── README.md # Main project overview (this file) ├── OVERVIEW.md # Executive summary & architecture ├── docs/ │ ├── SETUP_GUIDE.md # Detailed setup instructions │ ├── SETUP_COMPLETE.md # Model configuration guide │ ├── DEPLOYMENT_GUIDE.md # Production deployment guide │ ├── COMPLETE_MODEL_MIGRATION_GUIDE.md # Model migration details │ └── MODEL_CONFIGURATION.md # Environment variables reference ├── Makefile # Helper commands (install, test, build) ├── package.json # Monorepo workspace definition ├── railway.json # Railway.app deployment config ├── run_migrations.py # Database migration runner │ ├── apps/web/ # Next.js Frontend │ ├── README.md # Frontend-specific docs │ ├── app/ # Next.js App Router pages │ │ ├── layout.tsx # Root layout (auth context) │ │ ├── page.tsx # Home page │ │ └── (auth)/ # Protected routes │ │ ├── dashboard/ # Main user dashboard │ │ ├── github/ # GitHub OAuth & repo browser │ │ ├── jobs/ # Job listings & matching │ │ ├── resume/ # Resume upload & analysis │ │ ├── login/ # GitHub login flow │ │ └── register/ # User registration │ ├── components/ │ │ └── github/ # GitHub-specific components │ │ └── Terminal.tsx # WebSocket terminal component │ ├── lib/ │ │ ├── api.ts # API client with auth │ │ ├── auth.ts # Authentication utilities │ │ └── razorpay.ts # Razorpay integration │ ├── public/ # Static assets │ ├── next.config.js # Next.js configuration │ ├── tailwind.config.js # Tailwind CSS config │ └── package.json # Frontend dependencies │ ├── services/ # Backend Microservices │ ├── README.md # Backend overview │ ├── app.py # FastAPI entry point │ ├── entrypoint.sh # Docker startup script │ ├── Dockerfile # Backend container image │ ├── requirements.txt # Python dependencies │ ├── .env.example # Environment template │ │ │ └── api/ # Main FastAPI application │ ├── README.md # API documentation │ ├── src/ # Application source code │ │ ├── app.py # FastAPI app factory │ │ ├── routes/ # API endpoint handlers │ │ │ ├── auth.py # Auth & OAuth │ │ │ ├── github.py # GitHub integration │ │ │ ├── review.py # Code review endpoints │ │ │ ├── jobs.py # Job search API │ │ │ ├── resume.py # Resume operations │ │ │ └── subscription.py # Razorpay subscriptions │ │ ├── services/ # Business logic │ │ │ ├── ai_service.py # Review orchestration │ │ │ ├── analysis_engine.py # CodeBERT analysis │ │ │ ├── github_service.py # GitHub API client │ │ │ ├── resume_service.py # Resume parsing │ │ │ └── razorpay_service.py # Payment processing │ │ ├── middleware/ # Auth & rate limiting │ │ ├── configs/ # Pydantic settings │ │ ├── schemas/ # Request/response models │ │ ├── utils/ # Helper functions │ │ └── models/ # ML model wrappers │ │ │ ├── crawler/ # Job Scraper (9+ sites) │ │ ├── README.md # Crawler documentation │ │ ├── src/ │ │ │ ├── index.py # Main crawler orchestrator │ │ │ ├── config.py # Configuration │ │ │ ├── utils.py # Database & utilities │ │ │ ├── scrapers/ # Platform-specific scrapers │ │ │ │ ├── base.py # Base scraper class │ │ │ │ ├── linkedin.py # LinkedIn Jobs │ │ │ │ ├── indeed.py # Indeed │ │ │ │ ├── naukri.py # Naukri (India) │ │ │ │ ├── internshala.py # Internshala │ │ │ │ ├── wellfound.py # Wellfound (Startups) │ │ │ │ ├── unstop.py # Unstop │ │ │ │ ├── glassdoor.py # Glassdoor │ │ │ │ └── cutshort.py # Cutshort │ │ │ └── processors/ │ │ │ └── normalize.py # Data normalization │ │ └── requirements.txt │ │ │ ├── neural_generator/ # Local LLM Service │ │ ├── README.md # Generator documentation │ │ ├── src/ │ │ │ └── app.py # FastAPI microservice │ │ ├── models/ # Qwen GGUF model (400MB) │ │ ├── requirements.txt │ │ └── Dockerfile │ │ │ └── rag/ # Semantic Search (RAG) │ ├── README.md # RAG documentation │ ├── src/ │ │ ├── app.py # FastAPI microservice │ │ ├── services/ │ │ │ ├── indexer.py # Repository indexing │ │ │ ├── vector_store.py# FAISS management │ │ │ ├── embedder.py # Sentence-transformers │ │ │ └── generator.py # LLM integration │ │ └── schemas/ │ ├── indices/ # FAISS indices (persisted) │ ├── requirements.txt │ └── Dockerfile │ ├── database/ # Database Layer │ └── migrations/ │ ├── 001_users.sql # User accounts & GitHub tokens │ ├── 002_resumes.sql # User resumes │ ├── 003_jobs.sql # Scraped job listings │ ├── 004_subscriptions.sql # Razorpay subscription data │ └── 005_repo_docs.sql # Repository documentation │ ├── infrastructure/ # Deployment │ └── docker/ │ ├── docker-compose.yml # Local development │ └── docker-compose.prod.yml # Production with replicas │ ├── tests/ # Test Suite │ ├── test_api.py # API endpoint integration tests │ ├── test_analysis.py # Code analysis unit tests │ ├── test_ml.py # Model loading & inference │ ├── test_performance.py # Benchmark tests │ ├── test_resume_ai.py # Resume processing tests │ ├── test_self_healing.py # Auto-fix pipeline tests │ └── validate_system.py # System validation │ └── logs/ # Runtime logs └── (rotated log files) ``` ## 技术栈 | 层级 | 技术 | 用途 | |-------|-----------|---------| | **Frontend** | Next.js 14, TypeScript, Tailwind CSS | 支持 SSR 的现代 SPA | | **Backend** | FastAPI, Python 3.11+ | 高性能异步 API | | **Microservices** | FastAPI × 3 (Crawler, RAG, Neural Generator) | 可扩展的服务架构 | | **Database** | PostgreSQL 12+ | 主数据存储 | | **Cache** | Redis (可选) | 会话和审查缓存 | | **Vector DB** | FAISS | 语义搜索和嵌入 | | **ML/NLP** | HuggingFace Transformers, sentence-transformers | 代码分析和文本生成 | | **Browser Automation** | Playwright | 职位抓取自动化 | | **LLM Inference** | llama-cpp-python (GGUF) | 本地量化模型 | | **Payments** | Stripe | 订阅管理 | | **Auth** | JWT + OAuth 2.0 + Fernet | 安全的 token 管理 | | **Async** | asyncio, httpx | 并发请求处理 | | **Containers** | Docker, Docker Compose | 部署与编排 | ## 系统架构 ``` ┌───────────────────────────────────────────┐ │ Frontend (Next.js) │ │ - Auth UI │ │ - Job Search & Matching │ │ - Resume Analyzer │ │ - GitHub Browser & Terminal │ └──────────────┬──────────────────────────┘ │ HTTP/WebSocket ┌──────────────▼──────────────────────────┐ │ API Gateway (FastAPI) │ │ - Route multiplexing │ │ - Rate limiting (100-500 req/min) │ │ - JWT middleware │ └──────────────┬──────────────────────────┘ ┌───────┼───────┐ │ │ │ ┌───▼──┐ ┌─▼────┐ ┌▼───────────┐ │ Auth │ │ Jobs │ │ Reviews │ ├──────┤ ├──────┤ ├────────────┤ │OAuth │ │Crawler│ │CodeBERT │ │JWT │ │ RAG │ │Auto-fix │ │ │ │ │ │ │ └──────┘ └──────┘ └───────────┘ │ │ │ └───────┴───────────┴─────┐ │ ┌────────────▼────────────┐ │ Microservices │ ├──────────────────────┤ │ Crawler (Port 8003) │ │ RAG (Port 8002) │ │ Neural Gen (Port 8001)│ └────────────┬─────────┘ │ ┌────────────▼────────────┐ │ PostgreSQL Database │ │ - Users │ │ - Resumes │ │ - Jobs │ │ - Subscriptions │ │ - Repo Docs │ └────────────────────────┘ ``` ## 核心 API Endpoint ### 认证 - `POST /api/auth/github/login` – GitHub OAuth 流程 - `POST /api/auth/logout` – 使 JWT token 失效 - `GET /api/auth/me` – 当前用户资料 ### 代码审查 - `POST /api/review/submit` – 提交代码进行分析 - `GET /api/review/{review_id}` – 获取审查结果 - `POST /api/review/{review_id}/autofix` – 生成修复建议 ### 职位列表 - `GET /api/jobs/search?query=internship&location=Bangalore` – 搜索职位 - `GET /api/jobs/{job_id}` – 职位详情 - `POST /api/jobs/match` – 与简历进行 AI 匹配 ### 简历处理 - `POST /api/resume/upload` – 上传并解析简历 - `GET /api/resume/{resume_id}` – 获取解析后的简历 - `POST /api/resume/{resume_id}/analyze` – AI 分析 ### GitHub 集成 - `GET /api/github/repos` – 列出用户代码库 - `GET /api/github/{repo}/files` – 浏览代码库文件 - `POST /api/github/{repo}/auto-setup` – 生成 README ### 订阅 - `POST /api/subscription/checkout` – 创建 Stripe 会话 - `GET /api/subscription/status` – 检查订阅层级 - `POST /api/webhook/stripe` – 支付 webhook **完整 API 文档:** 访问 http://localhost:8000/docs (Swagger UI) ## 测试 ``` # 导航到仓库根目录 cd RepoSense # 运行所有测试 pytest -v # 运行特定测试套件 pytest tests/test_api.py # API integration pytest tests/test_analysis.py # Code analysis pytest tests/test_ml.py # Model inference pytest tests/test_performance.py # Benchmarks pytest tests/test_resume_ai.py # Resume parsing # 运行覆盖测试 pytest --cov=services tests/ # 测试单个服务 pytest tests/test_imports.py # Validate imports python services/api/test_imports.py # API validation ``` ## 部署 ### 本地开发 ``` make install # Install all dependencies make dev # Start all services make test # Run test suite ``` ### Docker(推荐) ``` # 开发 docker-compose -f infrastructure/docker/docker-compose.yml up -d # 生产 docker-compose -f infrastructure/docker/docker-compose.prod.yml up -d ``` ### Railway.app(一键部署) ``` # 首次设置 railway init railway add postgres railway up # 查看日志 railway logs ``` ### 手动部署 (AWS/Azure/DigitalOcean) 请参阅 [DEPLOYMENT_GUIDE.md](./docs/DEPLOYMENT_GUIDE.md) 获取针对特定平台的详细说明。 ## 文档 | 文档 | 用途 | |----------|---------| | [README.md](./README.md) | 项目主概览(此文件) | | [OVERVIEW.md](./OVERVIEW.md) | 执行摘要与架构 | | [docs/SETUP_GUIDE.md](./docs/SETUP_GUIDE.md) | 分步设置说明 | | [docs/DEPLOYMENT_GUIDE.md](./docs/DEPLOYMENT_GUIDE.md) | 生产环境部署指南 | | [docs/SETUP_COMPLETE.md](./docs/SETUP_COMPLETE.md) | 模型配置 | | [apps/web/README.md](./apps/web/README.md) | 前端专属文档 | | [services/README.md](./services/README.md) | 后端微服务指南 | | [services/api/README.md](./services/api/README.md) | 主 API 服务文档 | | [services/api/crawler/README.md](./services/api/crawler/README.md) | 职位爬虫指南 | | [services/api/neural_generator/README.md](./services/api/neural_generator/README.md) | LLM 生成器指南 | | [services/api/rag/README.md](./services/api/rag/README.md) | RAG 服务文档 | ## 许可证 本项目基于 **MIT License** 授权 – 详情请参阅 [LICENSE](./LICENSE) 文件。 ## 支持 - **问题反馈**:GitHub Issues - **讨论**:GitHub Discussions - **文档**:参见 `/docs` 文件夹 - **设置帮助**:参见 [SETUP_GUIDE.md](./docs/SETUP_GUIDE.md) ** 准备好开始了吗?** 运行 `python scripts/setup_models.py`,然后运行 `python services/app.py` 吧!
标签:AI代码审查, BeEF, LLM, RAG, Unmanaged PE, 招聘平台, 搜索引擎查询, 测试用例, 爬虫, 特征检测, 简历解析, 请求拦截, 逆向工具