Update index.html
Browse files
lightrag/api/static/index.html
CHANGED
@@ -566,30 +566,6 @@
|
|
566 |
}
|
567 |
}
|
568 |
|
569 |
-
// Query Handler
|
570 |
-
async function handleQuery(query) {
|
571 |
-
queryResponse.innerHTML = '<p class="text-slate-600">Processing query...</p>';
|
572 |
-
|
573 |
-
try {
|
574 |
-
const response = await fetch('/query', {
|
575 |
-
method: 'POST',
|
576 |
-
headers: {
|
577 |
-
'Content-Type': 'application/json',
|
578 |
-
'Authorization': `Bearer ${localStorage.getItem('apiKey')}`
|
579 |
-
},
|
580 |
-
body: JSON.stringify({ query })
|
581 |
-
});
|
582 |
-
|
583 |
-
if (response.ok) {
|
584 |
-
const data = await response.json();
|
585 |
-
queryResponse.innerHTML = marked.parse(data.response);
|
586 |
-
} else {
|
587 |
-
throw new Error('Failed to process query');
|
588 |
-
}
|
589 |
-
} catch (error) {
|
590 |
-
queryResponse.innerHTML = `<p class="text-red-500">Error: ${error.message}</p>`;
|
591 |
-
}
|
592 |
-
}
|
593 |
|
594 |
// Form submission handlers
|
595 |
uploadForm.addEventListener('submit', async (e) => {
|
@@ -602,16 +578,6 @@
|
|
602 |
}
|
603 |
});
|
604 |
|
605 |
-
queryForm.addEventListener('submit', async (e) => {
|
606 |
-
e.preventDefault();
|
607 |
-
const query = queryInput.value.trim();
|
608 |
-
if (query) {
|
609 |
-
await handleQuery(query);
|
610 |
-
} else {
|
611 |
-
queryResponse.innerHTML = '<p class="text-red-500">Please enter a query</p>';
|
612 |
-
}
|
613 |
-
});
|
614 |
-
|
615 |
// Initialize
|
616 |
document.addEventListener('DOMContentLoaded', () => {
|
617 |
const apiKey = localStorage.getItem('apiKey');
|
|
|
566 |
}
|
567 |
}
|
568 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
569 |
|
570 |
// Form submission handlers
|
571 |
uploadForm.addEventListener('submit', async (e) => {
|
|
|
578 |
}
|
579 |
});
|
580 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
581 |
// Initialize
|
582 |
document.addEventListener('DOMContentLoaded', () => {
|
583 |
const apiKey = localStorage.getItem('apiKey');
|