feat(ui): default Lighthouse OpenAI chat to gpt-5.5

This commit is contained in:
alejandrobailo
2026-07-02 15:38:00 +02:00
parent b64fbe3cbd
commit 9cbc4faa11
2 changed files with 34 additions and 3 deletions
@@ -219,6 +219,25 @@ describe("LighthouseV2ChatPage", () => {
expect(within(currentModel).getByText("GPT-5.1")).toBeInTheDocument();
});
it("defaults to gpt-5.5 when OpenAI has no remembered model", () => {
// Given / When
renderPage({
configurations: [
{ ...configurations[0], defaultModel: null, connected: true },
{ ...configurations[1], connected: false },
],
modelsByProvider: {
openai: [model("gpt-4.1", "GPT-4.1"), model("gpt-5.5", "GPT-5.5")],
bedrock: [model("anthropic.claude-4")],
"openai-compatible": [model("llama-3.3")],
},
});
// Then
const currentModel = screen.getByLabelText("Current model: OpenAI GPT-5.5");
expect(within(currentModel).getByText("GPT-5.5")).toBeInTheDocument();
});
it("uses the AWS onboarding quick prompt instead of the docs prompt", async () => {
// Given
const user = userEvent.setup();
@@ -516,6 +516,13 @@ const LIGHTHOUSE_V2_PROVIDER_PRIORITY = [
LIGHTHOUSE_V2_PROVIDER_TYPE.OPENAI_COMPATIBLE,
] as const;
// Fallback model per provider when the configuration has no remembered model.
const LIGHTHOUSE_V2_PREFERRED_DEFAULT_MODEL: Partial<
Record<LighthouseV2ProviderType, string>
> = {
[LIGHTHOUSE_V2_PROVIDER_TYPE.OPENAI]: "gpt-5.5",
};
function resolveInitialModelSelection(
connectedConfigurations: LighthouseV2Configuration[],
modelsByProvider: Record<
@@ -535,14 +542,19 @@ function resolveInitialModelSelection(
for (const configuration of orderedConfigurations) {
const providerModels = modelsByProvider[configuration.providerType] ?? [];
if (providerModels.length === 0) continue;
// Prefer the provider's remembered model when it is still supported;
// otherwise fall back to the first supported model.
// Prefer the provider's remembered model when it is still supported, then
// the provider's preferred default, then the first supported model.
const rememberedModel = providerModels.find(
(model) => model.id === configuration.defaultModel,
);
const preferredModel = providerModels.find(
(model) =>
model.id ===
LIGHTHOUSE_V2_PREFERRED_DEFAULT_MODEL[configuration.providerType],
);
return {
providerType: configuration.providerType,
modelId: (rememberedModel ?? providerModels[0]).id,
modelId: (rememberedModel ?? preferredModel ?? providerModels[0]).id,
};
}