Skip to content

Latest commit

Β 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ Salesai β€” Automated Sales Proposal Engine

Turn sales call recordings into actionable proposals, summaries, and audio briefs β€” powered by AI.


πŸ“Έ Interface

Video Demo

how_it_works.mp4

Landing Page

Salesai Landing Page

Analysis Dashboard

Salesai Dashboard


🎯 What It Does

Upload a sales call recording β†’ get an AI-generated analysis with:

  • Diarized Transcript β€” who said what, with timestamps
  • Speaker Role Detection β€” automatically identifies Sales Rep vs Client
  • Executive Summary β€” concise call overview
  • Pain Points β€” extracted customer challenges
  • Action Items β€” next steps with owners & deadlines
  • Draft Proposal β€” ready-to-send Markdown proposal
  • Audio Brief β€” TTS summary you can listen to
  • Export β€” PDF, Markdown, or Email

πŸ—οΈ Architecture

Architecture Diagram

flowchart LR
    subgraph Frontend["πŸ–₯️ Frontend β€” Next.js"]
        UI["React UI\n(Upload, Transcript,\nReport, Export)"]
    end

    subgraph Backend["βš™οΈ Backend β€” FastAPI"]
        API["FastAPI Server\n:8000"]
        DG["Deepgram Client\n(STT + TTS)"]
        GM["Gemini Client\n(Role ID + Report)"]
        AP["Audio Processor\n(Normalize)"]
    end

    subgraph External["☁️ External APIs"]
        DGAPI["Deepgram API\nNova-2 / Aura"]
        GMAPI["Google Gemini API\n3.1 Flash Lite"]
    end

    UI -->|"POST /api/analyze\n(audio file)"| API
    UI -->|"POST /api/tts\n(text)"| API
    UI -->|"POST /api/email-report\n(HTML)"| API

    API --> DG
    API --> GM
    API --> AP

    DG -->|"STT + Diarization"| DGAPI
    DG -->|"Text-to-Speech"| DGAPI
    GM -->|"Role Analysis"| GMAPI
    GM -->|"Report Generation"| GMAPI
Loading

πŸ”„ How It Works

sequenceDiagram
    participant U as User
    participant FE as Frontend
    participant BE as FastAPI
    participant DG as Deepgram
    participant GM as Gemini

    U->>FE: Upload audio file
    FE->>BE: POST /api/analyze (audio)
    
    BE->>DG: Transcribe with diarization
    DG-->>BE: Utterances + speakers
    
    BE->>BE: Normalize utterances
    
    BE->>GM: Identify speaker roles
    GM-->>BE: Role map (Sales Rep / Client)
    
    BE->>GM: Generate strategic report
    GM-->>BE: Summary, pain points, actions, proposal
    
    BE-->>FE: Complete analysis result
    FE-->>U: Display transcript + report

    opt Audio Brief
        U->>FE: Click "Listen"
        FE->>BE: POST /api/tts
        BE->>DG: Text-to-Speech
        DG-->>BE: Audio stream
        BE-->>FE: MP3 file
        FE-->>U: Play audio
    end

    opt Export
        U->>FE: Download PDF / MD / Email
        FE-->>U: Generated document
    end
Loading

🧩 Pipeline & Architecture Notes

Separation of Concerns (STT vs. LLM)

The pipeline explicitly separates transcription from semantic analysis to isolate failure domains:

  • Deepgram is used exclusively for fast, accurate Speech-to-Text and speaker diarization.
  • Gemini is used exclusively for role identification and strategic report generation.

By keeping these concerns separate, the system is more resilient. If the LLM provider experiences an outage, the system can still successfully generate and return the raw diarized transcript.

Normalization and Role Identification

Raw diarization from STT providers typically labels speakers as "Speaker 0" and "Speaker 1". The pipeline introduces an audio_processor.py normalizer and an intermediate LLM call specifically to identify which speaker is the "Sales Rep" and which is the "Client" based on the first few conversational turns. This step ensures the final executive summary and proposal are properly contextualized.


πŸ› οΈ Tech Stack

Layer Technology Purpose
Frontend Next.js 16, React 19, TailwindCSS 4 UI with chat-style transcript, tabbed reports
Backend FastAPI, Uvicorn, Python 3.12 REST API server
Speech-to-Text Deepgram Nova-2 Transcription with diarization
Text-to-Speech Deepgram Aura Audio brief generation
LLM Google Gemini 3.1 Flash Lite Role identification & report generation
PDF Export jsPDF (client-side) One-click PDF download
Animations Framer Motion Smooth UI transitions

πŸ“ Project Structure

Automated-Sales-Proposal-Engine/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ main.py                    # FastAPI app (3 endpoints)
β”‚   └── utils/
β”‚       β”œβ”€β”€ deepgram_client.py     # Deepgram STT & TTS
β”‚       β”œβ”€β”€ gemini_client.py       # Gemini role ID & reports
β”‚       └── audio_processor.py     # Utterance normalization
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”‚   β”œβ”€β”€ page.tsx           # Main React UI
β”‚   β”‚   β”‚   β”œβ”€β”€ layout.tsx         # App layout & metadata
β”‚   β”‚   β”‚   └── globals.css        # Global styles
β”‚   β”‚   └── lib/
β”‚   β”‚       └── utils.ts           # cn() utility
β”‚   β”œβ”€β”€ package.json
β”‚   └── tsconfig.json
β”œβ”€β”€ data/
β”‚   └── transcripts/
β”‚       └── sales_call_001.txt     # Sample transcript
β”œβ”€β”€ output/                        # Generated files directory
β”œβ”€β”€ .env.example                   # Environment variables template
β”œβ”€β”€ requirements.txt               # Python dependencies
β”œβ”€β”€ Dockerfile                     # Backend container
└── README.md

πŸš€ Quick Start

Prerequisites

1. Clone & Setup Environment

git clone https://github.com/your-username/Automated-Sales-Proposal-Engine.git
cd Automated-Sales-Proposal-Engine

# Create Python virtual environment
python -m venv venv

# Activate venv
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate

2. Configure API Keys

cp .env.example .env

Edit .env and add your keys:

DEEPGRAM_API_KEY=your_deepgram_api_key_here
GEMINI_API_KEY=your_gemini_api_key_here

3. Install & Run Backend

pip install -r requirements.txt
python backend/main.py

Backend runs at http://localhost:8000

4. Install & Run Frontend

cd frontend
npm install
npm run dev

Frontend runs at http://localhost:3000

5. Use the App

  1. Open http://localhost:3000
  2. Upload a sales call recording (MP3, WAV, M4A β€” max 25MB)
  3. Click Start Analysis
  4. View transcript, summary, pain points, action items, and draft proposal
  5. Export as PDF, Markdown, or send via email

πŸ“‘ API Endpoints

Method Endpoint Description Request Response
GET /api/health Health check β€” { "status": "ok" }
POST /api/analyze Analyze audio file multipart/form-data (file) Transcript + roles + report
POST /api/tts Generate audio brief { "text": "..." } MP3 audio file
POST /api/email-report Email report { "to_email", "subject", "report_html" } { "success": true }

Example: Analyze Response

{
  "transcript": [
    { "speaker": 0, "text": "Thanks for meeting today...", "start": 0.0, "end": 3.2 }
  ],
  "roles": { "0": "Sales Rep", "1": "Client" },
  "report": {
    "executive_summary": "...",
    "pain_points": ["High ticket volume", "Slow response times"],
    "action_items": [{ "task": "Send proposal", "owner": "Sales Rep", "by_date": "Friday" }],
    "suggested_proposal_markdown": "# Proposal for...",
    "tts_summary": "This call covered..."
  },
  "metadata": {
    "filename": "call.mp3",
    "duration_seconds": 120,
    "speakers_count": 2
  }
}

🐳 Docker Deployment

# Build the backend image
docker build -t salesai-backend .

# Run with environment variables
docker run -p 8000:8000 \
  -e DEEPGRAM_API_KEY=your_key \
  -e GEMINI_API_KEY=your_key \
  salesai-backend

πŸ”‘ Environment Variables

Variable Required Description
DEEPGRAM_API_KEY βœ… Deepgram API key for STT & TTS
GEMINI_API_KEY βœ… Google Gemini API key for LLM
SMTP_HOST ❌ SMTP server for email (default: smtp.gmail.com)
SMTP_PORT ❌ SMTP port (default: 587)
SMTP_USER ❌ SMTP username for sending emails
SMTP_PASS ❌ SMTP password

πŸ“„ License

MIT


Built with ❀️ using Deepgram + Gemini + Next.js + FastAPI

About

AI-powered sales proposal generation pipeline using FastAPI, Deepgram, Gemini, and Docker.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages