Skip to content

OpenRAG is a comprehensive, single package Retrieval-Augmented Generation platform built on Langflow, Docling, and Opensearch.

Python

refactor: Design updates for Onboarding and Model selection and co-locate model components (#2331)

Mike Fortman065eae61adc4
diff --git a/frontend/app/api/queries/useGetModelsQuery.ts b/frontend/app/api/queries/useGetModelsQuery.ts
index ba7d1861b..a7b72ca90 100644
--- a/frontend/app/api/queries/useGetModelsQuery.ts
+++ b/frontend/app/api/queries/useGetModelsQuery.ts
@@ -3,7 +3,7 @@ import {
useQuery,
useQueryClient,
} from "@tanstack/react-query";
-import type { CatalogModel } from "@/app/settings/_helpers/catalog-models";
+import type { CatalogModel } from "@/components/models/catalog-models";
import { formatProviderErrorMessage } from "@/lib/chat-stream-errors";
import { useGetSettingsQuery } from "./useGetSettingsQuery";
diff --git a/frontend/app/onboarding/_components/advanced.tsx b/frontend/app/onboarding/_components/advanced.tsx
index b6ce2fe11..596d6ca0e 100644
--- a/frontend/app/onboarding/_components/advanced.tsx
+++ b/frontend/app/onboarding/_components/advanced.tsx
@@ -1,11 +1,11 @@
import { LabelWrapper } from "@/components/label-wrapper";
+import { ModelSelector } from "@/components/models/model-selector";
import {
Accordion,
AccordionContent,
AccordionItem,
AccordionTrigger,
} from "@/components/ui/accordion";
-import { ModelSelector } from "./model-selector";
export function AdvancedOnboarding({
icon,
diff --git a/frontend/app/onboarding/_components/generic-onboarding.tsx b/frontend/app/onboarding/_components/generic-onboarding.tsx
index 493fea84d..bf069dcc9 100644
--- a/frontend/app/onboarding/_components/generic-onboarding.tsx
+++ b/frontend/app/onboarding/_components/generic-onboarding.tsx
@@ -1,14 +1,14 @@
import type { Dispatch, SetStateAction } from "react";
import { useMemo, useState } from "react";
import { useGetModelCatalogQuery } from "@/app/api/queries/useGetModelsQuery";
+import { LabelInput } from "@/components/label-input";
import {
onboardingCredentialFields,
type SavedProvidersSnapshot,
savedCredentialValuesForProvider,
savedSecretFieldsForProvider,
-} from "@/app/settings/_helpers/catalog-models";
-import { getProviderChrome } from "@/app/settings/_helpers/model-helpers";
-import { LabelInput } from "@/components/label-input";
+} from "@/components/models/catalog-models";
+import { getProviderChrome } from "@/components/models/model-helpers";
import type { OnboardingVariables } from "../../api/mutations/useOnboardingMutation";
import { AdvancedOnboarding } from "./advanced";
diff --git a/frontend/app/onboarding/_components/ibm-onboarding.tsx b/frontend/app/onboarding/_components/ibm-onboarding.tsx
index 5df710045..e46d02476 100644
--- a/frontend/app/onboarding/_components/ibm-onboarding.tsx
+++ b/frontend/app/onboarding/_components/ibm-onboarding.tsx
@@ -3,6 +3,7 @@ import { useState } from "react";
import IBMLogo from "@/components/icons/ibm-logo";
import { LabelInput } from "@/components/label-input";
import { LabelWrapper } from "@/components/label-wrapper";
+import { ModelSelector } from "@/components/models/model-selector";
import { Switch } from "@/components/ui/switch";
import {
Tooltip,
@@ -15,7 +16,6 @@ import { useGetIBMModelsQuery } from "../../api/queries/useGetModelsQuery";
import { useModelSelection } from "../_hooks/useModelSelection";
import { useUpdateSettings } from "../_hooks/useUpdateSettings";
import { AdvancedOnboarding } from "./advanced";
-import { ModelSelector } from "./model-selector";
export function IBMOnboarding({
isEmbedding = false,
diff --git a/frontend/app/onboarding/_components/model-features.tsx b/frontend/app/onboarding/_components/model-features.tsx
deleted file mode 100644
index e0b7d014d..000000000
--- a/frontend/app/onboarding/_components/model-features.tsx
+++ /dev/null
@@ -1,208 +0,0 @@
-"use client";
-
-import {
- Braces,
- Brain,
- Cpu,
- Database,
- Eye,
- FileText,
- Globe,
- ListChecks,
- type LucideIcon,
- Mic,
- Wrench,
-} from "lucide-react";
-import type { CatalogModel } from "@/app/settings/_helpers/catalog-models";
-import {
- ALL_CAPABILITIES,
- formatContext,
- formatPrice,
- formatTokens,
- type ModelCapability,
- PRIMARY_CAPABILITIES,
- supports,
-} from "@/app/settings/_helpers/model-info";
-import AiFoundryLogo from "@/components/icons/ai-foundry-logo";
-import AnthropicLogo from "@/components/icons/anthropic-logo";
-import AzureOpenAILogo from "@/components/icons/azure-openai-logo";
-import IBMLogo from "@/components/icons/ibm-logo";
-import OllamaLogo from "@/components/icons/ollama-logo";
-import OpenAILogo from "@/components/icons/openai-logo";
-import { cn } from "@/lib/utils";
-
-const ICONS: Record<ModelCapability, LucideIcon> = {
- function_calling: Wrench,
- vision: Eye,
- reasoning: Brain,
- structured_output: Braces,
- prompt_caching: Database,
- pdf_input: FileText,
- web_search: Globe,
- audio_input: Mic,
- computer_use: Cpu,
- parallel_tools: ListChecks,
-};
-
-export function CapabilityStrip({ model }: { model: CatalogModel }) {
- return (
- // A visual summary inside a listbox option: the option is named after its
- // model, and the full capability breakdown is announced by `ModelFeatures`
- // once a model is selected. Announcing each icon here would only bury the
- // model name in the option's label.
- <span aria-hidden="true" className="ml-auto flex items-center gap-1">
- {PRIMARY_CAPABILITIES.map(({ key, label }) => {
- const Icon = ICONS[key];
- const enabled = supports(model, key);
- return (
- <span
- key={key}
- title={`${label}: ${enabled ? "supported" : "unsupported"}`}
- className="inline-flex"
- >
- <Icon
- className={cn(
- "h-3.5 w-3.5",
- enabled ? "text-primary" : "text-muted-foreground/35",
- )}
- />
- </span>
- );
- })}
- {formatContext(model.max_input_tokens) && (
- <span className="ml-1 text-xs text-muted-foreground">
- {formatContext(model.max_input_tokens)}
- </span>
- )}
- </span>
- );
-}
-
-function Fact({ label, value }: { label: string; value: string }) {
- return (
- <div className="bg-muted/40 p-2">
- <div className="text-[10px] uppercase tracking-wide text-muted-foreground">
- {label}
- </div>
- <div className="mt-0.5 text-mmd tabular-nums">{value}</div>
- </div>
- );
-}
-
-const PROVIDER_LOGOS: Record<
- string,
- React.ComponentType<{ className?: string }>
-> = {
- openai: OpenAILogo,
- anthropic: AnthropicLogo,
- watsonx: IBMLogo,
- ollama: OllamaLogo,
- // Both Azure rows: `azure_ai` is Foundry, `azure` is Azure OpenAI Service,
- // and Microsoft draws the two differently.
- azure_ai: AiFoundryLogo,
- azure: AzureOpenAILogo,
-};
-
-function ProviderMark({ provider, name }: { provider?: string; name: string }) {
- const Logo = provider ? PROVIDER_LOGOS[provider] : undefined;
- return (
- <span
- aria-hidden="true"
- data-provider={provider}
- className="grid h-16 w-16 shrink-0 place-items-center border border-border bg-white"
- >
- {Logo ? (
- <Logo className="h-10 w-10 text-black" />
- ) : (
- <span className="font-mono text-lg font-semibold tracking-wide text-muted-foreground">
- {(provider || name).slice(0, 2).toUpperCase()}
- </span>
- )}
- </span>
- );
-}
-
-export function ModelFeatures({
- model,
- providerName,
- provider,
-}: {
- model: CatalogModel;
- providerName: string;
- provider?: string;
-}) {
- const facts = [
- ["Provider", providerName],
- ["Context", formatTokens(model.max_input_tokens)],
- ["Max output", formatTokens(model.max_output_tokens)],
- [
- "Input",
- model.input_cost_per_token == null
- ? "—"
- : `${formatPrice(model.input_cost_per_token)} /M`,
- ],
- [
- "Output",
- model.output_cost_per_token == null
- ? "—"
- : `${formatPrice(model.output_cost_per_token)} /M`,
- ],
- ];
- if (model.cache_read_input_token_cost != null) {
- facts.push([
- "Cached input",
- `${formatPrice(model.cache_read_input_token_cost)} /M`,
- ]);
- }
-
- return (
- <div className="space-y-3 border border-border p-3">
- <div className="flex items-center gap-3">
- <ProviderMark provider={provider} name={providerName} />
- <div className="min-w-0">
- <p className="truncate font-medium leading-tight">{model.model}</p>
- <p className="truncate text-mmd text-muted-foreground">
- {providerName}
- </p>
- </div>
- </div>
- <div className="grid grid-cols-2 gap-px bg-border">
- {facts.map(([label, value]) => (
- <Fact key={label} label={label} value={value} />
- ))}
- </div>
- <ul className="flex flex-wrap gap-1.5">
- {ALL_CAPABILITIES.map(({ key, label, hint }) => {
- const Icon = ICONS[key];
- const enabled = supports(model, key);
- return (
- <li
- key={key}
- title={hint}
- className={cn(
- "inline-flex items-center gap-1 border px-1.5 py-0.5 text-xs",
- enabled
- ? "border-primary/40 text-foreground"
- : "border-border text-muted-foreground/50",
- )}
- >
- <Icon className="h-3 w-3" />
- {label}
- </li>
- );
- })}
- </ul>
- {model.mode !== "embedding" && !supports(model, "function_calling") && (
- <p className="border-l-2 border-destructive pl-2 text-mmd text-muted-foreground">
- This model does not advertise function calling, so it may not be able
- to run the OpenRAG agent tools.
- </p>
- )}
- {model.deprecation_date && (
- <p className="border-l-2 border-warning pl-2 text-mmd text-muted-foreground">
- Retires {model.deprecation_date}.
- </p>
- )}
- </div>
- );
-}
diff --git a/frontend/app/onboarding/_components/ollama-onboarding.tsx b/frontend/app/onboarding/_components/ollama-onboarding.tsx
index 1c0c72f38..59fe7b3dd 100644
--- a/frontend/app/onboarding/_components/ollama-onboarding.tsx
+++ b/frontend/app/onboarding/_components/ollama-onboarding.tsx
@@ -3,12 +3,12 @@ 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 { ModelSelector } from "@/components/models/model-selector";
import { useDebouncedValue } from "@/lib/debounce";
import type { OnboardingVariables } from "../../api/mutations/useOnboardingMutation";
import { useGetOllamaModelsQuery } from "../../api/queries/useGetModelsQuery";
import { useModelSelection } from "../_hooks/useModelSelection";
import { useUpdateSettings } from "../_hooks/useUpdateSettings";
-import { ModelSelector } from "./model-selector";
export function OllamaOnboarding({
setSettings,
diff --git a/frontend/app/onboarding/_components/onboarding-card.tsx b/frontend/app/onboarding/_components/onboarding-card.tsx
index b4a103788..14f8a0133 100644
--- a/frontend/app/onboarding/_components/onboarding-card.tsx
+++ b/frontend/app/onboarding/_components/onboarding-card.tsx
@@ -18,12 +18,13 @@ import {
} from "@/app/api/queries/useGetSettingsQuery";
import { useGetTasksQuery } from "@/app/api/queries/useGetTasksQuery";
import type { ProviderHealthResponse } from "@/app/api/queries/useProviderHealthQuery";
+import { useDoclingHealth } from "@/components/docling-health-banner";
import {
EMBEDDING_PROVIDER_ORDER,
getProviderChrome,
LLM_PROVIDER_ORDER,
orderProviders,
-} from "@/app/settings/_helpers/model-helpers";
+} from "@/components/models/model-helpers";
import { Button } from "@/components/ui/button";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
import {
@@ -599,7 +600,7 @@ const OnboardingCard = ({
value={modelProvider}
onValueChange={handleSetModelProvider}
>
- <TabsList className="mb-1 pb-3 w-full justify-start gap-1 overflow-x-auto">
+ <TabsList className="mb-1">
{tabProviders.map((providerKey) => {
const chrome = getProviderChrome(
providerKey,
@@ -616,7 +617,9 @@ const OnboardingCard = ({
error &&
selected &&
"data-[state=active]:border-destructive",
- "min-w-40",
+ // Fixed 3-up basis so every card is the same width
+ // (like a grid) while flex still fills the row.
+ "min-w-52 grow-0 basis-[calc((100%_-_1.5rem)/3)]",
)}
>
<TabTrigger
diff --git a/frontend/app/onboarding/_hooks/useModelSelection.ts b/frontend/app/onboarding/_hooks/useModelSelection.ts
index d6cf4b19d..48ad6272b 100644
--- a/frontend/app/onboarding/_hooks/useModelSelection.ts
+++ b/frontend/app/onboarding/_hooks/useModelSelection.ts
@@ -15,25 +15,44 @@ export function useModelSelection(
if (modelsData !== prevModelsData) {
setPrevModelsData(modelsData);
if (modelsData) {
- if (!languageModel && !isEmbedding) {
- const defaultLangModel = modelsData.language_models.find(
- (m) => m.default,
- );
- if (defaultLangModel) {
- setLanguageModel(defaultLangModel.value);
- } else if (modelsData.language_models.length > 0) {
- setLanguageModel(modelsData.language_models[0].value);
+ if (!isEmbedding) {
+ if (!languageModel) {
+ const defaultLangModel = modelsData.language_models.find(
+ (m) => m.default,
+ );
+ if (defaultLangModel) {
+ setLanguageModel(defaultLangModel.value);
+ } else if (modelsData.language_models.length > 0) {
+ setLanguageModel(modelsData.language_models[0].value);
+ }
+ } else if (
+ modelsData.language_models.length > 0 &&
+ !modelsData.language_models.some((m) => m.value === languageModel)
+ ) {
+ // The list just changed underneath the current pick (a new API
+ // key, a provider swap) and it's no longer offered. Clear it here,
+ // at the point the list itself changes, rather than reactively in
+ // ModelSelector. An empty list is left alone — that's more likely
+ // a transient load than an intentional "nothing is valid anymore".
+ setLanguageModel("");
}
}
- if (!embeddingModel && isEmbedding) {
- const defaultEmbedModel = modelsData.embedding_models.find(
- (m) => m.default,
- );
- if (defaultEmbedModel) {
- setEmbeddingModel(defaultEmbedModel.value);
- } else if (modelsData.embedding_models.length > 0) {
- setEmbeddingModel(modelsData.embedding_models[0].value);
+ if (isEmbedding) {
+ if (!embeddingModel) {
+ const defaultEmbedModel = modelsData.embedding_models.find(
+ (m) => m.default,
+ );
+ if (defaultEmbedModel) {
+ setEmbeddingModel(defaultEmbedModel.value);
+ } else if (modelsData.embedding_models.length > 0) {
+ setEmbeddingModel(modelsData.embedding_models[0].value);
+ }
+ } else if (
+ modelsData.embedding_models.length > 0 &&
+ !modelsData.embedding_models.some((m) => m.value === embeddingModel)
+ ) {
+ setEmbeddingModel("");
}
}
}
diff --git a/frontend/app/settings/_components/agent-settings-section.tsx b/frontend/app/settings/_components/agent-settings-section.tsx
index 8210c8d78..645f65a36 100644
--- a/frontend/app/settings/_components/agent-settings-section.tsx
+++ b/frontend/app/settings/_components/agent-settings-section.tsx
@@ -8,6 +8,13 @@ import { useGetModelCatalogQuery } from "@/app/api/queries/useGetModelsQuery";
import { useGetSettingsQuery } from "@/app/api/queries/useGetSettingsQuery";
import { ConfirmationDialog } from "@/components/confirmation-dialog";
import { LabelWrapper } from "@/components/label-wrapper";
+import {
+ findGroupedSelection,
+ groupedCatalogOptions,
+} from "@/components/models/catalog-models";
+import { ModelFeatures } from "@/components/models/model-features";
+import { getModelLogo } from "@/components/models/model-helpers";
+import { ModelSelector } from "@/components/models/model-selector";
import { RequirePermission } from "@/components/require-permission";
import { Button } from "@/components/ui/button";
import {
@@ -26,13 +33,6 @@ import { DEFAULT_AGENT_SETTINGS, UI_CONSTANTS } from "@/lib/constants";
import { resolveLangflowEditUrl } from "@/lib/url-utils";
import { cn } from "@/lib/utils";
import { useUpdateSettingsMutation } from "../../api/mutations/useUpdateSettingsMutation";
-import { ModelFeatures } from "../../onboarding/_components/model-features";
-import { ModelSelector } from "../../onboarding/_components/model-selector";
-import {
- findGroupedSelection,
- groupedCatalogOptions,
-} from "../_helpers/catalog-models";
-import { getModelLogo } from "../_helpers/model-helpers";
import { LangflowIcon } from "./langflow-icon";
const { MAX_SYSTEM_PROMPT_CHARS } = UI_CONSTANTS;
@@ -301,7 +301,7 @@ export function AgentSettingsSection() {
</CardHeader>
<CardContent>
<div className="space-y-6">
- <div className="space-y-2">
+ <div className="space-y-6">
<LabelWrapper
label="Language model"
helperText="Model used for chat"
@@ -325,15 +325,13 @@ export function AgentSettingsSection() {
/>
</LabelWrapper>
{settings.agent?.llm_model && selectedLlmGroup && (
- <div className="mt-3">
- <ModelFeatures
- model={
- selectedLlm?.model ?? { model: settings.agent.llm_model }
- }
- providerName={selectedLlmGroup.group}
- provider={selectedLlmGroup.provider}
- />
- </div>
+ <ModelFeatures
+ model={
+ selectedLlm?.model ?? { model: settings.agent.llm_model }
+ }
+ providerName={selectedLlmGroup.group}
+ provider={selectedLlmGroup.provider}
+ />
)}
</div>
<div className="space-y-2">
diff --git a/frontend/app/settings/_components/anthropic-settings-dialog.tsx b/frontend/app/settings/_components/anthropic-settings-dialog.tsx
index e21fccdcf..ffa2de369 100644
--- a/frontend/app/settings/_components/anthropic-settings-dialog.tsx
+++ b/frontend/app/settings/_components/anthropic-settings-dialog.tsx
@@ -9,6 +9,10 @@ import { useGetAnthropicModelsQuery } from "@/app/api/queries/useGetModelsQuery"
import { useGetSettingsQuery } from "@/app/api/queries/useGetSettingsQuery";
import type { ProviderHealthResponse } from "@/app/api/queries/useProviderHealthQuery";
import AnthropicLogo from "@/components/icons/anthropic-logo";
+import {
+ canRemoveProvider,
+ isProviderConfigured,
+} from "@/components/models/model-helpers";
import { Button } from "@/components/ui/button";
import {
Dialog,
@@ -17,10 +21,6 @@ import {
DialogTitle,
} from "@/components/ui/dialog";
import { useAuth } from "@/contexts/auth-context";
-import {
- canRemoveProvider,
- isProviderConfigured,
-} from "../_helpers/model-helpers";
import {
AnthropicSettingsForm,
type AnthropicSettingsFormData,
diff --git a/frontend/app/settings/_components/ingest-settings-section.tsx b/frontend/app/settings/_components/ingest-settings-section.tsx
index b756198fb..5c86476e9 100644
--- a/frontend/app/settings/_components/ingest-settings-section.tsx
+++ b/frontend/app/settings/_components/ingest-settings-section.tsx
@@ -11,6 +11,19 @@ import {
import { useGetSettingsQuery } from "@/app/api/queries/useGetSettingsQuery";
import { ConfirmationDialog } from "@/components/confirmation-dialog";
import { LabelWrapper } from "@/components/label-wrapper";
+import {
+ findGroupedSelection,
+ groupedCatalogOptions,
+ LIVE_INVENTORY_PROVIDERS,
+ liveModelOption,
+ mergeLiveCatalogOptions,
+} from "@/components/models/catalog-models";
+import { ModelFeatures } from "@/components/models/model-features";
+import { getModelLogo } from "@/components/models/model-helpers";
+import {
+ type GroupedModelOption,
+ ModelSelector,
+} from "@/components/models/model-selector";
import { RequirePermission } from "@/components/require-permission";
import { Button } from "@/components/ui/button";
import {
@@ -45,19 +58,6 @@ import { DEFAULT_KNOWLEDGE_SETTINGS } from "@/lib/constants";
import { resolveLangflowEditUrl } from "@/lib/url-utils";
import { cn } from "@/lib/utils";
import { useUpdateSettingsMutation } from "../../api/mutations/useUpdateSettingsMutation";
-import { ModelFeatures } from "../../onboarding/_components/model-features";
-import {
- type GroupedModelOption,
- ModelSelector,
-} from "../../onboarding/_components/model-selector";
-import {
- findGroupedSelection,
- groupedCatalogOptions,
- LIVE_INVENTORY_PROVIDERS,
- liveModelOption,
- mergeLiveCatalogOptions,
-} from "../_helpers/catalog-models";
-import { getModelLogo } from "../_helpers/model-helpers";
import { LangflowIcon } from "./langflow-icon";
const DEFAULT_WATSONX_API_VERSION = "2023-05-29";
diff --git a/frontend/app/settings/_components/model-provider-card.tsx b/frontend/app/settings/_components/model-provider-card.tsx
index 8ea8d089f..fe011b5f8 100644
--- a/frontend/app/settings/_components/model-provider-card.tsx
+++ b/frontend/app/settings/_components/model-provider-card.tsx
@@ -1,11 +1,11 @@
"use client";
+import type { ModelProvider } from "@/components/models/model-helpers";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { useIsCloudBrand } from "@/contexts/brand-context";
import { trackButton } from "@/lib/analytics";
import { cn } from "@/lib/utils";
-import type { ModelProvider } from "../_helpers/model-helpers";
import CardIcon from "./card-icon";
export interface ModelProviderCardData {
diff --git a/frontend/app/settings/_components/model-providers.tsx b/frontend/app/settings/_components/model-providers.tsx
index 8fcf06c5b..a7c06491f 100644
--- a/frontend/app/settings/_components/model-providers.tsx
+++ b/frontend/app/settings/_components/model-providers.tsx
@@ -4,12 +4,12 @@ import { useRouter, useSearchParams } from "next/navigation";
import { useEffect, useMemo, useState } from "react";
import { useGetModelProvidersQuery } from "@/app/api/queries/useGetModelProvidersQuery";
import { useGetSettingsQuery } from "@/app/api/queries/useGetSettingsQuery";
-import { useProviderHealth } from "@/components/provider-health-banner";
-import { useAuth } from "@/contexts/auth-context";
import {
getProviderChrome,
type ModelProvider,
-} from "../_helpers/model-helpers";
+} from "@/components/models/model-helpers";
+import { useProviderHealth } from "@/components/provider-health-banner";
+import { useAuth } from "@/contexts/auth-context";
import AnthropicSettingsDialog from "./anthropic-settings-dialog";
import ModelProviderCard from "./model-provider-card";
import OllamaSettingsDialog from "./ollama-settings-dialog";
diff --git a/frontend/app/settings/_components/ollama-settings-dialog.tsx b/frontend/app/settings/_components/ollama-settings-dialog.tsx
index c929f33bf..ef77f02d4 100644
--- a/frontend/app/settings/_components/ollama-settings-dialog.tsx
+++ b/frontend/app/settings/_components/ollama-settings-dialog.tsx
@@ -13,6 +13,10 @@ import { useGetOllamaModelsQuery } from "@/app/api/queries/useGetModelsQuery";
import { useGetSettingsQuery } from "@/app/api/queries/useGetSettingsQuery";
import type { ProviderHealthResponse } from "@/app/api/queries/useProviderHealthQuery";
import OllamaLogo from "@/components/icons/ollama-logo";
+import {
+ canRemoveProvider,
+ isProviderConfigured,
+} from "@/components/models/model-helpers";
import { Button } from "@/components/ui/button";
import {
Dialog,
@@ -21,10 +25,6 @@ import {
DialogTitle,
} from "@/components/ui/dialog";
import { useAuth } from "@/contexts/auth-context";
-import {
- canRemoveProvider,
- isProviderConfigured,
-} from "../_helpers/model-helpers";
import ModelProviderDialogFooter from "./model-provider-dialog-footer";
import {
OllamaSettingsForm,
diff --git a/frontend/app/settings/_components/openai-settings-dialog.tsx b/frontend/app/settings/_components/openai-settings-dialog.tsx
index dd9b3ff30..20d7202b0 100644
--- a/frontend/app/settings/_components/openai-settings-dialog.tsx
+++ b/frontend/app/settings/_components/openai-settings-dialog.tsx
@@ -13,6 +13,10 @@ import { useGetOpenAIModelsQuery } from "@/app/api/queries/useGetModelsQuery";
import { useGetSettingsQuery } from "@/app/api/queries/useGetSettingsQuery";
import type { ProviderHealthResponse } from "@/app/api/queries/useProviderHealthQuery";
import OpenAILogo from "@/components/icons/openai-logo";
+import {
+ canRemoveProvider,
+ isProviderConfigured,
+} from "@/components/models/model-helpers";
import { Button } from "@/components/ui/button";
import {
Dialog,
@@ -21,10 +25,6 @@ import {
DialogTitle,
} from "@/components/ui/dialog";
import { useAuth } from "@/contexts/auth-context";
-import {
- canRemoveProvider,
- isProviderConfigured,
-} from "../_helpers/model-helpers";
import ModelProviderDialogFooter from "./model-provider-dialog-footer";
import {
OpenAISettingsForm,
diff --git a/frontend/app/settings/_components/provider-settings-dialog.tsx b/frontend/app/settings/_components/provider-settings-dialog.tsx
index 40e80b1d6..08854d6f7 100644
--- a/frontend/app/settings/_components/provider-settings-dialog.tsx
+++ b/frontend/app/settings/_components/provider-settings-dialog.tsx
@@ -12,6 +12,12 @@ import {
} from "@/app/api/mutations/useUpdateSettingsMutation";
import { useGetModelCatalogQuery } from "@/app/api/queries/useGetModelsQuery";
import { useGetSettingsQuery } from "@/app/api/queries/useGetSettingsQuery";
+import type { CatalogCredentialField } from "@/components/models/catalog-models";
+import {
+ canRemoveProvider,
+ getProviderChrome,
+ type ModelProvider,
+} from "@/components/models/model-helpers";
import {
Dialog,
DialogContent,
@@ -19,12 +25,6 @@ import {
DialogTitle,
} from "@/components/ui/dialog";
import { useAuth } from "@/contexts/auth-context";
-import type { CatalogCredentialField } from "../_helpers/catalog-models";
-import {
- canRemoveProvider,
- getProviderChrome,
- type ModelProvider,
-} from "../_helpers/model-helpers";
import ModelProviderDialogFooter from "./model-provider-dialog-footer";
import {
ProviderSettingsForm,
diff --git a/frontend/app/settings/_components/provider-settings-form.tsx b/frontend/app/settings/_components/provider-settings-form.tsx
index 03091140b..2da3a4649 100644
--- a/frontend/app/settings/_components/provider-settings-form.tsx
+++ b/frontend/app/settings/_components/provider-settings-form.tsx
@@ -1,6 +1,6 @@
import { useFormContext } from "react-hook-form";
-import type { CatalogCredentialField } from "@/app/settings/_helpers/catalog-models";
import { LabelWrapper } from "@/components/label-wrapper";
+import type { CatalogCredentialField } from "@/components/models/catalog-models";
import { Input } from "@/components/ui/input";
import { Textarea } from "@/components/ui/textarea";
diff --git a/frontend/app/settings/_components/watsonx-settings-dialog.tsx b/frontend/app/settings/_components/watsonx-settings-dialog.tsx
index a78c14e05..322276a4c 100644
--- a/frontend/app/settings/_components/watsonx-settings-dialog.tsx
+++ b/frontend/app/settings/_components/watsonx-settings-dialog.tsx
@@ -13,6 +13,10 @@ import { useGetIBMModelsQuery } from "@/app/api/queries/useGetModelsQuery";
import { useGetSettingsQuery } from "@/app/api/queries/useGetSettingsQuery";
import type { ProviderHealthResponse } from "@/app/api/queries/useProviderHealthQuery";
import IBMLogo from "@/components/icons/ibm-logo";
+import {
+ canRemoveProvider,
+ isProviderConfigured,
+} from "@/components/models/model-helpers";
import { Button } from "@/components/ui/button";
import {
Dialog,
@@ -21,10 +25,6 @@ import {
DialogTitle,
} from "@/components/ui/dialog";
import { useAuth } from "@/contexts/auth-context";
-import {
- canRemoveProvider,
- isProviderConfigured,
-} from "../_helpers/model-helpers";
import ModelProviderDialogFooter from "./model-provider-dialog-footer";
import {
WatsonxSettingsForm,
diff --git a/frontend/app/settings/_components/watsonx-settings-form.tsx b/frontend/app/settings/_components/watsonx-settings-form.tsx
index a5cc16497..37153f582 100644
--- a/frontend/app/settings/_components/watsonx-settings-form.tsx
+++ b/frontend/app/settings/_components/watsonx-settings-form.tsx
@@ -1,6 +1,6 @@
import { Controller, useFormContext } from "react-hook-form";
-import { ModelSelector } from "@/app/onboarding/_components/model-selector";
import { LabelWrapper } from "@/components/label-wrapper";
+import { ModelSelector } from "@/components/models/model-selector";
import { Input } from "@/components/ui/input";
export interface WatsonxSettingsFormData {
diff --git a/frontend/components/cloud-picker/ingest-settings.tsx b/frontend/components/cloud-picker/ingest-settings.tsx
index b5f352c95..795ca9ef0 100644
--- a/frontend/components/cloud-picker/ingest-settings.tsx
+++ b/frontend/components/cloud-picker/ingest-settings.tsx
@@ -4,14 +4,14 @@ import { ChevronRight } from "lucide-react";
import { useMemo } from "react";
import { useGetModelCatalogQuery } from "@/app/api/queries/useGetModelsQuery";
import { useGetSettingsQuery } from "@/app/api/queries/useGetSettingsQuery";
-import type { ModelOption } from "@/app/onboarding/_components/model-selector";
-import { groupedCatalogOptions } from "@/app/settings/_helpers/catalog-models";
+import { LabelWrapper } from "@/components/label-wrapper";
+import { groupedCatalogOptions } from "@/components/models/catalog-models";
import {
getFallbackModels,
type ModelProvider,
-} from "@/app/settings/_helpers/model-helpers";
-import { ModelSelectItems } from "@/app/settings/_helpers/model-select-item";
-import { LabelWrapper } from "@/components/label-wrapper";
+} from "@/components/models/model-helpers";
+import { ModelSelectItems } from "@/components/models/model-select-item";
+import type { ModelOption } from "@/components/models/model-selector";
import {
Collapsible,
CollapsibleContent,
diff --git a/frontend/components/icons/azure-openai-logo.tsx b/frontend/components/icons/azure-openai-logo.tsx
index 8b8762f4b..533ca9dd3 100644
--- a/frontend/components/icons/azure-openai-logo.tsx
+++ b/frontend/components/icons/azure-openai-logo.tsx
@@ -2,9 +2,8 @@
* Azure OpenAI Service, as Microsoft draws it (az-icons.com/icon/azure-openai).
*
* Distinct from `ai-foundry-logo`: Microsoft draws the two Azure model services
- * differently. The gradient id is fixed rather than generated: every instance
- * defines the same stops, so when a page renders several of these and the
- * browser resolves `url(#...)` to the first one, they all paint identically.
+ * differently. Painted with `currentColor`, like `anthropic-logo`/`openai-logo`,
+ * so it can go from grayscale to full color by changing the parent's text color.
*/
export default function AzureOpenAILogo(props: React.SVGProps<SVGSVGElement>) {
return (
@@ -12,28 +11,13 @@ export default function AzureOpenAILogo(props: React.SVGProps<SVGSVGElement>) {
xmlns="http://www.w3.org/2000/svg"
width="16"
height="16"
- viewBox="0 0 18 18"
- fill="none"
+ viewBox="0 0 16 16"
{...props}
>
<title>Azure OpenAI Logo</title>
- <defs>
- <radialGradient
- id="azure-openai-mark"
- cx="-67.981"
- cy="793.199"
- r=".45"
- gradientTransform="translate(-17939.03 20368.029) rotate(45) scale(25.091 -34.149)"
- gradientUnits="userSpaceOnUse"
- >
- <stop offset="0" stopColor="#83b9f9" />
- <stop offset="1" stopColor="#0078d4" />
- </radialGradient>
- </defs>
<path
- d="m0,2.7v12.6c0,1.491,1.209,2.7,2.7,2.7h12.6c1.491,0,2.7-1.209,2.7-2.7V2.7c0-1.491-1.209-2.7-2.7-2.7H2.7C1.209,0,0,1.209,0,2.7ZM10.8,0v3.6c0,3.976,3.224,7.2,7.2,7.2h-3.6c-3.976,0-7.199,3.222-7.2,7.198v-3.598c0-3.976-3.224-7.2-7.2-7.2h3.6c3.976,0,7.2-3.224,7.2-7.2Z"
- fill="url(#azure-openai-mark)"
- strokeWidth="0"
+ d="M0 2.4V13.6C0 14.93 1.07 16 2.4 16H13.6C14.93 16 16 14.93 16 13.6V2.4C16 1.07 14.93 0 13.6 0H2.4C1.07 0 0 1.07 0 2.4ZM9.6 0V3.2C9.6 6.73 12.47 9.6 16 9.6H12.8C9.27 9.6 6.4 12.46 6.4 16V12.8C6.4 9.27 3.53 6.4 0 6.4H3.2C6.73 6.4 9.6 3.53 9.6 0Z"
+ fill="currentColor"
/>
</svg>
);
diff --git a/frontend/components/models/capability-icons.ts b/frontend/components/models/capability-icons.ts
new file mode 100644
index 000000000..41ef2e767
--- /dev/null
+++ b/frontend/components/models/capability-icons.ts
@@ -0,0 +1,31 @@
+import {
+ Braces,
+ Brain,
+ Cpu,
+ Database,
+ Eye,
+ FileText,
+ Globe,
+ ListChecks,
+ type LucideIcon,
+ Mic,
+ Wrench,
+} from "lucide-react";
+import type { ModelCapability } from "./model-info";
+
+/**
+ * Lucide glyph for each model capability, shared by `CapabilityStrip`
+ * (the compact listbox summary) and `ModelFeatures` (the full breakdown).
+ */
+export const CAPABILITY_ICONS: Record<ModelCapability, LucideIcon> = {
+ function_calling: Wrench,
+ vision: Eye,
+ reasoning: Brain,
+ structured_output: Braces,
+ prompt_caching: Database,
+ pdf_input: FileText,
+ web_search: Globe,
+ audio_input: Mic,
+ computer_use: Cpu,
+ parallel_tools: ListChecks,
+};
diff --git a/frontend/components/models/capability-strip.tsx b/frontend/components/models/capability-strip.tsx
new file mode 100644
index 000000000..2055f1db1
--- /dev/null
+++ b/frontend/components/models/capability-strip.tsx
@@ -0,0 +1,38 @@
+import { cn } from "@/lib/utils";
+import { CAPABILITY_ICONS } from "./capability-icons";
+import type { CatalogModel } from "./catalog-models";
+import { formatContext, PRIMARY_CAPABILITIES, supports } from "./model-info";
+
+export function CapabilityStrip({ model }: { model: CatalogModel }) {
+ return (
+ // A visual summary inside a listbox option: the option is named after its
+ // model, and the full capability breakdown is announced by `ModelFeatures`
+ // once a model is selected. Announcing each icon here would only bury the
+ // model name in the option's label.
+ <span aria-hidden="true" className="ml-auto flex items-center gap-1">
+ {PRIMARY_CAPABILITIES.map(({ key, label }) => {
+ const Icon = CAPABILITY_ICONS[key];
+ const enabled = supports(model, key);
+ return (
+ <span
+ key={key}
+ title={`${label}: ${enabled ? "supported" : "unsupported"}`}
+ className="inline-flex"
+ >
+ <Icon
+ className={cn(
+ "h-3.5 w-3.5",
+ enabled ? "text-primary" : "text-muted-foreground/35",
+ )}
+ />
+ </span>
+ );
+ })}
+ {/* Fixed-width so the capability icons line up across option rows,
+ regardless of the context string ("8K" vs "1M" vs empty). */}
+ <span className="ml-1 w-10 shrink-0 text-right text-xs tabular-nums text-muted-foreground">
+ {formatContext(model.max_input_tokens)}
+ </span>
+ </span>
+ );
+}
diff --git a/frontend/app/settings/_helpers/catalog-models.test.ts b/frontend/components/models/catalog-models.test.ts
similarity index 100%
rename from frontend/app/settings/_helpers/catalog-models.test.ts
rename to frontend/components/models/catalog-models.test.ts
diff --git a/frontend/app/settings/_helpers/catalog-models.ts b/frontend/components/models/catalog-models.ts
similarity index 100%
rename from frontend/app/settings/_helpers/catalog-models.ts
rename to frontend/components/models/catalog-models.ts
diff --git a/frontend/components/models/model-features.tsx b/frontend/components/models/model-features.tsx
new file mode 100644
index 000000000..ac54326d0
--- /dev/null
+++ b/frontend/components/models/model-features.tsx
@@ -0,0 +1,170 @@
+"use client";
+
+import { useId, useState } from "react";
+import AiFoundryLogo from "@/components/icons/ai-foundry-logo";
+import AnthropicLogo from "@/components/icons/anthropic-logo";
+import AzureOpenAILogo from "@/components/icons/azure-openai-logo";
+import IBMLogo from "@/components/icons/ibm-logo";
+import OllamaLogo from "@/components/icons/ollama-logo";
+import OpenAILogo from "@/components/icons/openai-logo";
+import { CAPABILITY_ICONS } from "./capability-icons";
+import type { CatalogModel } from "./catalog-models";
+import {
+ ALL_CAPABILITIES,
+ formatPrice,
+ formatTokens,
+ supports,
+} from "./model-info";
+
+function Fact({ label, value }: { label: string; value: string }) {
+ return (
+ <div className="bg-background px-4 py-3">
+ <div className="text-[10px] uppercase tracking-[0.5px] text-muted-foreground">
+ {label}
+ </div>
+ <div className="mt-0.5 text-mmd tabular-nums">{value}</div>
+ </div>
+ );
+}
+
+const PROVIDER_LOGOS: Record<
+ string,
+ React.ComponentType<{ className?: string }>
+> = {
+ openai: OpenAILogo,
+ anthropic: AnthropicLogo,
+ watsonx: IBMLogo,
+ ollama: OllamaLogo,
+ // Both Azure rows: `azure_ai` is Foundry, `azure` is Azure OpenAI Service,
+ // and Microsoft draws the two differently.
+ azure_ai: AiFoundryLogo,
+ azure: AzureOpenAILogo,
+};
+
+function ProviderMark({ provider, name }: { provider?: string; name: string }) {
+ const Logo = provider ? PROVIDER_LOGOS[provider] : undefined;
+ return (
+ <span
+ aria-hidden="true"
+ data-provider={provider}
+ className="grid size-9 shrink-0 place-items-center rounded-[4px] bg-muted/60"
+ >
+ {Logo ? (
+ <Logo className="size-5 text-foreground" />
+ ) : (
+ <span className="font-mono text-xs font-semibold tracking-wide text-muted-foreground">
+ {(provider || name).slice(0, 2).toUpperCase()}
+ </span>
+ )}
+ </span>
+ );
+}
+
+export function ModelFeatures({
+ model,
+ providerName,
+ provider,
+}: {
+ model: CatalogModel;
+ providerName: string;
+ provider?: string;
+}) {
+ const [showDetails, setShowDetails] = useState(false);
+ const detailsId = useId();
+ const supportedCapabilities = ALL_CAPABILITIES.filter(({ key }) =>
+ supports(model, key),
+ );
+
+ const facts = [
+ ["Provider", providerName],
+ ["Context", formatTokens(model.max_input_tokens)],
+ ["Max output", formatTokens(model.max_output_tokens)],
+ [
+ "Input",
+ model.input_cost_per_token == null
+ ? "—"
+ : `${formatPrice(model.input_cost_per_token)} /M`,
+ ],
+ [
+ "Output",
+ model.output_cost_per_token == null
+ ? "—"
+ : `${formatPrice(model.output_cost_per_token)} /M`,
+ ],
+ ];
+ if (model.cache_read_input_token_cost != null) {
+ facts.push([
+ "Cached input",
+ `${formatPrice(model.cache_read_input_token_cost)} /M`,
+ ]);
+ }
+
+ return (
+ <div className="divide-y divide-border border border-border">
+ {/* Header row — provider mark, model name, and the details toggle.
+ Always visible; mirrors the compact Figma design. */}
+ <div className="flex items-center gap-3 bg-muted/40 px-4 py-3">
+ <ProviderMark provider={provider} name={providerName} />
+ <p className="min-w-0 flex-1 truncate font-medium leading-tight">
+ {model.model}
+ </p>
+ <button
+ type="button"
+ onClick={() => setShowDetails((open) => !open)}
+ aria-expanded={showDetails}
+ aria-controls={detailsId}
+ className="shrink-0 text-mmd text-primary hover:underline"
+ >
+ {showDetails ? "Hide details" : "View details"}
+ </button>
+ </div>
+ {showDetails && (
+ <div id={detailsId} className="bg-background">
+ <div className="grid grid-cols-2 gap-px bg-border">
+ {facts.map(([label, value]) => (
+ <Fact key={label} label={label} value={value} />
+ ))}
+ {/* Odd fact count leaves one grid cell empty; without a filler
+ it shows the grid's own bg-border instead of a cell background. */}
+ {facts.length % 2 === 1 && (
+ <div aria-hidden="true" className="bg-background px-4 py-3" />
+ )}
+ </div>
+ <div className="space-y-2 px-4 py-3 empty:hidden">
+ {model.mode !== "embedding" &&
+ !supports(model, "function_calling") && (
+ <p className="border-l-2 border-destructive pl-2 text-mmd text-muted-foreground">
+ This model does not advertise function calling, so it may not
+ be able to run the OpenRAG agent tools.
+ </p>
+ )}
+ {model.deprecation_date && (
+ <p className="border-l-2 border-warning pl-2 text-mmd text-muted-foreground">
+ Retires {model.deprecation_date}.
+ </p>
+ )}
+ </div>
+ </div>
+ )}
+ {/* Capability chips — only the capabilities this model supports, as in
+ the design. Omit the row entirely rather than show an empty box. */}
+ {supportedCapabilities.length > 0 && (
+ <ul className="flex flex-wrap gap-2 px-4 py-3">
+ {supportedCapabilities.map(({ key, label, hint }) => {
+ const Icon = CAPABILITY_ICONS[key];
+ return (
+ <li
+ key={key}
+ title={hint}
+ className="inline-flex items-center gap-1 rounded-full border border-border px-2 py-1 text-xs text-foreground"
+ >
+ <Icon className="size-3" />
+ {label}
+ </li>
+ );
+ })}
+ </ul>
+ )}
+ </div>
+ );
+}
diff --git a/frontend/app/settings/_helpers/model-helpers.test.ts b/frontend/components/models/model-helpers.test.ts
similarity index 100%
rename from frontend/app/settings/_helpers/model-helpers.test.ts
rename to frontend/components/models/model-helpers.test.ts
diff --git a/frontend/app/settings/_helpers/model-helpers.tsx b/frontend/components/models/model-helpers.tsx
similarity index 98%
rename from frontend/app/settings/_helpers/model-helpers.tsx
rename to frontend/components/models/model-helpers.tsx
index f1fd0432f..de449795e 100644
--- a/frontend/app/settings/_helpers/model-helpers.tsx
+++ b/frontend/components/models/model-helpers.tsx
@@ -155,8 +155,8 @@ const PROVIDER_CHROME: Record<string, ProviderChrome> = {
logoBgColor: "bg-[#1063FE]",
},
// Microsoft draws the two Azure model services differently, and neither is
- // the generic Azure logo. Both marks paint their own gradients, so logoColor
- // does nothing for them and the tile stays white.
+ // the generic Azure logo. AiFoundryLogo paints its own gradient, so
+ // logoColor does nothing for it and the tile stays white.
azure_ai: {
name: "Azure AI Foundry",
logo: AiFoundryLogo,
@@ -166,7 +166,7 @@ const PROVIDER_CHROME: Record<string, ProviderChrome> = {
azure: {
name: "Azure OpenAI",
logo: AzureOpenAILogo,
- logoColor: "text-black",
+ logoColor: "text-[#0078D4]",
logoBgColor: "bg-white",
},
local: {
diff --git a/frontend/app/settings/_helpers/model-info.ts b/frontend/components/models/model-info.ts
similarity index 100%
rename from frontend/app/settings/_helpers/model-info.ts
rename to frontend/components/models/model-info.ts
diff --git a/frontend/app/settings/_helpers/model-select-item.tsx b/frontend/components/models/model-select-item.tsx
similarity index 100%
rename from frontend/app/settings/_helpers/model-select-item.tsx
rename to frontend/components/models/model-select-item.tsx
diff --git a/frontend/app/onboarding/_components/model-selector.tsx b/frontend/components/models/model-selector.tsx
similarity index 93%
rename from frontend/app/onboarding/_components/model-selector.tsx
rename to frontend/components/models/model-selector.tsx
index 891299127..10622d4d1 100644
--- a/frontend/app/onboarding/_components/model-selector.tsx
+++ b/frontend/components/models/model-selector.tsx
@@ -1,11 +1,9 @@
"use client";
import { CheckIcon, ChevronsUpDownIcon } from "lucide-react";
-import { useDeferredValue, useEffect, useId, useMemo, useState } from "react";
-import type { CatalogModel } from "@/app/settings/_helpers/catalog-models";
-import { MODELS_PER_PROVIDER } from "@/app/settings/_helpers/model-info";
+import { useDeferredValue, useId, useMemo, useState } from "react";
import { Badge } from "@/components/ui/badge";
-import { Button, type ButtonProps } from "@/components/ui/button";
+import { Button } from "@/components/ui/button";
import {
Command,
CommandGroup,
@@ -19,40 +17,21 @@ import {
PopoverTrigger,
} from "@/components/ui/popover";
import { cn } from "@/lib/utils";
-import { CapabilityStrip } from "./model-features";
+import { CapabilityStrip } from "./capability-strip";
+import { MODELS_PER_PROVIDER } from "./model-info";
+import type {
+ GroupedModelOption,
+ ModelOption,
+ ModelSelectorProps,
+} from "./types";
-export type ModelOption = {
- value: string;
- label: string;
- default?: boolean;
- provider?: string;
- model?: CatalogModel;
- icon?: React.ReactNode;
-};
-
-export type GroupedModelOption = {
- group: string;
- /** Provider key for custom entries typed under this group. */
- provider?: string;
- options: ModelOption[];
- icon?: React.ReactNode;
-};
-
-export interface ModelSelectorProps extends ButtonProps {
- options?: ModelOption[];
- groupedOptions?: GroupedModelOption[];
- value: string;
- /** Disambiguates the same model id hosted by more than one vendor. */
- selectedProvider?: string;
- icon?: React.ReactNode;
- placeholder?: string;
- searchPlaceholder?: string;
- noOptionsPlaceholder?: string;
- custom?: boolean;
- onValueChange: (value: string, provider?: string) => void;
- hasError?: boolean;
- defaultOpen?: boolean;
-}
+// Re-exported so existing `from "@/components/models/model-selector"` imports
+// keep working; the definitions themselves live in `./types` now.
+export type {
+ GroupedModelOption,
+ ModelOption,
+ ModelSelectorProps,
+} from "./types";
function optionProvider(
option: ModelOption,
@@ -166,9 +145,12 @@ export function ModelSelector({
return next;
});
- // Flatten grouped options or use regular options
- const allOptions =
- groupedOptions?.flatMap((group) => group.options) || options || [];
+ // Flatten grouped options or use regular options. Memoized so the effect
+ // below (which depends on allOptions) doesn't re-run on every render.
+ const allOptions = useMemo(
+ () => groupedOptions?.flatMap((group) => group.options) || options || [],
+ [groupedOptions, options],
+ );
const allowCustomEntry = !!custom;
const selectedOptionGroup = groupedOptions?.find((group) =>
@@ -254,18 +236,6 @@ export function ModelSelector({
? (visibleGroups?.length ?? 0) > 0 || showUngroupedCustomEntry
: visibleOptions.length > 0 || showFlatCustomEntry;
- useEffect(() => {
- if (
- allOptions.length > 0 &&
- value &&
- value !== "" &&
- !allOptions.some((option) => option.value === value) &&
- !custom
- ) {
- onValueChange("");
- }
- }, [allOptions, value, custom, onValueChange]);
-
return (
<Popover open={open} onOpenChange={setOpen} modal={false}>
<PopoverTrigger asChild>
diff --git a/frontend/components/models/types.ts b/frontend/components/models/types.ts
new file mode 100644
index 000000000..80dab834c
--- /dev/null
+++ b/frontend/components/models/types.ts
@@ -0,0 +1,35 @@
+import type { ButtonProps } from "@/components/ui/button";
+import type { CatalogModel } from "./catalog-models";
+
+export type ModelOption = {
+ value: string;
+ label: string;
+ default?: boolean;
+ provider?: string;
+ model?: CatalogModel;
+ icon?: React.ReactNode;
+};
+
+export type GroupedModelOption = {
+ group: string;
+ /** Provider key for custom entries typed under this group. */
+ provider?: string;
+ options: ModelOption[];
+ icon?: React.ReactNode;
+};
+
+export interface ModelSelectorProps extends ButtonProps {
+ options?: ModelOption[];
+ groupedOptions?: GroupedModelOption[];
+ value: string;
+ /** Disambiguates the same model id hosted by more than one vendor. */
+ selectedProvider?: string;
+ icon?: React.ReactNode;
+ placeholder?: string;
+ searchPlaceholder?: string;
+ noOptionsPlaceholder?: string;
+ custom?: boolean;
+ onValueChange: (value: string, provider?: string) => void;
+ hasError?: boolean;
+ defaultOpen?: boolean;
+}
diff --git a/frontend/components/provider-health-banner.tsx b/frontend/components/provider-health-banner.tsx
index 655bc4e7e..10342803f 100644
--- a/frontend/components/provider-health-banner.tsx
+++ b/frontend/components/provider-health-banner.tsx
@@ -3,7 +3,7 @@
import { AlertTriangle } from "lucide-react";
import { useRouter } from "next/navigation";
import { useProviderHealthQuery } from "@/app/api/queries/useProviderHealthQuery";
-import { getProviderChrome } from "@/app/settings/_helpers/model-helpers";
+import { getProviderChrome } from "@/components/models/model-helpers";
import { Banner, BannerIcon, BannerTitle } from "@/components/ui/banner";
import { useChat } from "@/contexts/chat-context";
import { cn } from "@/lib/utils";
diff --git a/frontend/components/ui/tabs.tsx b/frontend/components/ui/tabs.tsx
index 4369135e6..3a9313cb3 100644
--- a/frontend/components/ui/tabs.tsx
+++ b/frontend/components/ui/tabs.tsx
@@ -15,7 +15,7 @@ function TabsList({
<TabsPrimitive.List
ref={ref}
className={cn(
- "inline-flex h-fit gap-3 items-center justify-center p-0 text-muted-foreground w-full",
+ "flex h-fit w-full flex-wrap items-stretch gap-3 p-0 text-muted-foreground",
className,
)}
{...props}
diff --git a/frontend/enhancements/connectors/azure-blob/settings-form.tsx b/frontend/enhancements/connectors/azure-blob/settings-form.tsx
index a979bb610..9fef4fd7c 100644
--- a/frontend/enhancements/connectors/azure-blob/settings-form.tsx
+++ b/frontend/enhancements/connectors/azure-blob/settings-form.tsx
@@ -80,8 +80,8 @@ export function AzureBlobSettingsForm({
onAuthModeChange?.();
}}
>
- <TabsList className="w-full">
- <TabsTrigger value="connection_string">
+ <TabsList className="w-full flex-nowrap">
+ <TabsTrigger value="connection_string" className="flex-1">
<span className="font-semibold text-sm">
Connection String
</span>
@@ -89,7 +89,7 @@ export function AzureBlobSettingsForm({
Single paste-in string
</span>
</TabsTrigger>
- <TabsTrigger value="account_key">
+ <TabsTrigger value="account_key" className="flex-1">
<span className="font-semibold text-sm">Account Key</span>
<span className="text-xs text-muted-foreground font-normal">
Account name + key
diff --git a/frontend/enhancements/connectors/ibm-cos/settings-form.tsx b/frontend/enhancements/connectors/ibm-cos/settings-form.tsx
index c647be561..63f21839e 100644
--- a/frontend/enhancements/connectors/ibm-cos/settings-form.tsx
+++ b/frontend/enhancements/connectors/ibm-cos/settings-form.tsx
@@ -7,6 +7,7 @@ import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
+import { cn } from "@/lib/utils";
export interface IBMCOSFormData {
auth_mode: "iam" | "hmac";
@@ -82,8 +83,8 @@ export function IBMCOSSettingsForm({
field.onChange(v);
}}
>
- <TabsList className="w-full">
- <TabsTrigger value="hmac">
+ <TabsList className="w-full flex-nowrap">
+ <TabsTrigger value="hmac" className="flex-1">
<span className="font-semibold text-sm">HMAC</span>
<span className="text-xs text-muted-foreground font-normal">
Access Key + Secret Key
@@ -92,7 +93,10 @@ export function IBMCOSSettingsForm({
<TabsTrigger
value="iam"
disabled={disableIam}
- className={disableIam ? "opacity-40 cursor-not-allowed" : ""}
+ className={cn(
+ "flex-1",
+ disableIam && "opacity-40 cursor-not-allowed",
+ )}
title={
disableIam
? "IAM mode is disabled. Set OPENRAG_IBM_COS_IAM_UI=true to enable."