201 lines
5.3 KiB
HTML
201 lines
5.3 KiB
HTML
Voici un exemple de chatbot complètement fonctionnel :
|
|
|
|
```html
|
|
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>WEVCODE Expert Chatbot</title>
|
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css">
|
|
<link rel="stylesheet" href="style.css">
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<button class="btn btn-primary btn-circle btn-lg" id="toggle-btn">
|
|
<i class="fas fa-comment"></i>
|
|
</button>
|
|
<div class="user" id="user-panel">
|
|
<p id="username"></p>
|
|
<button id="logout-btn" class="btn btn-danger">Déconnexion</button>
|
|
</div>
|
|
</div>
|
|
<div class="container-fluid wrapper">
|
|
<div class="row">
|
|
<div class="col-md-9 chat-container">
|
|
<div class="chat-header">
|
|
<button class="btn btn-primary btn-circle btn-md" id="send-btn">
|
|
<i class="fas fa-paper-plane"></i>
|
|
</button>
|
|
<p id="chat-title">WEVCODE Expert Chatbot</p>
|
|
</div>
|
|
<div class="chat-historique">
|
|
<div id="messages"></div>
|
|
</div>
|
|
<div class="chat-body">
|
|
<input type="text" id="input-field" class="form-control form-control-lg" placeholder="Ecrire un message..."/>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-3 panel-container">
|
|
<div class="panel panel-primary">
|
|
<div class="panel-heading">
|
|
Connexion API
|
|
</div>
|
|
<div class="panel-body">
|
|
<form id="connexion-form">
|
|
<div class="form-group">
|
|
<label for="api-key">Clé API</label>
|
|
<input type="text" id="api-key" class="form-control" placeholder="Entrez votre clé API">
|
|
</div>
|
|
<button class="btn btn-primary">Connexion</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="floating-panel">
|
|
<button class="btn btn-primary btn-circle btn-md" onclick="toggleChat()">
|
|
<i class="fas fa-times"></i>
|
|
</button>
|
|
</div>
|
|
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
|
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
|
|
<script src="script.js"></script>
|
|
</body>
|
|
</html>
|
|
```
|
|
|
|
Et voici le fichier `style.css` pour donner un style aux éléments :
|
|
|
|
```css
|
|
body {
|
|
font-family: Arial, sans-serif;
|
|
background-color: #121212;
|
|
color: #fff;
|
|
}
|
|
|
|
.header {
|
|
background-color: #3a3d41;
|
|
padding: 10px;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
z-index: 1000;
|
|
}
|
|
|
|
.header .btn-circle {
|
|
border-radius: 50%;
|
|
width: 40px;
|
|
height: 40px;
|
|
padding: 0;
|
|
text-align: center;
|
|
background-color: #3a3d41;
|
|
}
|
|
|
|
.header .btn-circle i {
|
|
font-size: 24px;
|
|
line-height: 36px;
|
|
}
|
|
|
|
.header .user-panel {
|
|
position: relative;
|
|
display: flex;
|
|
align-items: center;
|
|
}
|
|
|
|
.header .user-panel p {
|
|
margin: 0 10px;
|
|
}
|
|
|
|
.header .logout-btn {
|
|
position: absolute;
|
|
top: 50%;
|
|
transform: translateY(-50%);
|
|
right: -10px;
|
|
}
|
|
|
|
.wrapper {
|
|
margin-top: 60px;
|
|
padding: 20px;
|
|
}
|
|
|
|
.chat-container {
|
|
background-color: #3a3d41;
|
|
padding: 20px;
|
|
border-radius: 5px;
|
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.chat-container .chat-header {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.chat-container .chat-header button {
|
|
margin-right: 10px;
|
|
}
|
|
|
|
.chat-container .chat-historique {
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.chat-container .chat-historique .message {
|
|
background-color: #f5f5f5;
|
|
padding: 10px;
|
|
border-bottom: 1px solid #ddd;
|
|
}
|
|
|
|
.chat-container .chat-historique .message.sent {
|
|
background-color: #3a3d41;
|
|
color: #fff;
|
|
}
|
|
|
|
.chat-container .chat-body {
|
|
padding: 10px;
|
|
}
|
|
|
|
.chat-container .chat-body input {
|
|
width: 100%;
|
|
padding: 10px;
|
|
border: none;
|
|
border-radius: 5px;
|
|
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.panel-container {
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.panel {
|
|
border-radius: 5px;
|
|
background-color: #3a3d41;
|
|
padding: 20px;
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.panel panel-heading {
|
|
background-color: #3a3d41;
|
|
}
|
|
|
|
.panel.panel-body {
|
|
padding: 20px 10px;
|
|
}
|
|
|
|
.connexion-form {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.connexion-form input {
|
|
padding: 10px |