mirror of
https://github.com/supabase/supabase.git
synced 2026-12-06 08:29:01 +00:00
## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Feature / chore: hide assistant model selection in the UI and default chats to GPT-5.6 Luna. ## What is the current behavior? The assistant composer exposes a model picker. Paid orgs default to `gpt-5.3-codex`; everyone else defaults to `gpt-5.4-nano`. ## What is the new behavior? - The model picker is hidden in the assistant composer and Explorer home. - Chats default to `gpt-5.6-luna` with `reasoningEffort: medium`. - Model selection plumbing is kept (registry, entitlements, `setModel`, generate-v4 request body) so a requested model can still be honored when provided. - Other completion endpoints still use `gpt-5.4-nano`. ## Additional context Model selector UI can be re-enabled by passing `selectedModel` / `onSelectModel` to `AssistantChatForm`. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added support for the GPT-5.6 Luna model with medium reasoning capability. * Made GPT-5.6 Luna the default assistant model. * **Improvements** * Simplified assistant chat by removing model selection from the primary chat experience. * Updated model fallback behavior to use the standard assistant model. * Chat forms can now optionally display model selection when configured. * **Tests** * Updated model coverage and assistant chat tests for the new defaults and behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
77 lines
2.1 KiB
TypeScript
77 lines
2.1 KiB
TypeScript
import { act, render, screen } from '@testing-library/react'
|
|
import type { PropsWithChildren } from 'react'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
import {
|
|
AiAssistantStateContext,
|
|
createAiAssistantState,
|
|
useAiAssistantChatList,
|
|
type AiAssistantState,
|
|
} from './ai-assistant-state'
|
|
|
|
const ChatList = () => {
|
|
const chats = useAiAssistantChatList()
|
|
|
|
return (
|
|
<ul>
|
|
{chats.map((chat) => (
|
|
<li key={chat.id}>{chat.name}</li>
|
|
))}
|
|
</ul>
|
|
)
|
|
}
|
|
|
|
const renderChatList = (state: AiAssistantState) => {
|
|
const Wrapper = ({ children }: PropsWithChildren) => (
|
|
<AiAssistantStateContext.Provider value={state}>{children}</AiAssistantStateContext.Provider>
|
|
)
|
|
|
|
return render(<ChatList />, { wrapper: Wrapper })
|
|
}
|
|
|
|
describe('useAiAssistantChatList', () => {
|
|
// createChat, createBranch, deleteChat and loadPersistedState all replace state.chats wholesale,
|
|
// so subscribing to the object itself goes stale after the first replacement
|
|
it('rerenders when a chat is created after the first render', async () => {
|
|
const state = createAiAssistantState()
|
|
renderChatList(state)
|
|
|
|
expect(screen.queryByText('Explorer chat')).not.toBeInTheDocument()
|
|
|
|
await act(async () => {
|
|
state.createChat({ name: 'Explorer chat' })
|
|
})
|
|
|
|
expect(await screen.findByText('Explorer chat')).toBeInTheDocument()
|
|
})
|
|
|
|
it('rerenders when chats are replaced by hydration and again when a chat is deleted', async () => {
|
|
const state = createAiAssistantState()
|
|
renderChatList(state)
|
|
|
|
await act(async () => {
|
|
state.loadPersistedState({
|
|
projectRef: 'default',
|
|
activeChatId: 'persisted-chat',
|
|
chats: {
|
|
'persisted-chat': {
|
|
id: 'persisted-chat',
|
|
name: 'Persisted chat',
|
|
messages: [],
|
|
createdAt: new Date(),
|
|
updatedAt: new Date(),
|
|
},
|
|
},
|
|
})
|
|
})
|
|
|
|
expect(await screen.findByText('Persisted chat')).toBeInTheDocument()
|
|
|
|
await act(async () => {
|
|
state.deleteChat('persisted-chat')
|
|
})
|
|
|
|
expect(screen.queryByText('Persisted chat')).not.toBeInTheDocument()
|
|
})
|
|
})
|