Update index.html
Browse files- lightrag/api/static/index.html +64 -23
lightrag/api/static/index.html
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
-
<title>
|
7 |
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> <!-- Include Marked.js -->
|
9 |
</head>
|
@@ -12,11 +12,11 @@
|
|
12 |
<!-- Settings Button -->
|
13 |
<button id="settingsButton" class="absolute top-4 right-4 text-gray-600 hover:text-gray-800">
|
14 |
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
15 |
-
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12
|
16 |
</svg>
|
17 |
</button>
|
18 |
|
19 |
-
<!-- Modal for
|
20 |
<div id="settingsModal" class="hidden fixed inset-0 bg-gray-800 bg-opacity-50 flex items-center justify-center">
|
21 |
<div class="bg-white rounded-lg shadow-lg p-6 w-full max-w-md">
|
22 |
<h2 class="text-lg font-semibold text-gray-700 mb-4">Settings</h2>
|
@@ -29,6 +29,22 @@
|
|
29 |
</div>
|
30 |
</div>
|
31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
32 |
<!-- Main Content -->
|
33 |
<h1 class="text-2xl font-bold text-gray-800 mb-4">RAG WebUI</h1>
|
34 |
|
@@ -73,29 +89,54 @@
|
|
73 |
settingsModal.classList.add('hidden');
|
74 |
});
|
75 |
|
76 |
-
//
|
77 |
-
const
|
78 |
-
const
|
79 |
-
const
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
});
|
98 |
|
|
|
|
|
|
|
|
|
99 |
// File Upload Handler
|
100 |
const uploadForm = document.getElementById('uploadForm');
|
101 |
const fileInput = document.getElementById('fileInput');
|
|
|
3 |
<head>
|
4 |
<meta charset="UTF-8">
|
5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>RAG WebUI</title>
|
7 |
<script src="https://cdn.tailwindcss.com"></script>
|
8 |
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> <!-- Include Marked.js -->
|
9 |
</head>
|
|
|
12 |
<!-- Settings Button -->
|
13 |
<button id="settingsButton" class="absolute top-4 right-4 text-gray-600 hover:text-gray-800">
|
14 |
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
15 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 2a10 10 0 0110 10 10 10 0 01-10 10A10 10 0 012 12a10 10 0 0110-10zm0 2a8 8 0 100 16 8 8 0 000-16zm1 4h-2v4h2V8zm0 6h-2v2h2v-2z" />
|
16 |
</svg>
|
17 |
</button>
|
18 |
|
19 |
+
<!-- Modal for Settings -->
|
20 |
<div id="settingsModal" class="hidden fixed inset-0 bg-gray-800 bg-opacity-50 flex items-center justify-center">
|
21 |
<div class="bg-white rounded-lg shadow-lg p-6 w-full max-w-md">
|
22 |
<h2 class="text-lg font-semibold text-gray-700 mb-4">Settings</h2>
|
|
|
29 |
</div>
|
30 |
</div>
|
31 |
|
32 |
+
<!-- Health Check Button -->
|
33 |
+
<button id="healthCheckButton" class="absolute top-4 left-4 text-gray-600 hover:text-gray-800">
|
34 |
+
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
35 |
+
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-3-3v6m-7 4a9 9 0 1118 0H5z" />
|
36 |
+
</svg>
|
37 |
+
</button>
|
38 |
+
|
39 |
+
<!-- Modal for Health Check -->
|
40 |
+
<div id="healthModal" class="hidden fixed inset-0 bg-gray-800 bg-opacity-50 flex items-center justify-center">
|
41 |
+
<div class="bg-white rounded-lg shadow-lg p-6 w-full max-w-lg">
|
42 |
+
<h2 class="text-lg font-semibold text-gray-700 mb-4">System Health</h2>
|
43 |
+
<div id="healthInfo" class="text-sm text-gray-600"></div>
|
44 |
+
<button id="closeHealth" class="mt-4 bg-gray-500 text-white px-4 py-2 rounded hover:bg-gray-600">Close</button>
|
45 |
+
</div>
|
46 |
+
</div>
|
47 |
+
|
48 |
<!-- Main Content -->
|
49 |
<h1 class="text-2xl font-bold text-gray-800 mb-4">RAG WebUI</h1>
|
50 |
|
|
|
89 |
settingsModal.classList.add('hidden');
|
90 |
});
|
91 |
|
92 |
+
// Health Check Modal Handling
|
93 |
+
const healthCheckButton = document.getElementById('healthCheckButton');
|
94 |
+
const healthModal = document.getElementById('healthModal');
|
95 |
+
const closeHealth = document.getElementById('closeHealth');
|
96 |
+
const healthInfo = document.getElementById('healthInfo');
|
97 |
+
|
98 |
+
healthCheckButton.addEventListener('click', async () => {
|
99 |
+
healthModal.classList.remove('hidden');
|
100 |
+
healthInfo.textContent = "Fetching system health...";
|
101 |
+
try {
|
102 |
+
const response = await fetch('/health', {
|
103 |
+
method: 'GET',
|
104 |
+
headers: {
|
105 |
+
'Authorization': `Bearer ${localStorage.getItem('bearerKey') || ''}`
|
106 |
+
}
|
107 |
+
});
|
108 |
+
|
109 |
+
if (response.ok) {
|
110 |
+
const data = await response.json();
|
111 |
+
healthInfo.innerHTML = `
|
112 |
+
<p><strong>Status:</strong> ${data.status}</p>
|
113 |
+
<p><strong>Working Directory:</strong> ${data.working_directory}</p>
|
114 |
+
<p><strong>Input Directory:</strong> ${data.input_directory}</p>
|
115 |
+
<p><strong>Indexed Files:</strong> ${data.indexed_files}</p>
|
116 |
+
<p><strong>Configuration:</strong></p>
|
117 |
+
<ul class="list-disc ml-6">
|
118 |
+
<li><strong>LLM Binding:</strong> ${data.configuration.llm_binding}</li>
|
119 |
+
<li><strong>LLM Host:</strong> ${data.configuration.llm_binding_host}</li>
|
120 |
+
<li><strong>LLM Model:</strong> ${data.configuration.llm_model}</li>
|
121 |
+
<li><strong>Embedding Binding:</strong> ${data.configuration.embedding_binding}</li>
|
122 |
+
<li><strong>Embedding Host:</strong> ${data.configuration.embedding_binding_host}</li>
|
123 |
+
<li><strong>Embedding Model:</strong> ${data.configuration.embedding_model}</li>
|
124 |
+
<li><strong>Max Tokens:</strong> ${data.configuration.max_tokens}</li>
|
125 |
+
</ul>
|
126 |
+
`;
|
127 |
+
} else {
|
128 |
+
const error = await response.json();
|
129 |
+
healthInfo.textContent = `Error: ${error.detail}`;
|
130 |
+
}
|
131 |
+
} catch (err) {
|
132 |
+
healthInfo.textContent = `Error: ${err.message}`;
|
133 |
}
|
134 |
});
|
135 |
|
136 |
+
closeHealth.addEventListener('click', () => {
|
137 |
+
healthModal.classList.add('hidden');
|
138 |
+
});
|
139 |
+
|
140 |
// File Upload Handler
|
141 |
const uploadForm = document.getElementById('uploadForm');
|
142 |
const fileInput = document.getElementById('fileInput');
|