Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
fix(models): Configure on an external model reveals its key card
joshistoast86958e4f5cd6
diff --git a/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx b/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsxindex 436612326f..552b394508 100644--- a/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/add-models/AddModelsView.tsx@@ -15,7 +15,14 @@ import {useExternalProvidersSelector,} from '@features/models/data/externalProvidersStore';import { ensureStartersLoaded, useStartersSelector } from '@features/models/data/startersStore';-import { clearAddModelsSeed, getAddModelsSeed, updateModelsUi, useModelsUiSelector } from '@features/models/ui/uiStore';+import {+ clearAddModelsSeed,+ getAddModelsSeed,+ openExternalProviderKeys,+ openModelManagerTab,+ updateModelsUi,+ useModelsUiSelector,+} from '@features/models/ui/uiStore';import { useNotify } from '@features/models/ui/useModelsNotify';import { useMountEffect } from '@platform/react/useMountEffect';import { useScopedAction } from '@platform/react/useScopedAction';@@ -300,7 +307,7 @@ export const AddModelsView = () => {<AccessTokenPopovervalue={accessToken}onChange={setAccessToken}- onManageKeys={() => updateModelsUi({ activeTab: 'keys' })}+ onManageKeys={() => openModelManagerTab('keys')}/>) : null}@@ -422,7 +429,7 @@ export const AddModelsView = () => {response={response}selectedBundleSources={selectedBundleSources}status={status}- onConfigureExternalProvider={() => updateModelsUi({ activeTab: 'keys' })}+ onConfigureExternalProvider={openExternalProviderKeys}onInstall={(model) => void installStarter(model)}/>) : null}diff --git a/invokeai/frontend/webv2/src/features/models/ui/add-models/StarterList.tsx b/invokeai/frontend/webv2/src/features/models/ui/add-models/StarterList.tsxindex ecb73197ce..6e8cdcc770 100644--- a/invokeai/frontend/webv2/src/features/models/ui/add-models/StarterList.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/add-models/StarterList.tsx@@ -34,7 +34,7 @@ export const StarterList = ({isInstallable: boolean;loadError: string | null;models: StarterModel[];- onConfigureExternalProvider: () => void;+ onConfigureExternalProvider: (providerId: string) => void;onInstall: (model: StarterModel) => void;pendingSources: ReadonlySet<string>;response: StartersSnapshot['response'];@@ -91,7 +91,7 @@ export const StarterList = ({variant="outline"onClick={(event) => {event.stopPropagation();- onConfigureExternalProvider();+ onConfigureExternalProvider(externalProviderId);}}><Icon as={KeyRoundIcon} boxSize="3" />diff --git a/invokeai/frontend/webv2/src/features/models/ui/credentials/ExternalProviderKeyCards.tsx b/invokeai/frontend/webv2/src/features/models/ui/credentials/ExternalProviderKeyCards.tsxindex a0e86f9162..4c9eee6d9f 100644--- a/invokeai/frontend/webv2/src/features/models/ui/credentials/ExternalProviderKeyCards.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/credentials/ExternalProviderKeyCards.tsx@@ -12,6 +12,7 @@ import {import { refreshInstalls } from '@features/models/data/installsStore';import { refreshStartersIfLoaded } from '@features/models/data/startersStore';import { KeyCardShell } from '@features/models/ui/credentials/KeyCardShell';+import { clearHighlightedProvider, useModelsUiSelector } from '@features/models/ui/uiStore';import { useMountEffect } from '@platform/react/useMountEffect';import { useScopedAction } from '@platform/react/useScopedAction';import { assertAccountScopeCurrent, type AccountScope } from '@platform/state/accountLifecycle';@@ -19,7 +20,7 @@ import { getApiErrorMessage } from '@platform/transport/http';import { Button } from '@platform/ui';import { AlibabaCloudIcon, ByteDanceIcon, GoogleGeminiIcon } from '@platform/ui/BrandIcon';import { BotIcon, HexagonIcon } from 'lucide-react';-import { useState } from 'react';+import { useCallback, useState } from 'react';import { useTranslation } from 'react-i18next';interface ProviderPresentation {@@ -41,6 +42,7 @@ const EXTERNAL_PROVIDER_PRESENTATION: Record<string, ProviderPresentation> = {export const ExternalProviderKeyCards = ({ onError }: { onError: (title: string, message: string) => void }) => {const { t } = useTranslation();const configs = useExternalProvidersSelector((snapshot) => snapshot.configs);+ const highlightProviderId = useModelsUiSelector((snapshot) => snapshot.highlightProviderId);const loadError = useExternalProvidersSelector((snapshot) => snapshot.error);const status = useExternalProvidersSelector((snapshot) => snapshot.status);@@ -87,6 +89,7 @@ export const ExternalProviderKeyCards = ({ onError }: { onError: (title: string,key={config.provider_id}description={t('models.externalProviderKeyDescription')}icon={presentation.icon}+ isHighlighted={config.provider_id === highlightProviderId}placeholder={placeholder}title={presentation.title}onError={(message) => onError(presentation.title, message)}@@ -101,6 +104,7 @@ const ExternalProviderKeyCard = ({config,description,icon,+ isHighlighted,onError,placeholder,title,@@ -108,11 +112,33 @@ const ExternalProviderKeyCard = ({config: ExternalProviderConfig;description: string;icon: ElementType;+ isHighlighted: boolean;onError: (message: string) => void;placeholder: string;title: string;}) => {const { t } = useTranslation();+ // The request is consumed once; the outline it produces is local so it+ // survives that clearing and stays up while the user works in the card.+ // Its lifetime is the tab's — `DetailPane` renders the Keys body only while+ // the tab is active, so leaving and returning lands on a quiet grid without+ // anyone having to schedule the fade.+ const [isRevealed, setIsRevealed] = useState(false);+ // A callback ref rather than an effect: the provider list loads async, so+ // the card can mount well after the request, and this fires exactly when the+ // node to scroll finally exists.+ const revealRef = useCallback(+ (node: HTMLDivElement | null) => {+ if (!node || !isHighlighted) {+ return;+ }++ node.scrollIntoView({ block: 'nearest' });+ setIsRevealed(true);+ clearHighlightedProvider();+ },+ [isHighlighted]+ );const [apiKeyDraft, setApiKeyDraft] = useState('');const [baseUrlDraft, setBaseUrlDraft] = useState(config.base_url ?? '');const [overrideBaseUrl, setOverrideBaseUrl] = useState(config.base_url !== null);@@ -177,8 +203,10 @@ const ExternalProviderKeyCard = ({return (<KeyCardShell+ ref={revealRef}description={description}icon={icon}+ isHighlighted={isRevealed}status={{label: config.api_key_configured ? t('models.keyStatus.configured') : t('models.keyStatus.unknown'),palette: config.api_key_configured ? 'green' : 'gray',diff --git a/invokeai/frontend/webv2/src/features/models/ui/credentials/KeyCardShell.tsx b/invokeai/frontend/webv2/src/features/models/ui/credentials/KeyCardShell.tsxindex 09bb63257c..8dbc2a8413 100644--- a/invokeai/frontend/webv2/src/features/models/ui/credentials/KeyCardShell.tsx+++ b/invokeai/frontend/webv2/src/features/models/ui/credentials/KeyCardShell.tsx@@ -1,4 +1,4 @@-import type { ElementType, ReactNode } from 'react';+import type { ElementType, ReactNode, Ref } from 'react';import { Badge, Flex, HStack, Icon, Stack, Text } from '@chakra-ui/react';@@ -7,21 +7,42 @@ export interface KeyStatusBadge {palette: string;}-/** Shared chrome for credential cards: icon tile, title + status badge, description, body. */+/**+ * Shared chrome for credential cards: icon tile, title + status badge,+ * description, body.+ *+ * `isHighlighted` is how a card answers "this is the one you asked for" after+ * a jump from elsewhere. One neutral step — the stroke it already has, brought+ * up a stop — rather than a tint or a flash: the grid is a settings surface,+ * and the card still has to be readable while the user types a key into it.+ */export const KeyCardShell = ({children,description,icon,+ isHighlighted = false,+ ref,status,title,}: {children: ReactNode;description: string;icon: ElementType;+ isHighlighted?: boolean;+ ref?: Ref<HTMLDivElement>;status: KeyStatusBadge | null;title: string;}) => (- <Stack bg="bg.subtle" borderColor="border.subtle" borderWidth="1px" gap="2.5" p="3" rounded="lg">+ <Stack+ ref={ref}+ bg="bg.subtle"+ borderColor={isHighlighted ? 'border.emphasized' : 'border.subtle'}+ borderWidth="1px"+ gap="2.5"+ p="3"+ rounded="lg"+ transition="border-color var(--wb-motion-duration-fast) ease"+ ><HStack align="start" gap="2.5"><Flexalign="center"diff --git a/invokeai/frontend/webv2/src/features/models/ui/uiStore.ts b/invokeai/frontend/webv2/src/features/models/ui/uiStore.tsindex f0413887f1..78e6e3bdc7 100644--- a/invokeai/frontend/webv2/src/features/models/ui/uiStore.ts+++ b/invokeai/frontend/webv2/src/features/models/ui/uiStore.ts@@ -38,6 +38,14 @@ export interface ModelsUiSnapshot {addModelsSeed: string | null;/** Model focused in the manager library's detail pane. */activeModelKey: string | null;+ /**+ * Provider whose key card should be revealed on the next render of the Keys+ * tab, set when the user asked to configure one specific provider. One-shot+ * like {@link ModelsUiSnapshot.addModelsSeed}: the card consumes it, so+ * returning to the tab later lands on a quiet grid rather than replaying a+ * highlight the user did not ask for.+ */+ highlightProviderId: string | null;selectedKeys: ReadonlySet<string>;filters: ModelLibraryFilters;/** Last folder-scan query and its results, kept across tab switches. */@@ -60,6 +68,7 @@ const createInitialModelsUiSnapshot = (): ModelsUiSnapshot => ({addModelsSeed: null,filters: { ...DEFAULT_LIBRARY_FILTERS },hfLookup: null,+ highlightProviderId: null,libraryScrollOffsets: {},pickerCompactViews: {},queueExpanded: false,@@ -112,6 +121,22 @@ export const openModelDetail = (modelKey: string): void => {updateModelsUi({ activeModelKey: modelKey, activeTab: 'details' });};+/**+ * Open the Keys tab pointed at one provider's card.+ *+ * The tab alone is not the answer to "configure this provider" — it is a grid+ * of cards, and the one the user came for may be off-screen. Naming the+ * provider lets the card reveal itself.+ */+export const openExternalProviderKeys = (providerId: string): void => {+ updateModelsUi({ activeTab: 'keys', highlightProviderId: providerId });+};++/** Consumes the pending highlight so it fires once per request. */+export const clearHighlightedProvider = (): void => {+ updateModelsUi({ highlightProviderId: null });+};+/*** Jump to Add Models with a starter bundle preselected (e.g. from the* Launchpad notice). Scan and HF lookup results are cleared because Add