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
🔇 fix: Mute the Create Assistant Empty State in the Assistant Picker (#16338)
Marco Beretta8239583f9dec
diff --git a/client/src/components/SidePanel/Builder/AssistantSelect.tsx b/client/src/components/SidePanel/Builder/AssistantSelect.tsxindex e6c515f407..90023e6409 100644--- a/client/src/components/SidePanel/Builder/AssistantSelect.tsx+++ b/client/src/components/SidePanel/Builder/AssistantSelect.tsx@@ -244,7 +244,8 @@ export default function AssistantSelect({const createAssistant = localize('com_ui_create_assistant');return (<SelectDropDown- value={!value ? createAssistant : value}+ value={value || null}+ placeholder={createAssistant}setValue={createDropdownSetter(onSelect)}availableValues={query.data ?? [diff --git a/e2e/specs/mock/scenarios/assistant-select-empty.spec.ts b/e2e/specs/mock/scenarios/assistant-select-empty.spec.tsnew file mode 100644index 0000000000..a07cd45a59--- /dev/null+++ b/e2e/specs/mock/scenarios/assistant-select-empty.spec.ts@@ -0,0 +1,99 @@+import { expect, test } from '@playwright/test';+import type { Locator, Page } from '@playwright/test';+import { getAccessToken, requestJson } from '../helpers';+import { probeStyle } from './style.helpers';+import { openSidebar } from './sidebar';++/**+ * The Assistant Builder's picker shows "Create Assistant" until an assistant is+ * chosen. That label is an empty state, not a value, so it takes the muted tone+ * `SelectDropDown` gives its placeholder, while a chosen assistant reads as the+ * primary value. Both expected colours are resolved from the app's stylesheet,+ * so the assertions hold in light and dark mode alike.+ */++type CreatedAssistant = { id: string };++const ASSISTANT_NAME = 'E2E muted picker assistant';++async function openBuilder(page: Page): Promise<Locator> {+ await page.goto('/c/new?endpoint=assistants&model=gpt-4o-mini', { timeout: 10000 });+ await openSidebar(page);+ /** The mobile drawer opens on chat history; its panels are items of the Control Panel menu. */+ const controlPanel = page.getByRole('button', { name: 'Control Panel' });+ if (await controlPanel.isVisible()) {+ await controlPanel.click();+ await page.getByRole('menuitemcheckbox', { name: 'Assistant Builder' }).click();+ } else {+ await page.getByRole('button', { name: 'Assistant Builder' }).first().click();+ }+ const picker = page.getByTestId('select-dropdown-button').first();+ await expect(picker).toBeVisible();+ return picker;+}++async function colorOf(locator: Locator): Promise<string> {+ return locator.evaluate((element) => getComputedStyle(element).color);+}++async function createAssistant(page: Page): Promise<CreatedAssistant> {+ await page.goto('/c/new', { timeout: 10000 });+ const token = await getAccessToken(page);+ return requestJson<CreatedAssistant>(page, {+ path: '/api/assistants/v2',+ token,+ method: 'POST',+ body: { endpoint: 'assistants', model: 'gpt-4o-mini', name: ASSISTANT_NAME },+ });+}++async function deleteAssistant(page: Page, assistantId: string) {+ const token = await getAccessToken(page);+ await requestJson(page, {+ path: `/api/assistants/v2/${encodeURIComponent(assistantId)}?endpoint=assistants&model=gpt-4o-mini`,+ token,+ method: 'DELETE',+ body: { endpoint: 'assistants' },+ });+}++test.describe('assistant picker empty state', () => {+ test('the Create Assistant label is muted until an assistant is chosen @scenario:assistant-select-empty-muted', async ({+ page,+ }) => {+ test.setTimeout(60000);+ const assistant = await createAssistant(page);++ try {+ const picker = await openBuilder(page);+ const secondary = await probeStyle(page, 'text-text-secondary', 'color');+ const primary = await probeStyle(page, 'text-text-primary', 'color');+ expect(secondary).not.toBe(primary);++ const chosen = picker.getByText(ASSISTANT_NAME, { exact: true });+ await expect(chosen).toBeVisible();+ expect(await colorOf(chosen)).toBe(primary);++ await picker.click();+ const listbox = page.getByRole('listbox');+ await expect(listbox).toBeVisible();+ const option = listbox.getByRole('option', { name: ASSISTANT_NAME });+ await expect(option.locator('svg')).toHaveCount(1);+ await listbox.getByRole('option', { name: 'Create Assistant' }).click();++ const emptyLabel = picker.getByText('Create Assistant', { exact: true });+ await expect(emptyLabel).toBeVisible();+ await expect(picker.getByText(ASSISTANT_NAME, { exact: true })).toHaveCount(0);+ expect(await colorOf(emptyLabel)).toBe(secondary);++ await picker.focus();+ await page.keyboard.press('Enter');+ await expect(listbox).toBeVisible();+ await expect(option.locator('svg')).toHaveCount(0);+ await page.keyboard.press('Escape');+ await expect(listbox).toBeHidden();+ } finally {+ await deleteAssistant(page, assistant.id);+ }+ });+});diff --git a/packages/client/src/components/SelectDropDown.tsx b/packages/client/src/components/SelectDropDown.tsxindex cba84cb7ce..1bbee715aa 100644--- a/packages/client/src/components/SelectDropDown.tsx+++ b/packages/client/src/components/SelectDropDown.tsx@@ -256,7 +256,7 @@ function SelectDropDown({)}{currentLabel}</span>- {currentValue === activeValue && (+ {value != null && currentValue === activeValue && (<spanclassName={cn('text-text-primary absolute inset-y-0 flex items-center',diff --git a/packages/client/src/components/__tests__/SelectDropDown.spec.tsx b/packages/client/src/components/__tests__/SelectDropDown.spec.tsxnew file mode 100644index 0000000000..b55effe9ed--- /dev/null+++ b/packages/client/src/components/__tests__/SelectDropDown.spec.tsx@@ -0,0 +1,53 @@+import userEvent from '@testing-library/user-event';+import { render, screen } from '@testing-library/react';+import SelectDropDown from '../SelectDropDown';++const OPTIONS = [+ { label: 'Loading...', value: '' },+ { label: 'Second', value: 'second' },+];++async function openList() {+ await userEvent.setup().click(screen.getByTestId('select-dropdown-button'));+}++describe('SelectDropDown', () => {+ it('renders the placeholder in the muted tone when no value is chosen', () => {+ render(+ <SelectDropDown+ value={null}+ setValue={jest.fn()}+ availableValues={OPTIONS}+ placeholder="Create Assistant"+ showLabel={false}+ emptyTitle={true}+ />,+ );++ expect(screen.getByText('Create Assistant')).toHaveClass('text-text-secondary');+ });++ it('does not mark an empty-valued option as selected when no value is chosen', async () => {+ render(+ <SelectDropDown+ value={null}+ setValue={jest.fn()}+ availableValues={OPTIONS}+ placeholder="Create Assistant"+ />,+ );+ await openList();++ const empty = await screen.findByRole('option', { name: 'Loading...' });+ expect(empty.querySelector('svg')).toBeNull();+ });++ it('marks the chosen option as selected', async () => {+ render(<SelectDropDown value={OPTIONS[1]} setValue={jest.fn()} availableValues={OPTIONS} />);+ await openList();++ const chosen = await screen.findByRole('option', { name: 'Second' });+ expect(chosen.querySelector('svg')).not.toBeNull();+ expect(screen.getByRole('option', { name: 'Loading...' }).querySelector('svg')).toBeNull();+ });+});