@@ -1904,37 +1904,64 @@ async function renderCodexLensManager() {
19041904 container . innerHTML = '<div class="flex items-center justify-center py-12"><div class="animate-spin w-6 h-6 border-2 border-primary border-t-transparent rounded-full"></div><span class="ml-3">' + t ( 'common.loading' ) + '</span></div>' ;
19051905
19061906 try {
1907- // Load CodexLens status first to populate window.cliToolsStatus.codexlens
1908- if ( typeof loadCodexLensStatus === 'function' ) {
1907+ // Use aggregated endpoint for faster page load (single API call)
1908+ var dashboardData = null ;
1909+ var config = { index_dir : '~/.codexlens/indexes' , index_count : 0 } ;
1910+
1911+ if ( typeof loadCodexLensDashboardInit === 'function' ) {
1912+ console . log ( '[CodexLens] Using aggregated dashboard-init endpoint...' ) ;
1913+ dashboardData = await loadCodexLensDashboardInit ( ) ;
1914+ if ( dashboardData && dashboardData . config ) {
1915+ config = dashboardData . config ;
1916+ console . log ( '[CodexLens] Dashboard init loaded, config:' , config ) ;
1917+ }
1918+ } else if ( typeof loadCodexLensStatus === 'function' ) {
1919+ // Fallback to legacy individual calls
1920+ console . log ( '[CodexLens] Fallback to legacy loadCodexLensStatus...' ) ;
19091921 await loadCodexLensStatus ( ) ;
1922+ var response = await fetch ( '/api/codexlens/config' ) ;
1923+ config = await response . json ( ) ;
19101924 }
19111925
1912- // Load LiteLLM API config for embedding backend options
1913- try {
1914- console . log ( '[CodexLens] Loading LiteLLM config...' ) ;
1915- var litellmResponse = await fetch ( '/api/litellm-api/ config') ;
1916- console . log ( '[CodexLens] LiteLLM response status:' , litellmResponse . status ) ;
1917- if ( litellmResponse . ok ) {
1918- window . litellmApiConfig = await litellmResponse . json ( ) ;
1919- console . log ( '[CodexLens] LiteLLM config loaded:' , window . litellmApiConfig ) ;
1920- console . log ( '[CodexLens] Providers:' , window . litellmApiConfig ?. providers ?. length || 0 ) ;
1921- } else {
1922- console . warn ( '[CodexLens] LiteLLM config response not ok :' , litellmResponse . status ) ;
1926+ // Load LiteLLM API config for embedding backend options (parallel with page render)
1927+ var litellmPromise = ( async ( ) => {
1928+ try {
1929+ console . log ( '[CodexLens] Loading LiteLLM config... ') ;
1930+ var litellmResponse = await fetch ( '/api/litellm-api/config' ) ;
1931+ if ( litellmResponse . ok ) {
1932+ window . litellmApiConfig = await litellmResponse . json ( ) ;
1933+ console . log ( '[CodexLens] LiteLLM config loaded, providers :' , window . litellmApiConfig ?. providers ?. length || 0 ) ;
1934+ }
1935+ } catch ( e ) {
1936+ console . warn ( '[CodexLens] Could not load LiteLLM config :' , e ) ;
19231937 }
1924- } catch ( e ) {
1925- console . warn ( '[CodexLens] Could not load LiteLLM config:' , e ) ;
1926- }
1927-
1928- var response = await fetch ( '/api/codexlens/config' ) ;
1929- var config = await response . json ( ) ;
1938+ } ) ( ) ;
19301939
19311940 container . innerHTML = buildCodexLensManagerPage ( config ) ;
19321941 if ( window . lucide ) lucide . createIcons ( ) ;
19331942 initCodexLensManagerPageEvents ( config ) ;
1934- loadSemanticDepsStatus ( ) ;
1943+
1944+ // Load additional data in parallel (non-blocking)
1945+ var isInstalled = window . cliToolsStatus ?. codexlens ?. installed || dashboardData ?. installed ;
1946+
1947+ // Wait for LiteLLM config before loading semantic deps (it may need provider info)
1948+ await litellmPromise ;
1949+
1950+ // Load semantic deps status (skip if we already have it from dashboard-init)
1951+ if ( ! dashboardData ?. semantic ) {
1952+ loadSemanticDepsStatus ( ) ;
1953+ } else {
1954+ // Use cached semantic status from dashboard-init
1955+ var semanticContainer = document . getElementById ( 'semanticDepsStatus' ) ;
1956+ if ( semanticContainer && dashboardData . semantic ) {
1957+ updateSemanticDepsUI ( semanticContainer , dashboardData . semantic ) ;
1958+ }
1959+ }
1960+
19351961 loadModelList ( ) ;
1962+
19361963 // Load index stats for the Index Manager section
1937- if ( window . cliToolsStatus ?. codexlens ?. installed ) {
1964+ if ( isInstalled ) {
19381965 loadIndexStatsForPage ( ) ;
19391966 }
19401967 } catch ( err ) {
@@ -1943,6 +1970,20 @@ async function renderCodexLensManager() {
19431970 }
19441971}
19451972
1973+ /**
1974+ * Update semantic deps UI from cached data
1975+ */
1976+ function updateSemanticDepsUI ( container , semanticData ) {
1977+ if ( ! container ) return ;
1978+
1979+ if ( semanticData . available ) {
1980+ container . innerHTML = '<div class="flex items-center gap-2 text-success"><i data-lucide="check-circle" class="w-4 h-4"></i><span>' + ( semanticData . backend || 'Ready' ) + '</span></div>' ;
1981+ } else {
1982+ container . innerHTML = '<div class="flex items-center gap-2 text-muted-foreground"><i data-lucide="circle-dashed" class="w-4 h-4"></i><span>' + t ( 'codexlens.notInstalled' ) + '</span></div>' ;
1983+ }
1984+ if ( window . lucide ) lucide . createIcons ( ) ;
1985+ }
1986+
19461987/**
19471988 * Build CodexLens Manager page content
19481989 */
0 commit comments