// State management const state = { apiKey: localStorage.getItem('apiKey') || '', files: [], indexedFiles: [], currentPage: 'file-manager' }; // Utility functions const showToast = (message, duration = 3000) => { const toast = document.getElementById('toast'); toast.querySelector('div').textContent = message; toast.classList.remove('hidden'); setTimeout(() => toast.classList.add('hidden'), duration); }; const fetchWithAuth = async (url, options = {}) => { const headers = { ...(options.headers || {}), ...(state.apiKey ? { 'X-API-Key': state.apiKey } : {}) // Use X-API-Key instead of Bearer }; return fetch(url, { ...options, headers }); }; // Page renderers const pages = { 'file-manager': () => `
0 files processed
Knowledge graph visualization will be available in a future update.
Working Directory: ${data.working_directory}
Input Directory: ${data.input_directory}
Indexed Files: ${data.indexed_files_count}