File size: 1,708 Bytes
a288236
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# Podcast Discussion Server

This is a FastAPI-based server that provides podcast discussion and analysis capabilities.

## Environment Variables

The following environment variables need to be set in the Hugging Face Space:

- `OPENAI_API_KEY`: Your OpenAI API key
- `ALLOWED_ORIGINS`: Comma-separated list of allowed origins (optional, defaults to Vercel domains and localhost)

## API Endpoints

- `/chat`: Main chat endpoint for podcast discussions
- `/podcast-chat/{podcast_id}`: Chat endpoint for specific podcast discussions
- `/audio-list`: List available audio files
- `/audio/{filename}`: Get specific audio file
- `/podcast/{podcast_id}/context`: Get podcast context

## Stack

- FastAPI
- OpenAI
- Langchain
- Qdrant
- GTTS

## Deployment

### Backend (Hugging Face Spaces)

This server is deployed on Hugging Face Spaces using their Docker deployment feature.

### Frontend (Vercel)

When deploying the frontend to Vercel:

1. Set the API base URL in your frontend environment:

   ```

   VITE_API_BASE_URL=https://your-username-your-space-name.hf.space

   ```

2. The server is already configured to accept requests from:

   - All Vercel domains (\*.vercel.app)

   - Local development servers (localhost:3000, localhost:5173)



3. If you're using a custom domain, add it to the `ALLOWED_ORIGINS` environment variable in your Hugging Face Space:

   ```

   ALLOWED_ORIGINS=https://your-custom-domain.com,https://www.your-custom-domain.com

   ```



## Security Features



- CORS protection with specific origin allowlist

- Security headers (HSTS, XSS Protection, etc.)

- Rate limiting

- SSL/TLS encryption (provided by Hugging Face Spaces)