Skip to content
reaatech

Files · Support Ticket to Help Center Article Generator

71 (1 binary, 618.9 kB total)attempt 3

README.md·3319 B·markdown
markdown
# Support Ticket to Help Center Article Generator
 
> Turn closed support tickets into draft help center articles in minutes using LLM-powered clustering and retrieval-augmented generation.
 
A tutorialized reference solution from [reaatech.com](https://reaatech.com), demonstrating how to build production-grade AI systems with the `@reaatech/*` package family.
 
## Architecture Overview
 
```
Support Tickets → Ingestion → Clustering → Article Generation → Help Center
```
 
1. **Ingestion** — Tickets are ingested, validated, and indexed into a vector store
2. **Clustering** — Related tickets are grouped into topics using LLM-powered clustering
3. **Article Generation** — Each cluster is used to generate a structured help center article with title, body, and sections via RAG
 
## Tech Stack
 
- **Framework:** Next.js 16+ (App Router, Turbopack)
- **Database:** Neon Postgres (serverless)
- **Vector Store:** Qdrant
- **AI SDK:** Vercel AI SDK (`ai@6.0.193`) with OpenAI-compatible provider
- **LLM Provider:** OpenAI-compatible (OpenAI, Anthropic, Ollama, etc.)
- **RAG Packages:** `@reaatech/hybrid-rag`, `@reaatech/hybrid-rag-ingestion`, `@reaatech/hybrid-rag-pipeline`, `@reaatech/hybrid-rag-retrieval`, `@reaatech/hybrid-rag-observability`, `@reaatech/hybrid-rag-mcp-server`
 
## Prerequisites
 
- Node.js >= 22
- pnpm 10
- A Neon Postgres database
- A Qdrant vector store instance
- An OpenAI-compatible LLM API key
 
## Setup
 
```bash
pnpm install
cp .env.example .env
# Fill in your environment variables in .env
pnpm dev
```
 
## API Endpoints
 
| Method | Path | Purpose |
|--------|------|---------|
| POST | /api/tickets | Ingest tickets |
| GET | /api/tickets | List tickets |
| POST | /api/clusters | Trigger clustering |
| GET | /api/clusters | List clusters |
| POST | /api/clusters/:id/articles | Generate article from cluster |
| GET | /api/articles | List articles |
| GET | /api/articles/:id | Get article by ID |
| PATCH | /api/articles/:id | Update article status |
 
## Environment Variables
 
| Variable | Description | Default |
|----------|-------------|---------|
| `DATABASE_URL` | Neon Postgres connection string | — |
| `QDRANT_URL` | Qdrant vector store URL | `http://localhost:6333` |
| `QDRANT_API_KEY` | Qdrant API key | — |
| `LLM_API_KEY` | OpenAI-compatible LLM API key | — |
| `LLM_BASE_URL` | LLM provider base URL | `https://api.openai.com/v1` |
| `LLM_MODEL` | LLM model name | `gpt-4o-mini` |
| `EMBEDDING_API_KEY` | Embedding provider API key | — |
| `EMBEDDING_MODEL` | Embedding model name | `text-embedding-3-small` |
| `LOG_LEVEL` | Logging level | `info` |
 
## Project Layout
 
```
app/                  Next.js App Router pages + API routes
src/
  lib/                Core library (schemas, db client, llm client)
  api/                Data access layer (tickets, clusters, articles)
  services/           Business logic (ticket service, clustering, article generation)
tests/                Vitest suite (mirrors src/)
packages/             API references for every dependency (read these first)
DEV_PLAN.md           Build plan for this recipe
```
 
## Running Tests
 
```bash
pnpm test            # vitest run with coverage
pnpm typecheck       # TypeScript type checking
pnpm lint            # ESLint
```
 
## License
 
MIT — see [LICENSE](./LICENSE).