diff --git a/lightrag/api/static/index.html b/lightrag/api/static/index.html
index 20addf6c..16df098a 100644
--- a/lightrag/api/static/index.html
+++ b/lightrag/api/static/index.html
@@ -3,7 +3,7 @@
- LightRAG WebUI
+ RAG WebUI
@@ -12,11 +12,11 @@
-
+
Settings
@@ -29,6 +29,22 @@
+
+
+
+
+
+
+
System Health
+
+
+
+
+
RAG WebUI
@@ -73,29 +89,54 @@
settingsModal.classList.add('hidden');
});
- // Bearer Key Handling
- const bearerKeyInput = document.getElementById('bearerKeyInput');
- const saveBearerKey = document.getElementById('saveBearerKey');
- const bearerKeyStatus = document.getElementById('bearerKeyStatus');
+ // Health Check Modal Handling
+ const healthCheckButton = document.getElementById('healthCheckButton');
+ const healthModal = document.getElementById('healthModal');
+ const closeHealth = document.getElementById('closeHealth');
+ const healthInfo = document.getElementById('healthInfo');
- // Load Bearer Key from localStorage on page load
- const storedBearerKey = localStorage.getItem('bearerKey');
- if (storedBearerKey) {
- bearerKeyInput.value = storedBearerKey;
- bearerKeyStatus.textContent = "Bearer Key loaded from local storage.";
- }
+ healthCheckButton.addEventListener('click', async () => {
+ healthModal.classList.remove('hidden');
+ healthInfo.textContent = "Fetching system health...";
+ try {
+ const response = await fetch('/health', {
+ method: 'GET',
+ headers: {
+ 'Authorization': `Bearer ${localStorage.getItem('bearerKey') || ''}`
+ }
+ });
- // Save Bearer Key to localStorage
- saveBearerKey.addEventListener('click', () => {
- const key = bearerKeyInput.value.trim();
- if (key) {
- localStorage.setItem('bearerKey', key);
- bearerKeyStatus.textContent = "Bearer Key saved successfully.";
- } else {
- bearerKeyStatus.textContent = "Please enter a valid Bearer Key.";
+ if (response.ok) {
+ const data = await response.json();
+ healthInfo.innerHTML = `
+ Status: ${data.status}
+ Working Directory: ${data.working_directory}
+ Input Directory: ${data.input_directory}
+ Indexed Files: ${data.indexed_files}
+ Configuration:
+
+ - LLM Binding: ${data.configuration.llm_binding}
+ - LLM Host: ${data.configuration.llm_binding_host}
+ - LLM Model: ${data.configuration.llm_model}
+ - Embedding Binding: ${data.configuration.embedding_binding}
+ - Embedding Host: ${data.configuration.embedding_binding_host}
+ - Embedding Model: ${data.configuration.embedding_model}
+ - Max Tokens: ${data.configuration.max_tokens}
+
+ `;
+ } else {
+ const error = await response.json();
+ healthInfo.textContent = `Error: ${error.detail}`;
+ }
+ } catch (err) {
+ healthInfo.textContent = `Error: ${err.message}`;
}
});
+ closeHealth.addEventListener('click', () => {
+ healthModal.classList.add('hidden');
+ });
+
// File Upload Handler
const uploadForm = document.getElementById('uploadForm');
const fileInput = document.getElementById('fileInput');