From 340ba407702508b13e98f30ca4539e1f4d63e281 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Mon, 27 Jan 2025 12:25:59 +0100 Subject: [PATCH] Added rescan button --- lightrag/api/static/js/lightrag_api.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lightrag/api/static/js/lightrag_api.js b/lightrag/api/static/js/lightrag_api.js index 67e258b9..94e85eb6 100644 --- a/lightrag/api/static/js/lightrag_api.js +++ b/lightrag/api/static/js/lightrag_api.js @@ -58,6 +58,12 @@ const pages = {

Indexed Files

+ `, @@ -225,7 +231,22 @@ const handlers = { } progress.classList.add('hidden'); }); - + rescanBtn.addEventListener('click', async () => { + let apiKey = localStorage.getItem('apiKey') || ''; + const progress = document.getElementById('uploadProgress'); + const progressBar = progress.querySelector('div'); + const statusText = document.getElementById('uploadStatus'); + progress.classList.remove('hidden'); + try { + const scan_output = await fetch('/documents/scan', { + method: 'GET', + }); + statusText.textContent = scan_output.data; + } catch (error) { + console.error('Upload error:', error); + } + progress.classList.add('hidden'); + }); updateIndexedFiles(); },