ChatGPT - Interface IA Bootstrap 5

🏷️ Extraits de code HTML 📅 03/04/2026 15:00:00 👤 Mezgani said
Bootstrap Bootstrap5 Ai Chatgpt Chat Html

Template Bootstrap 5 d'interface conversationnelle inspiree de ChatGPT avec panneau de discussion et zone de saisie.

<!DOCTYPE html>
<html lang="fr">
<head>
  <meta charset="UTF-8" />
  <meta name="copyright" content="MEZGANI Said" />
  <meta name="author" content="AngularForAll" />
  <meta name="robots" content="noindex, nofollow" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Template AI Chatgpt Bootstrap 5 | AngularForAll</title>
<!-- Bootstrap 5 CSS -->
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
  <!-- Bootstrap Icons -->
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.css">
  
  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif;
      background: #ffffff;
      height: 100vh;
      overflow: hidden;
      color: #0d0d0d;
    }

    /* Layout principal */
    .app-container {
      display: flex;
      height: 100vh;
    }

    /* Sidebar */
    .sidebar {
      width: 260px;
      background: #f7f7f8;
      display: flex;
      flex-direction: column;
      border-right: 1px solid #e5e5e5;
    }

    .sidebar-header {
      padding: 12px 8px;
    }

    .new-chat-btn {
      background: #10a37f;
      color: white;
      border: none;
      border-radius: 8px;
      padding: 10px 16px;
      font-size: 0.9rem;
      font-weight: 500;
      display: flex;
      align-items: center;
      gap: 8px;
      width: 100%;
      transition: background 0.2s;
      cursor: pointer;
    }

    .new-chat-btn:hover {
      background: #0d8c6d;
    }

    .chat-history {
      flex: 1;
      overflow-y: auto;
      padding: 8px;
    }

    .history-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 12px;
      border-radius: 8px;
      color: #0d0d0d;
      font-size: 0.9rem;
      cursor: pointer;
      transition: background 0.15s;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .history-item:hover {
      background: #ececf1;
    }

    .history-item i {
      color: #8e8ea0;
      font-size: 1rem;
    }

    .sidebar-footer {
      padding: 16px 8px;
      border-top: 1px solid #e5e5e5;
    }

    .user-info {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px;
      border-radius: 8px;
      cursor: pointer;
    }

    .user-info:hover {
      background: #ececf1;
    }

    .user-avatar {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: #10a37f;
      display: flex;
      align-items: center;
      justify-content: center;
      color: white;
      font-weight: 500;
    }

    /* Zone principale */
    .main-content {
      flex: 1;
      display: flex;
      flex-direction: column;
      background: #ffffff;
      position: relative;
    }

    /* Header */
    .chat-header {
      padding: 12px 24px;
      border-bottom: 1px solid #e5e5e5;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .model-selector {
      display: flex;
      align-items: center;
      gap: 8px;
      background: #f7f7f8;
      padding: 6px 12px;
      border-radius: 20px;
      cursor: pointer;
      font-size: 0.9rem;
    }

    .model-selector:hover {
      background: #ececf1;
    }

    .model-badge {
      background: #10a37f;
      color: white;
      padding: 2px 8px;
      border-radius: 12px;
      font-size: 0.7rem;
      font-weight: 600;
    }

    /* Zone des messages */
    .messages-container {
      flex: 1;
      overflow-y: auto;
      padding: 24px;
      display: flex;
      flex-direction: column;
      gap: 24px;
    }

    .message {
      display: flex;
      gap: 16px;
      max-width: 800px;
      margin: 0 auto;
      width: 100%;
    }

    .message-avatar {
      width: 30px;
      height: 30px;
      border-radius: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
    }

    .message.user .message-avatar {
      background: #10a37f;
      color: white;
    }

    .message.assistant .message-avatar {
      background: #10a37f;
      color: white;
    }

    .message-content {
      flex: 1;
      line-height: 1.6;
    }

    .message.user .message-content {
      color: #0d0d0d;
    }

    .message.assistant .message-content {
      color: #0d0d0d;
    }

    /* Zone de saisie */
    .input-container {
      padding: 16px 24px 24px;
      max-width: 800px;
      margin: 0 auto;
      width: 100%;
    }

    .input-wrapper {
      display: flex;
      align-items: flex-end;
      gap: 8px;
      background: #f7f7f8;
      border-radius: 16px;
      padding: 8px 16px;
      border: 1px solid #e5e5e5;
      transition: border-color 0.2s;
    }

    .input-wrapper:focus-within {
      border-color: #10a37f;
    }

    .input-wrapper textarea {
      flex: 1;
      border: none;
      background: transparent;
      resize: none;
      padding: 8px 0;
      font-size: 1rem;
      line-height: 1.5;
      max-height: 200px;
      outline: none;
    }

    .input-actions {
      display: flex;
      gap: 8px;
    }

    .input-actions button {
      background: none;
      border: none;
      color: #8e8ea0;
      padding: 8px;
      border-radius: 8px;
      cursor: pointer;
      transition: all 0.15s;
    }

    .input-actions button:hover {
      background: #e5e5e5;
      color: #0d0d0d;
    }

    .send-btn {
      background: #10a37f !important;
      color: white !important;
    }

    .send-btn:hover {
      background: #0d8c6d !important;
    }

    .disclaimer {
      text-align: center;
      color: #8e8ea0;
      font-size: 0.75rem;
      margin-top: 12px;
    }

    /* Welcome screen */
    .welcome-screen {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 24px;
    }

    .welcome-logo {
      font-size: 3rem;
      margin-bottom: 24px;
      color: #10a37f;
    }

    .welcome-screen h1 {
      font-size: 2rem;
      font-weight: 600;
      margin-bottom: 16px;
      color: #0d0d0d;
    }

    .suggestions {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 12px;
      max-width: 600px;
      margin-top: 32px;
    }

    .suggestion-card {
      background: #f7f7f8;
      border: 1px solid #e5e5e5;
      border-radius: 12px;
      padding: 16px;
      cursor: pointer;
      transition: all 0.15s;
    }

    .suggestion-card:hover {
      background: #ececf1;
    }

    .suggestion-card i {
      color: #10a37f;
      margin-bottom: 8px;
    }

    /* Responsive */
    @media (max-width: 768px) {
      .sidebar {
        display: none;
      }
      .message {
        padding: 0 12px;
      }
    }
  </style>
</head>
<body>

<div class="app-container">
  
  <!-- Sidebar -->
  <div class="sidebar">
    <div class="sidebar-header">
      <button class="new-chat-btn" onclick="newChat()">
        <i class="bi bi-plus-lg"></i> Nouveau chat
      </button>
    </div>
    
    <div class="chat-history">
      <div class="history-item" onclick="loadChat('Aujourd\'hui')">
        <i class="bi bi-chat"></i>
        <span>Aujourd'hui</span>
      </div>
      <div class="history-item" onclick="loadChat('Hier')">
        <i class="bi bi-chat"></i>
        <span>Hier</span>
      </div>
      <div class="history-item" onclick="loadChat('7 jours')">
        <i class="bi bi-chat"></i>
        <span>7 jours précédents</span>
      </div>
    </div>
    
    <div class="sidebar-footer">
      <div class="user-info" onclick="showUserMenu()">
        <div class="user-avatar">M</div>
        <span>Mon compte</span>
      </div>
    </div>
  </div>
  
  <!-- Zone principale -->
  <div class="main-content">
    <div class="chat-header">
      <div class="model-selector" onclick="showModelSelector()">
        <span>ChatGPT</span>
        <i class="bi bi-chevron-down"></i>
        <span class="model-badge">GPT-4</span>
      </div>
      <div>
        <i class="bi bi-three-dots" style="cursor: pointer;"></i>
      </div>
    </div>
    
    <!-- Welcome Screen -->
    <div class="welcome-screen" id="welcomeScreen">
      <div class="welcome-logo">
        <i class="bi bi-chat-square-text"></i>
      </div>
      <h1>Comment puis-je vous aider ?</h1>
      
      <div class="suggestions">
        <div class="suggestion-card" onclick="sendSuggestion('Explique-moi le machine learning')">
          <i class="bi bi-lightbulb"></i>
          <h6>Explique-moi</h6>
          <p class="small text-muted">le machine learning</p>
        </div>
        <div class="suggestion-card" onclick="sendSuggestion('Idées pour un projet créatif')">
          <i class="bi bi-palette"></i>
          <h6>Idées créatives</h6>
          <p class="small text-muted">pour un projet</p>
        </div>
        <div class="suggestion-card" onclick="sendSuggestion('Aide-moi à rédiger un email')">
          <i class="bi bi-envelope"></i>
          <h6>Rédaction</h6>
          <p class="small text-muted">d'un email pro</p>
        </div>
        <div class="suggestion-card" onclick="sendSuggestion('Apprendre une nouvelle compétence')">
          <i class="bi bi-book"></i>
          <h6>Apprendre</h6>
          <p class="small text-muted">une compétence</p>
        </div>
      </div>
    </div>
    
    <!-- Messages container (caché par défaut) -->
    <div class="messages-container" id="messagesContainer" style="display: none;">
      <!-- Messages injectés par JS -->
    </div>
    
    <!-- Zone de saisie -->
    <div class="input-container">
      <div class="input-wrapper">
        <textarea placeholder="Envoyer un message..." rows="1" id="messageInput"></textarea>
        <div class="input-actions">
          <button onclick="attachFile()"><i class="bi bi-paperclip"></i></button>
          <button class="send-btn" onclick="sendMessage()"><i class="bi bi-arrow-up"></i></button>
        </div>
      </div>
      <div class="disclaimer">
        ChatGPT peut faire des erreurs. Vérifiez les informations importantes.
      </div>
    </div>
  </div>
</div>

<script>
  // État de l'application
  let messages = [];
  let isFirstMessage = true;
  
  function newChat() {
    messages = [];
    isFirstMessage = true;
    document.getElementById('welcomeScreen').style.display = 'flex';
    document.getElementById('messagesContainer').style.display = 'none';
    document.getElementById('messageInput').value = '';
  }
  
  function loadChat(period) {
    console.log('Chargement du chat:', period);
    // Simulation de chargement
  }
  
  function showUserMenu() {
    alert('Menu utilisateur');
  }
  
  function showModelSelector() {
    alert('Sélection du modèle: GPT-4, GPT-3.5');
  }
  
  function attachFile() {
    alert('Joindre un fichier');
  }
  
  function sendSuggestion(text) {
    document.getElementById('messageInput').value = text;
    sendMessage();
  }
  
  function sendMessage() {
    const input = document.getElementById('messageInput');
    const text = input.value.trim();
    
    if (!text) return;
    
    // Cacher l'écran de bienvenue
    if (isFirstMessage) {
      document.getElementById('welcomeScreen').style.display = 'none';
      document.getElementById('messagesContainer').style.display = 'flex';
      isFirstMessage = false;
    }
    
    // Ajouter le message utilisateur
    addMessage(text, 'user');
    
    // Vider l'input
    input.value = '';
    
    // Simuler une réponse
    setTimeout(() => {
      const responses = [
        "Je comprends votre question. Laissez-moi vous aider avec cela.",
        "C'est une excellente question ! Voici ce que je peux vous dire...",
        "D'après mes connaissances, je peux vous apporter les informations suivantes.",
        "Je vais analyser votre demande et vous fournir une réponse détaillée."
      ];
      const randomResponse = responses[Math.floor(Math.random() * responses.length)];
      addMessage(randomResponse + " (Ceci est une démonstration de l'interface ChatGPT)", 'assistant');
    }, 1000);
  }
  
  function addMessage(text, sender) {
    const container = document.getElementById('messagesContainer');
    
    const messageDiv = document.createElement('div');
    messageDiv.className = `message ${sender}`;
    
    messageDiv.innerHTML = `
      <div class="message-avatar">
        ${sender === 'user' ? 'M' : '<i class="bi bi-chat-square-text"></i>'}
      </div>
      <div class="message-content">
        <p>${text}</p>
      </div>
    `;
    
    container.appendChild(messageDiv);
    container.scrollTop = container.scrollHeight;
  }
  
  // Auto-resize textarea
  document.getElementById('messageInput').addEventListener('input', function() {
    this.style.height = 'auto';
    this.style.height = Math.min(this.scrollHeight, 200) + 'px';
  });
  
  // Envoi avec Entrée
  document.getElementById('messageInput').addEventListener('keydown', function(e) {
    if (e.key === 'Enter' && !e.shiftKey) {
      e.preventDefault();
      sendMessage();
    }
  });
  
  console.log('✅ Interface style ChatGPT - Prête !');
</script>

</body>
</html>

Ouvrir cet aperçu dans un nouvel onglet du navigateur

🔗 Ouvrir dans le navigateur