Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

🤖 Custom AI Chatbot Agents — OpenAI Platform

React TypeScript Node.js OpenAI Tailwind CSS

A full-stack, enterprise-grade AI chatbot platform designed to manage and run specialized AI Agents for multiple business departments (Sales, Customer Support, and Lead Prospecting). Built with a highly responsive React + Vite frontend and a robust Node.js/Express backend, integrating the OpenAI API (GPT-4) with real-time response streaming.


📈 Business Case & Real-World Impact

A scaling business required AI assistants to interact with clients across 3 distinct commercial touchpoints. Off-the-shelf chatbot software was too expensive, generic, and lacked the deep contextual awareness of the company's private business data and brand tone.

The Solution:

I designed and built a proprietary AI Agent Ecosystem:

  • Specialized Agent Prompts: 3 distinct agent profiles (Sales Closer, Technical Support Specialist, and Outbound Lead Prospector) with strict system prompt boundaries.
  • Real-time Response Streaming: Implemented server-sent events (SSE) to stream responses chunk-by-chunk, eliminating perceived loading latency.
  • Persistent Conversation History: Client-side context management coupled with session storage to maintain conversation continuity.
  • Safety Guards: Strict input validation and sanitization filters preventing prompt injection attacks.

Results:

  • Simultaneous Handling: Efficiently serves hundreds of concurrent conversations.
  • Ultra-low Latency: Average time-to-first-token response reduced to 800ms.
  • Increased Conversion: 24/7 instant response increased Sales Team qualification metrics and liberated human agents to handle high-value negotiations.

📸 Screenshots

AI Chatbot Lobby Interactive Streaming Chat
AI Lobby Chat Interface

🏗️ Architecture & Technical Highlights

custom-ai-chatbot-agents-openai/
├── backend/          # Node.js + Express API, OpenAI integration, System Prompts
└── frontend/         # React (Vite) + Tailwind CSS, Streaming Client

Key Technical Implementations:

  1. OpenAI Stream Integration (Backend): Using Express response write headers to stream tokens back to the client as they are generated by GPT-4:

    res.setHeader('Content-Type', 'text/event-stream');
    res.setHeader('Cache-Control', 'no-cache');
    
    const stream = await openai.chat.completions.create({
      model: "gpt-4",
      messages: [{ role: "system", content: systemPrompt }, ...messages],
      stream: true,
    });
    
    for await (const chunk of stream) {
      res.write(`data: ${JSON.stringify(chunk.choices[0]?.delta?.content || '')}\n\n`);
    }
  2. Streaming Text Reader (Frontend): Utilizing the browser's fetch API and reader streams to parse SSE text tokens dynamically, updating the React UI state in real-time.


⚙️ Setup & Local Installation

Prerequisites

  • Node.js (v18 or v20+)
  • An OpenAI API Key

1. Backend Setup

  1. Navigate to the backend folder:

    cd backend
  2. Install dependencies:

    npm install
  3. Create a .env file from the template:

    cp .env.example .env
  4. Populate the .env file with your credentials:

    OPENAI_API_KEY="your-openai-api-key-here"
    PORT=5000
  5. Start the backend server:

    npm start

    The API will run on http://localhost:5000.


2. Frontend Setup

  1. Navigate to the frontend folder:

    cd ../frontend/brio-react
  2. Install dependencies:

    npm install
  3. Start the Vite development server:

    npm run dev
  4. Open your browser to http://localhost:5173.


🇧🇷 Resumo em Português

O Ecossistema de IA Customizada é uma plataforma full-stack para gerenciar e executar agentes inteligentes de chat.

  • Problema: Soluções prontas de chatbot de IA são genéricas, caras e não integram profundamente com as regras e dados de vendas/suporte da empresa.
  • Solução: Backend Express integrado à API da OpenAI (GPT-4) com streaming de respostas em tempo real, controle de histórico e prompts customizados para 3 departamentos: Vendas, Suporte e Prospecção.
  • Resultados: Tempo médio de resposta inicial de 800ms, suporte simultâneo a centenas de leads e aumento na eficiência comercial com atendimento 24/7.

Developed with ❤️ by João Melo

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages