@@ -2058,7 +2058,7 @@ function buildCodexLensManagerPage(config) {
20582058 '</div>' +
20592059 '<p class="text-xs text-muted-foreground mt-1">' + t ( 'codexlens.concurrencyHint' ) + '</p>' +
20602060 '</div>' +
2061- // Multi-Provider Rotation (only for LiteLLM backend)
2061+ // Multi-Provider Rotation (only for LiteLLM backend) - Simplified, config in API Settings
20622062 '<div id="rotationSection" class="hidden">' +
20632063 '<div class="border border-border rounded-lg p-3 bg-muted/30">' +
20642064 '<div class="flex items-center justify-between mb-2">' +
@@ -2070,13 +2070,15 @@ function buildCodexLensManagerPage(config) {
20702070 t ( 'common.disabled' ) +
20712071 '</div>' +
20722072 '</div>' +
2073- '<p class="text-xs text-muted-foreground mb-3">' + t ( 'codexlens.rotationDesc' ) + '</p>' +
2073+ '<p class="text-xs text-muted-foreground mb-2">' + t ( 'codexlens.rotationDesc' ) + '</p>' +
2074+ '<div id="rotationDetails" class="text-xs text-muted-foreground mb-3 hidden">' +
2075+ '<span id="rotationModelName"></span> · <span id="rotationEndpointCount"></span>' +
2076+ '</div>' +
20742077 '<div class="flex items-center gap-2">' +
2075- '<button class="btn-sm btn-outline flex items-center gap-1.5" onclick="showRotationConfigModal()">' +
2076- '<i data-lucide="settings" class="w-3.5 h-3.5"></i>' +
2077- t ( 'codexlens.configureRotation' ) +
2078- '</button>' +
2079- '<span id="rotationEndpointCount" class="text-xs text-muted-foreground"></span>' +
2078+ '<a href="#" class="btn-sm btn-outline flex items-center gap-1.5" onclick="navigateToApiSettingsEmbeddingPool(); return false;">' +
2079+ '<i data-lucide="external-link" class="w-3.5 h-3.5"></i>' +
2080+ t ( 'codexlens.configureInApiSettings' ) +
2081+ '</a>' +
20802082 '</div>' +
20812083 '</div>' +
20822084 '</div>' +
@@ -2656,45 +2658,69 @@ async function cleanAllIndexesFromPage() {
26562658 */
26572659async function loadRotationStatus ( ) {
26582660 try {
2659- var response = await fetch ( '/api/litellm-api/codexlens/rotation' ) ;
2661+ // Load from unified embedding-pool API (handles both new and legacy config)
2662+ var response = await fetch ( '/api/litellm-api/embedding-pool' ) ;
26602663 if ( ! response . ok ) {
2661- console . warn ( '[CodexLens] Failed to load rotation config:' , response . status ) ;
2664+ console . warn ( '[CodexLens] Failed to load embedding pool config:' , response . status ) ;
26622665 return ;
26632666 }
26642667 var data = await response . json ( ) ;
2665- window . rotationConfig = data . rotationConfig ;
2666- window . availableRotationProviders = data . availableProviders ;
2667- updateRotationStatusDisplay ( data . rotationConfig ) ;
2668+ window . embeddingPoolConfig = data . poolConfig ;
2669+ window . embeddingPoolAvailableModels = data . availableModels || [ ] ;
2670+
2671+ // Also get endpoint count
2672+ var endpointsResponse = await fetch ( '/api/litellm-api/codexlens/rotation/endpoints' ) ;
2673+ var endpointsData = endpointsResponse . ok ? await endpointsResponse . json ( ) : { count : 0 } ;
2674+
2675+ updateRotationStatusDisplay ( data . poolConfig , endpointsData . count ) ;
26682676 } catch ( err ) {
26692677 console . error ( '[CodexLens] Error loading rotation status:' , err ) ;
26702678 }
26712679}
26722680
26732681/**
26742682 * Update the rotation status display in the page
2683+ * @param {Object } poolConfig - The embedding pool configuration
2684+ * @param {number } endpointCount - Number of active endpoints
26752685 */
2676- function updateRotationStatusDisplay ( rotationConfig ) {
2686+ function updateRotationStatusDisplay ( poolConfig , endpointCount ) {
26772687 var badge = document . getElementById ( 'rotationStatusBadge' ) ;
2688+ var detailsEl = document . getElementById ( 'rotationDetails' ) ;
2689+ var modelNameEl = document . getElementById ( 'rotationModelName' ) ;
26782690 var countEl = document . getElementById ( 'rotationEndpointCount' ) ;
26792691
26802692 if ( ! badge ) return ;
26812693
2682- if ( rotationConfig && rotationConfig . enabled ) {
2694+ if ( poolConfig && poolConfig . enabled ) {
26832695 badge . textContent = t ( 'common.enabled' ) ;
26842696 badge . className = 'text-xs px-2 py-0.5 rounded-full bg-success/10 text-success' ;
26852697
2686- // Show endpoint count
2687- if ( countEl && rotationConfig . providers ) {
2688- var totalEndpoints = 0 ;
2689- rotationConfig . providers . forEach ( function ( p ) {
2690- if ( p . enabled ) totalEndpoints += ( p . useAllKeys ? 4 : 1 ) ; // Estimate
2691- } ) ;
2692- countEl . textContent = '~' + totalEndpoints + ' ' + t ( 'codexlens.totalEndpoints' ) . toLowerCase ( ) ;
2698+ // Show details
2699+ if ( detailsEl ) {
2700+ detailsEl . classList . remove ( 'hidden' ) ;
2701+ if ( modelNameEl ) modelNameEl . textContent = poolConfig . targetModel || '' ;
2702+ if ( countEl ) countEl . textContent = ( endpointCount || 0 ) + ' ' + t ( 'codexlens.totalEndpoints' ) . toLowerCase ( ) ;
26932703 }
26942704 } else {
26952705 badge . textContent = t ( 'common.disabled' ) ;
26962706 badge . className = 'text-xs px-2 py-0.5 rounded-full bg-muted text-muted-foreground' ;
2697- if ( countEl ) countEl . textContent = '' ;
2707+ if ( detailsEl ) detailsEl . classList . add ( 'hidden' ) ;
2708+ }
2709+ }
2710+
2711+ /**
2712+ * Navigate to API Settings Embedding Pool tab
2713+ */
2714+ function navigateToApiSettingsEmbeddingPool ( ) {
2715+ // Navigate to API Settings page with embedding-pool tab
2716+ if ( typeof switchView === 'function' ) {
2717+ switchView ( 'api-settings' ) ;
2718+ // Give time for page to render, then switch to embedding-pool tab
2719+ setTimeout ( function ( ) {
2720+ if ( typeof switchSidebarTab === 'function' ) {
2721+ switchSidebarTab ( 'embedding-pool' ) ;
2722+ }
2723+ } , 100 ) ;
26982724 }
26992725}
27002726
0 commit comments