--> // JavaScript for automatic image slider // Automatically advance to the next slide every 3 seconds (adjust as needed) let userMessage = null; // Variable to store user's message const API_KEY = "PASTE-YOUR-API-KEY"; // Paste your API key here // Create a chat
  • element with passed message and className return chatLi; // return chat
  • element // Define the properties and message for the API request // Send POST request to API, get response and set the reponse as paragraph text userMessage = chatInput.value.trim(); // Get user entered message and remove extra whitespace // Clear the input textarea and set its height to default // Append the user's message to the chatbox // Display "Thinking..." message while waiting for the response // Adjust the height of the input textarea based on its content // If Enter key is pressed without Shift key and the window // width is greater than 800px, handle the chat // Function to show the popup // Function to hide the popup // Show the popup after a certain time (e.g., 5 seconds) const popupDelay = 20000; // 5000 milliseconds = 5 seconds