Dharanidhar1709's picture
feat: Repository Analysis Assistant
eb2ca90
|
Raw History Blame Contribute Delete
3.58 kB
---
title: Repository Analysis Assistant
emoji: πŸ”
colorFrom: blue
colorTo: purple
sdk: docker
pinned: false
---
# Codebase Intelligence
> AI-powered semantic search, Q&A, and summarization over any codebase.
**Live Demo:** https://ai-codebase-assistant-production.up.railway.app
## What it does
Upload a `.zip` or paste a **GitHub URL** and instantly:
- **Ask** natural language questions about your code
- **Search** functions and classes semantically
- **Summarize** the entire repository with AI
## Tech Stack
| Layer | Tech |
|-------|------|
| Backend | FastAPI, Python |
| Embeddings | SentenceTransformers (`all-MiniLM-L6-v2`) |
| Vector DB | ChromaDB |
| LLM | Groq API (llama-3.3-70b) |
| Frontend | React + Vite |
| Deploy | Railway + Docker |
## Architecture
```
ZIP / GitHub URL β†’ Clone/Extract β†’ File Chunking β†’ Embeddings β†’ ChromaDB
↓
User Query β†’ Embed Query β†’ Semantic Search β†’ Top-K Chunks β†’ Groq LLM β†’ Answer
```
## Features
- **GitHub URL indexing** β€” paste any public repo URL, no zip needed
- **Multi-language support** β€” Python (AST), Jupyter Notebooks, Java, C, C++, JS, TS, Go, Rust, Ruby
- **AST-based Python chunking** β€” extracts functions, classes, methods with metadata
- **Notebook support** β€” indexes `.ipynb` code cells as individual chunks
- **Multi-session isolation** β€” each upload gets a unique ChromaDB collection, multiple users never collide
- **Large repo handling** β€” smart sampling across files, truncated file trees to stay within LLM context limits
- **Rich embeddings** β€” chunks embedded with file context, docstrings, dependencies for better semantic search
- **Auto docstring generation** β€” generates missing docstrings and re-indexes
- **Dual UI themes** β€” Light (SaaS) and Dark (Hacker) modes
## How Large Repos Are Handled
For repos with 100s–1000s of files:
- File tree is capped at 100 entries with a count of remaining files
- Summary samples 1 representative chunk per unique file (up to 15 files) instead of top-N chunks from same file
- Ask/Search are unaffected β€” full semantic search runs across all indexed chunks
- Embedding batch size tuned to `16` to balance RAM and speed on free tier
- Large repos (1000+ chunks) may take 3-5 minutes to index due to CPU constraints
## Run Locally
```bash
git clone https://github.com/Dharanidhar-17-09-2006/ai-codebase-assistant
cd ai-codebase-assistant
pip install -r requirements.txt
# add GROQ_API_KEY to .env
cd frontend && npm install && npm run build && cd ..
uvicorn app.main:app --reload
# open http://localhost:8000
```
## API Endpoints
| Method | Endpoint | Description |
|--------|----------|-------------|
| POST | `/repo/upload` | Upload zip, returns `collection_name` |
| POST | `/repo/index-url` | Index from GitHub URL |
| POST | `/repo/ask` | RAG Q&A over indexed codebase |
| POST | `/repo/search` | Semantic search over chunks |
| POST | `/repo/summarize` | AI summary of repository |
| POST | `/repo/generate-docstrings` | Auto-generate missing docstrings |
| DELETE | `/repo/session/{upload_id}` | Clean up ChromaDB collections |
## Resume
> Built an AI codebase assistant using a RAG pipeline (SentenceTransformers + ChromaDB + Groq LLM) with FastAPI backend, supporting Python AST chunking, Jupyter notebook indexing, multi-language support (Java, C, Go, Rust etc.), GitHub URL indexing, multi-user session isolation, smart large-repo summarization, and a React frontend with dual themes β€” deployed on Railway with Docker.