mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-12-03 10:33:17 +00:00
Api key via web interface
This commit is contained in:
15
application/static/src/authapi.js
Normal file
15
application/static/src/authapi.js
Normal 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 = ''
|
||||
});
|
||||
}
|
||||
@@ -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 => {
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
|
||||
|
||||
|
||||
@media screen and (max-width: 1024px) {
|
||||
.text-lg {
|
||||
font-size: 3.125rem;
|
||||
|
||||
Reference in New Issue
Block a user