diff --git a/src/assets/js/main.js b/src/assets/js/main.js index dca3d18..6b415a1 100644 --- a/src/assets/js/main.js +++ b/src/assets/js/main.js @@ -6,9 +6,12 @@ const generateEndpoint = '/api/generate'; const userInput = document.getElementById('userInput'); const sendButton = document.getElementById('sendButton'); const outputArea = document.getElementById('outputArea'); +const loadingSpinner = document.getElementById('loadingSpinner'); +const darkModeToggle = document.getElementById('darkModeToggle'); // Functions async function sendGen() { + loadingSpinner.classList.remove('hidden'); outputArea.innerHTML = 'Generating... (please be patient, streaming responses are not enabled yet...)'; const response = await fetch(`${llmHost}${generateEndpoint}`, { method: 'POST', @@ -51,6 +54,7 @@ async function readResponse(response) { cleanResponse.push(JSONline.response); } } + loadingSpinner.classList.add('hidden'); outputArea.innerHTML = cleanResponse.join(''); return; } @@ -63,6 +67,11 @@ async function readResponse(response) { } } + +darkModeToggle.addEventListener('click', () => { + document.body.classList.toggle('dark'); +}); + // Event listeners sendButton.addEventListener('click', async () => { outputArea.innerHTML = ''; diff --git a/src/index.html b/src/index.html index 5c90f38..c2b29f5 100644 --- a/src/index.html +++ b/src/index.html @@ -3,17 +3,54 @@
-