From 92c29094b7b0bf5d4bb5b61b6fc350d55115edd4 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira <62335616+lucaseduoli@users.noreply.github.com> Date: Wed, 3 Dec 2025 18:03:15 -0300 Subject: [PATCH] fix: added alreadyConfigured as option to retrieve models (#597) * Added alreadyConfigured as option to retrieve models * format --- .../app/onboarding/_components/ollama-onboarding.tsx | 8 +++++--- .../app/onboarding/_components/openai-onboarding.tsx | 11 ++++++----- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/frontend/app/onboarding/_components/ollama-onboarding.tsx b/frontend/app/onboarding/_components/ollama-onboarding.tsx index 2267524b..d5c7428c 100644 --- a/frontend/app/onboarding/_components/ollama-onboarding.tsx +++ b/frontend/app/onboarding/_components/ollama-onboarding.tsx @@ -1,8 +1,8 @@ import type { Dispatch, SetStateAction } from "react"; import { useEffect, useState } from "react"; +import OllamaLogo from "@/components/icons/ollama-logo"; import { LabelInput } from "@/components/label-input"; import { LabelWrapper } from "@/components/label-wrapper"; -import OllamaLogo from "@/components/icons/ollama-logo"; import { useDebouncedValue } from "@/lib/debounce"; import type { OnboardingVariables } from "../../api/mutations/useOnboardingMutation"; import { useGetOllamaModelsQuery } from "../../api/queries/useGetModelsQuery"; @@ -28,7 +28,9 @@ export function OllamaOnboarding({ existingEndpoint?: string; }) { const [endpoint, setEndpoint] = useState( - alreadyConfigured ? undefined : (existingEndpoint || `http://localhost:11434`), + alreadyConfigured + ? undefined + : existingEndpoint || `http://localhost:11434`, ); const [showConnecting, setShowConnecting] = useState(false); const debouncedEndpoint = useDebouncedValue(endpoint, 500); @@ -40,7 +42,7 @@ export function OllamaOnboarding({ error: modelsError, } = useGetOllamaModelsQuery( debouncedEndpoint ? { endpoint: debouncedEndpoint } : undefined, - { enabled: !!debouncedEndpoint || alreadyConfigured }, + { enabled: !!debouncedEndpoint || alreadyConfigured || alreadyConfigured }, ); // Use custom hook for model selection logic diff --git a/frontend/app/onboarding/_components/openai-onboarding.tsx b/frontend/app/onboarding/_components/openai-onboarding.tsx index d01cb64a..d7272cde 100644 --- a/frontend/app/onboarding/_components/openai-onboarding.tsx +++ b/frontend/app/onboarding/_components/openai-onboarding.tsx @@ -1,8 +1,8 @@ import type { Dispatch, SetStateAction } from "react"; import { useEffect, useState } from "react"; +import OpenAILogo from "@/components/icons/openai-logo"; import { LabelInput } from "@/components/label-input"; import { LabelWrapper } from "@/components/label-wrapper"; -import OpenAILogo from "@/components/icons/openai-logo"; import { Switch } from "@/components/ui/switch"; import { Tooltip, @@ -48,13 +48,13 @@ export function OpenAIOnboarding({ getFromEnv ? { apiKey: "" } : debouncedApiKey - ? { apiKey: debouncedApiKey } - : undefined, + ? { apiKey: debouncedApiKey } + : undefined, { // Only validate when the user opts in (env) or provides a key. // If a key was previously configured, let the user decide to reuse or replace it // without triggering an immediate validation error. - enabled: debouncedApiKey !== "" || getFromEnv, + enabled: debouncedApiKey !== "" || getFromEnv || alreadyConfigured, }, ); // Use custom hook for model selection logic @@ -144,7 +144,8 @@ export function OpenAIOnboarding({ /> {alreadyConfigured && (

- Existing OpenAI key detected. You can reuse it or enter a new one. + Existing OpenAI key detected. You can reuse it or enter a new + one.

)} {isLoadingModels && (