A lightweight chatbot library. (NOTE: This library needs the user to be connected online to provide results.)
Check out the example at: AetherLexLib AI Chatbot
This project is under “MIT LICENSE” so it is free and you can use it, modify it etc. but only if you included the copy of the license of the project you used.
To get the library do one of these methods:
Downloading latest update here
Run npm i aetherlexlib_js
to dowload it using npm.
Link it to your html using:
<script src="https://cdn.skypack.dev/aetherlexlib_js"></script>
After you’ve downloaded the .zip, extract it and add the “project_build” and “LICENSE” files to your project to start using it.
Step 1:
<script type="module">
// Your JavaScript code will go here
</script>
Step 2:
import { analyzeAndRespond } from './path/to/your/library.js';
Step 3:
Step 4:
analyzeAndRespond
function with user input.const userInput = "Hello, how are you?";
const response = await analyzeAndRespond(userInput);
console.log(response); // Outputs the AI's response
Step 5:
Step 6:
responses
object to add more context and variation.Here’s a simple example that ties everything together:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chatbot Example</title>
</head>
<body>
<div id="chat-container"></div>
<input type="text" id="user-input" placeholder="Type your message..." />
<button id="send-button">Send</button>
<script type="module">
import { analyzeAndRespond } from './path/to/your/library.js';
document.getElementById('send-button').addEventListener('click', async () => {
const inputField = document.getElementById('user-input');
const userInput = inputField.value;
const response = await analyzeAndRespond(userInput);
// Display the response
const chatContainer = document.getElementById('chat-container');
chatContainer.innerHTML += `<div>User: ${userInput}</div>`;
chatContainer.innerHTML += `<div>AI: ${response}</div>`;
inputField.value = ''; // Clear the input field
});
</script>
</body>
</html>
An example on how to use the engine can be found on “examples” folder, you can test it here: AetherLexLib AI Chatbot