A beautiful web interface for querying YouTube transcripts with chat history and context management.
- 🎨 Modern UI: Clean, responsive chat interface
- 💬 Chat History: All conversations are saved automatically
- 🔄 Context Awareness: Previous conversations are included in context
- 📚 Source Citations: See which videos provided the information
- 🚀 Fast: Uses optimized models (gpt-4o-mini for extraction)
-
Start the web server:
source venv/bin/activate python web_app.pyOr use the convenience script:
./start_web.sh
-
Open your browser: Navigate to: http://localhost:8000
-
Start chatting!
- Type your question in the input box
- Press Enter or click Send
- View sources below each answer
- Click the "+ New Chat" button in the sidebar
- Or simply start typing - a new chat will be created automatically
- All previous chats appear in the left sidebar
- Click any chat to load its history
- Chats are sorted by most recent first
- The system automatically includes the last 10 messages from your conversation
- This helps maintain context across multiple questions
- You can disable this by setting
use_history: falsein the API
Send a message and get a response.
Request:
{
"message": "What is BPC157?",
"chat_id": "optional-chat-id",
"use_history": true
}Response:
{
"chat_id": "uuid",
"message": "Answer text...",
"sources": [
{
"video_title": "Video Title",
"video_url": "https://youtube.com/..."
}
],
"timestamp": "2026-01-13T08:00:00"
}Get list of all chat sessions.
Get full history for a specific chat.
Delete a chat session.
The web interface uses the same configuration as the CLI tool (config.py):
- Extraction Model:
gpt-4o-mini(fast, 128K context) - Synthesis Model:
gpt-5.2-chat-latest(high quality) - Max Chunk Tokens: 120,000 (optimized for speed)
Chat histories are stored in the chat_history/ directory as JSON files:
- Each chat has a unique UUID
- Files are named
{chat_id}.json - Format: Array of message objects with role, content, timestamp, and sources
Port already in use:
# Change port in web_app.py or use:
uvicorn web_app:app --port 8001RAG engine not initialized:
- Make sure
channel_transcripts.jsonexists - Check that the transcript file is valid JSON
Slow responses:
- Check your API keys and rate limits
- Consider increasing
MAX_PARALLEL_EXTRACTIONSin config.py - Use a faster extraction model (already using gpt-4o-mini)
To modify the interface:
- HTML/CSS/JS: Edit the HTML string in
web_app.py(around line 50) - API endpoints: Modify the FastAPI routes in
web_app.py - Styling: Update the
<style>section in the HTML