Skip to content

Commit f5c2146

Browse files
Chandrapal Badshah0xbadshahjfagoagas
authored
fix(lighthouse): show all models in selector even without default model (#9402)
Co-authored-by: Chandrapal Badshah <12944530+Chan9390@users.noreply.github.com> Co-authored-by: Pepe Fagoaga <pepe@prowler.com>
1 parent 069f0d1 commit f5c2146

File tree

2 files changed

+18
-36
lines changed

2 files changed

+18
-36
lines changed

ui/CHANGELOG.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All notable changes to the **Prowler UI** are documented in this file.
44

5-
## [1.15.0] (Unreleased)
5+
## [1.15.0] (Prowler Unreleased)
66

77
### 🚀 Added
88

@@ -13,6 +13,16 @@ All notable changes to the **Prowler UI** are documented in this file.
1313
- Threat Map component to Overview Page [(#9324)](https://github.com/prowler-cloud/prowler/pull/9324)
1414
- MongoDB Atlas provider support [(#9253)](https://github.com/prowler-cloud/prowler/pull/9253)
1515

16+
---
17+
18+
## [1.14.2] (Prowler v5.14.2)
19+
20+
### 🐞 Fixed
21+
22+
- Models list in Lighthouse selector when default model is not set for provider [(9402)](https://github.com/prowler-cloud/prowler/pull/9402)
23+
24+
---
25+
1626
## [1.14.0] (Prowler v5.14.0)
1727

1828
### 🚀 Added

ui/actions/lighthouse/lighthouse.ts

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -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
*/
524524
export 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

Comments
 (0)