Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
🪪 feat: Show Each Model's Maker on Its Model List Row (#17246)
Marco Beretta3351272e036e
diff --git a/client/src/components/Chat/Menus/Endpoints/components/EndpointModelItem.tsx b/client/src/components/Chat/Menus/Endpoints/components/EndpointModelItem.tsxindex e3f0cadcbd..6975a83beb 100644--- a/client/src/components/Chat/Menus/Endpoints/components/EndpointModelItem.tsx+++ b/client/src/components/Chat/Menus/Endpoints/components/EndpointModelItem.tsx@@ -1,10 +1,12 @@-import React from 'react';+import React, { useMemo } from 'react';import { Pin, PinOff } from 'lucide';import { MorphIcon } from '@librechat/client';import { VisuallyHidden } from '@ariakit/react';import { CheckCircle2, EarthIcon } from 'lucide-react';import { isAgentsEndpoint, isAssistantsEndpoint } from 'librechat-data-provider';import type { Endpoint } from '~/common';+import { resolveProviderIcon } from '~/hooks/Endpoint/useProviderIcon';+import { createEndpointIcon } from '~/hooks/Endpoint/useEndpoints';import { useModelSelectorContext } from '../ModelSelectorContext';import { CustomMenuItem as MenuItem } from '../CustomMenu';import useActiveItem from '../useActiveItem';@@ -38,7 +40,7 @@ function EndpointModelItemComponent({setSize,}: EndpointModelItemProps) {const localize = useLocalize();- const { handleSelectModel, selectedValues } = useModelSelectorContext();+ const { handleSelectModel, selectedValues, endpointsConfig } = useModelSelectorContext();const {endpoint: selectedEndpoint,model: selectedModel,@@ -72,28 +74,40 @@ function EndpointModelItemComponent({onToggleFavorite(modelId);};- const renderAvatar = () => {- const isAgentOrAssistant =- isAgentsEndpoint(endpoint.value) || isAssistantsEndpoint(endpoint.value);- const showEndpointIcon = isAgentOrAssistant && endpoint.icon;-- const getContent = () => {- if (avatarUrl) {- return <img src={avatarUrl} alt={modelName ?? ''} className="h-full w-full object-cover" />;- }- if (showEndpointIcon) {- return endpoint.icon;- }- return null;- };+ const isAgentOrAssistant =+ isAgentsEndpoint(endpoint.value) || isAssistantsEndpoint(endpoint.value);++ /** A gateway lists models from many makers, so each row shows its own maker's mark. */+ const modelIcon = useMemo(+ () =>+ isAgentOrAssistant || !modelId+ ? null+ : createEndpointIcon(+ endpoint.value,+ resolveProviderIcon({ endpoint: endpoint.value, endpointsConfig }),+ modelId,+ ),+ [isAgentOrAssistant, endpoint.value, endpointsConfig, modelId],+ );- const content = getContent();+ const renderAvatar = () => {+ if (avatarUrl) {+ return (+ <div className="flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden rounded-full">+ <img src={avatarUrl} alt={modelName ?? ''} className="h-full w-full object-cover" />+ </div>+ );+ }+ /** Decorative: the row is named by the model, and the mark would prefix that name. */+ const content = isAgentOrAssistant ? endpoint.icon : modelIcon;if (!content) {return null;}-return (- <div className="flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden rounded-full">+ <div+ aria-hidden={isAgentOrAssistant ? undefined : true}+ className="flex h-5 w-5 shrink-0 items-center justify-center overflow-hidden rounded-full"+ >{content}</div>);diff --git a/client/src/components/Chat/Menus/Endpoints/components/__tests__/EndpointModelItem.test.tsx b/client/src/components/Chat/Menus/Endpoints/components/__tests__/EndpointModelItem.test.tsxindex 822bb5c3c8..1ee9f92088 100644--- a/client/src/components/Chat/Menus/Endpoints/components/__tests__/EndpointModelItem.test.tsx+++ b/client/src/components/Chat/Menus/Endpoints/components/__tests__/EndpointModelItem.test.tsx@@ -1,14 +1,20 @@+import { ProviderId } from 'librechat-data-provider';import { render, screen } from '@testing-library/react';+import type { TEndpointsConfig } from 'librechat-data-provider';import type { Endpoint, SelectedValues } from '~/common';import { EndpointModelItem } from '../EndpointModelItem';const mockHandleSelectModel = jest.fn();let mockSelectedValues: SelectedValues;+const mockEndpointsConfig = {+ OpenRouter: { order: 1, providerId: ProviderId.openrouter },+} as unknown as TEndpointsConfig;jest.mock('~/components/Chat/Menus/Endpoints/ModelSelectorContext', () => ({useModelSelectorContext: () => ({handleSelectModel: mockHandleSelectModel,selectedValues: mockSelectedValues,+ endpointsConfig: mockEndpointsConfig,}),}));@@ -92,4 +98,48 @@ describe('EndpointModelItem', () => {const menuItem = screen.getByRole('menuitem');expect(menuItem).not.toHaveAttribute('aria-selected');});++ describe('model icon', () => {+ const openRouter: Endpoint = {+ value: 'OpenRouter',+ label: 'OpenRouter',+ hasModels: true,+ icon: null,+ };++ beforeEach(() => {+ mockSelectedValues = { endpoint: '', model: '', modelSpec: '' };+ });++ it.each([+ ['google/gemini-2.5-pro', 'Gemini'],+ ['anthropic/claude-sonnet-4.5', 'Anthropic'],+ ['openrouter/auto', 'OpenRouter'],+ ])('shows the maker of %s on a gateway row', (modelId, label) => {+ renderItem({ endpoint: openRouter, modelId });+ expect(screen.getByRole('img', { name: label, hidden: true })).toBeInTheDocument();+ });++ it('shows the provider mark on a first-party row', () => {+ renderItem();+ expect(screen.getByRole('img', { name: 'Anthropic', hidden: true })).toBeInTheDocument();+ });++ it('keeps the mark out of the row accessible name', () => {+ renderItem();+ expect(screen.queryByRole('img')).not.toBeInTheDocument();+ });++ it('prefers a configured model avatar over the maker mark', () => {+ renderItem({+ endpoint: { ...openRouter, modelIcons: { 'openai/gpt-5': '/avatars/gpt.png' } },+ modelId: 'openai/gpt-5',+ });+ expect(screen.getByRole('img', { name: 'openai/gpt-5' })).toHaveAttribute(+ 'src',+ '/avatars/gpt.png',+ );+ expect(screen.queryByRole('img', { name: 'OpenAI', hidden: true })).not.toBeInTheDocument();+ });+ });});diff --git a/e2e/specs/mock/scenarios/model-maker-icons.spec.ts b/e2e/specs/mock/scenarios/model-maker-icons.spec.tsindex a2e72081ca..fc7065d7cb 100644--- a/e2e/specs/mock/scenarios/model-maker-icons.spec.ts+++ b/e2e/specs/mock/scenarios/model-maker-icons.spec.ts@@ -48,3 +48,25 @@ test('A model with no known maker keeps the endpoint icon @scenario:a-model-withawait sendMessageAndWaitForCompletion(page, `Host icon ${Date.now()}`);await expect(messagesView(page).getByRole('img', { name: 'Custom' }).first()).toBeVisible();});++/** Opens an endpoint's model list without choosing a model. */+async function openModelList(page: Page, endpoint: string) {+ await page.goto(NEW_CHAT_PATH, { timeout: 10000 });+ await modelSelectorTrigger(page).click();+ await page.getByRole('option', { name: endpoint }).click();+}++test('Each row of a gateway model list shows its own maker @scenario:model-list-rows-show-each-model-maker', async ({+ page,+}) => {+ await openModelList(page, 'Mock Gemini');+ /** The mark is decorative, so the row keeps the model id as its whole name. */+ const row = page.getByRole('option', { name: /^gemini-2\.5-pro( Pin)?$/ });+ await expect(row).toBeVisible({ timeout: 10000 });+ await expect(row.getByRole('img', { name: 'Gemini', includeHidden: true })).toBeVisible();++ await openModelList(page, 'Mock Provider C');+ const hostRow = page.getByRole('option', { name: /^mock-model-c( Pin)?$/ });+ await expect(hostRow).toBeVisible({ timeout: 10000 });+ await expect(hostRow.getByRole('img', { name: 'Custom', includeHidden: true })).toBeVisible();+});