@@ -518,8 +518,8 @@ export const deleteLighthouseProviderByType = async (
518518} ;
519519
520520/**
521- * Get lighthouse providers configuration with default models
522- * Returns only the default model for each provider to avoid loading hundreds of models
521+ * Get lighthouse providers configuration with all available models
522+ * Fetches all models for each provider to populate the model selector
523523 */
524524export const getLighthouseProvidersConfig = async ( ) => {
525525 try {
@@ -544,47 +544,19 @@ export const getLighthouseProvidersConfig = async () => {
544544 ( p : LighthouseProviderResource ) => p . attributes ?. is_active ,
545545 ) || [ ] ;
546546
547- // Build provider configuration with only default models
548547 const providersConfig = await Promise . all (
549548 activeProviders . map ( async ( provider : LighthouseProviderResource ) => {
550549 const providerType = provider . attributes
551550 . provider_type as LighthouseProvider ;
552- const defaultModelId = defaultModels [ providerType ] ;
553-
554- // Fetch only the default model for this provider if it exists
555- let defaultModel = null ;
556- if ( defaultModelId ) {
557- const headers = await getAuthHeaders ( { contentType : false } ) ;
558- const url = new URL ( `${ apiBaseUrl } /lighthouse/models` ) ;
559- url . searchParams . append ( "filter[provider_type]" , providerType ) ;
560- url . searchParams . append ( "filter[model_id]" , defaultModelId ) ;
561-
562- try {
563- const response = await fetch ( url . toString ( ) , {
564- method : "GET" ,
565- headers,
566- } ) ;
567- const data = await response . json ( ) ;
568- if ( data . data && data . data . length > 0 ) {
569- defaultModel = {
570- id : data . data [ 0 ] . attributes . model_id ,
571- name :
572- data . data [ 0 ] . attributes . model_name ||
573- data . data [ 0 ] . attributes . model_id ,
574- } ;
575- }
576- } catch ( error ) {
577- console . error (
578- `[Server] Error fetching default model for ${ providerType } :` ,
579- error ,
580- ) ;
581- }
582- }
551+
552+ // Fetch all models for this provider
553+ const modelsResponse = await getLighthouseModelIds ( providerType ) ;
554+ const models : ModelOption [ ] = modelsResponse . data || [ ] ;
583555
584556 return {
585557 id : providerType ,
586558 name : PROVIDER_DISPLAY_NAMES [ providerType ] ,
587- models : defaultModel ? [ defaultModel ] : [ ] ,
559+ models : models ,
588560 } ;
589561 } ) ,
590562 ) ;
0 commit comments