diff --git a/web/frontend/src/components/models/fetch-models-dialog.tsx b/web/frontend/src/components/models/fetch-models-dialog.tsx index 8e7a87b42..09b602e6d 100644 --- a/web/frontend/src/components/models/fetch-models-dialog.tsx +++ b/web/frontend/src/components/models/fetch-models-dialog.tsx @@ -2,7 +2,7 @@ import { IconDownload, IconLoader2 } from "@tabler/icons-react" import { useCallback, useEffect, useState } from "react" import { useTranslation } from "react-i18next" -import { fetchUpstreamModels, type UpstreamModel } from "@/api/models" +import { type UpstreamModel, fetchUpstreamModels } from "@/api/models" import { Button } from "@/components/ui/button" import { Dialog, @@ -64,12 +64,12 @@ export function FetchModelsDialog({ } }, [provider, apiKey, apiBase, t]) - // Auto-fetch when dialog opens + // Auto-fetch when dialog opens (skip if provider requires API key but none is set) useEffect(() => { - if (open && provider) { + if (open && provider && !(needsKey && !apiKey)) { handleFetch() } - }, [open, provider, handleFetch]) + }, [open, provider, apiKey, needsKey, handleFetch]) const handleFill = () => { onFill(Array.from(selected)) @@ -137,7 +137,7 @@ export function FetchModelsDialog({ )} {fetching && ( -