docs(readme): add interview bot documentation
This commit is contained in:
159
README.md
Normal file
159
README.md
Normal file
@@ -0,0 +1,159 @@
|
||||
# 🤖 Interview Bot
|
||||
|
||||
AI-powered interviewer bot with video call interface and calendar scheduling, built on Cloudflare Workers.
|
||||
|
||||
## Features
|
||||
|
||||
- **📅 Calendar Scheduling** - Visual calendar with drag-and-click scheduling
|
||||
- **📹 Video Call Interface** - Simulated video call with AI avatar
|
||||
- **🧠 AI Interviewer** - Streaming responses via Workers AI + AI Gateway
|
||||
- **💬 Real-time Chat** - Server-sent events for smooth streaming
|
||||
- **📱 Responsive UI** - Works on desktop and mobile
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────┐
|
||||
│ Cloudflare Edge │
|
||||
│ ┌─────────────┐ ┌──────────────┐ ┌────────────────┐ │
|
||||
│ │ Worker │──│ AI Gateway │──│ Workers AI │ │
|
||||
│ │ (index.ts) │ │ (optional) │ │ (Llama 3.1 8B) │ │
|
||||
│ └──────┬──────┘ └──────────────┘ └────────────────┘ │
|
||||
│ │ │
|
||||
│ ┌──────┴──────┐ │
|
||||
│ │ KV Store │ ← Interview data │
|
||||
│ └─────────────┘ │
|
||||
└─────────────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Install dependencies
|
||||
|
||||
```bash
|
||||
npm install
|
||||
```
|
||||
|
||||
### 2. Create KV namespaces
|
||||
|
||||
```bash
|
||||
# Create production namespace
|
||||
npx wrangler kv namespace create INTERVIEWS
|
||||
|
||||
# Create preview namespace for local dev
|
||||
npx wrangler kv namespace create INTERVIEWS --preview
|
||||
```
|
||||
|
||||
### 3. Update wrangler.toml
|
||||
|
||||
Replace the placeholder IDs with the ones from the previous step:
|
||||
|
||||
```toml
|
||||
[[kv_namespaces]]
|
||||
binding = "INTERVIEWS"
|
||||
id = "<YOUR_PRODUCTION_ID>"
|
||||
preview_id = "<YOUR_PREVIEW_ID>"
|
||||
```
|
||||
|
||||
### 4. (Optional) Configure AI Gateway
|
||||
|
||||
For analytics, caching, and rate limiting:
|
||||
|
||||
1. Create an AI Gateway in the Cloudflare dashboard
|
||||
2. Uncomment and update the AI Gateway config in `wrangler.toml`:
|
||||
|
||||
```toml
|
||||
[ai.gateway]
|
||||
id = "your-gateway-id"
|
||||
```
|
||||
|
||||
### 5. Run locally
|
||||
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
Open http://localhost:8787
|
||||
|
||||
### 6. Deploy to production
|
||||
|
||||
```bash
|
||||
npm run deploy
|
||||
```
|
||||
|
||||
## API Endpoints
|
||||
|
||||
| Method | Endpoint | Description |
|
||||
|--------|----------|-------------|
|
||||
| GET | `/api/interviews` | List all interviews |
|
||||
| POST | `/api/interviews` | Create new interview |
|
||||
| PUT | `/api/interviews/:id` | Update interview |
|
||||
| DELETE | `/api/interviews/:id` | Delete interview |
|
||||
| POST | `/api/chat` | Stream AI chat response |
|
||||
|
||||
## Interview Data Structure
|
||||
|
||||
```typescript
|
||||
interface Interview {
|
||||
id: string;
|
||||
candidateName: string;
|
||||
email: string;
|
||||
scheduledAt: string; // ISO 8601
|
||||
duration: number; // minutes
|
||||
status: 'scheduled' | 'in-progress' | 'completed' | 'cancelled';
|
||||
notes: string[];
|
||||
transcript: string[];
|
||||
}
|
||||
```
|
||||
|
||||
## Customization
|
||||
|
||||
### Change AI Model
|
||||
|
||||
In `src/index.ts`, update the model in `handleChat()`:
|
||||
|
||||
```typescript
|
||||
const stream = await env.AI.run('@cf/meta/llama-3.3-70b-instruct-fp8-fast', {
|
||||
// ...options
|
||||
});
|
||||
```
|
||||
|
||||
Available models: https://developers.cloudflare.com/workers-ai/models/
|
||||
|
||||
### Modify Interview Prompts
|
||||
|
||||
Edit the `SYSTEM_PROMPT` constant in `src/index.ts` to customize:
|
||||
- Interview style and tone
|
||||
- Question categories
|
||||
- Evaluation criteria
|
||||
|
||||
### Add Real Video (WebRTC)
|
||||
|
||||
To add actual video calls using Cloudflare Realtime:
|
||||
|
||||
1. Enable Realtime SFU in your Cloudflare dashboard
|
||||
2. Add the RealtimeKit SDK to the frontend
|
||||
3. Replace the simulated video with real WebRTC streams
|
||||
|
||||
See: https://developers.cloudflare.com/realtime/
|
||||
|
||||
## Tech Stack
|
||||
|
||||
- **Runtime**: Cloudflare Workers
|
||||
- **AI**: Workers AI with Llama 3.1 8B Instruct
|
||||
- **Storage**: Cloudflare KV
|
||||
- **Streaming**: Server-Sent Events (SSE)
|
||||
- **Frontend**: Vanilla JS with inline styles
|
||||
|
||||
## Cost Estimation
|
||||
|
||||
| Resource | Free Tier | Paid |
|
||||
|----------|-----------|------|
|
||||
| Workers requests | 100k/day | $0.30/million |
|
||||
| Workers AI | 10k neurons/day | $0.011/1k neurons |
|
||||
| KV reads | 100k/day | $0.50/million |
|
||||
| KV writes | 1k/day | $5.00/million |
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
Reference in New Issue
Block a user