Api key via web interface

This commit is contained in:
Alex
2023-02-06 23:37:18 +00:00
parent 94063649b2
commit 4bbc7ee1a0
6 changed files with 585 additions and 28 deletions

View File

@@ -0,0 +1,15 @@
function resetApiKey() {
document.getElementById('modal').classList.toggle('hidden')
}
var el2 = document.getElementById('api-key-form');
if (el2) {
el2.addEventListener("submit", function (event) {
event.preventDefault()
var apiKey = document.getElementById("api-key-input").value;
document.getElementById('modal').classList.toggle('hidden')
localStorage.setItem('apiKey', apiKey)
document.getElementById('api-key-input').value = ''
});
}

View File

@@ -19,7 +19,8 @@ if (el) {
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({question: message}),
body: JSON.stringify({question: message, api_key: localStorage.getItem('apiKey')}),
})
.then(response => response.json())
.then(data => {

View File

@@ -4,6 +4,7 @@
@media screen and (max-width: 1024px) {
.text-lg {
font-size: 3.125rem;