[AI Chat]: Add Beta label to Near Models (#32369)
Will now display a Beta label for Near models in Model Selectors
This commit is contained in:
@@ -39,6 +39,17 @@ const ModelContent = (props: ModelContentProps) => {
|
||||
</Label>
|
||||
)
|
||||
}
|
||||
if (model.isNearModel) {
|
||||
return (
|
||||
<Label
|
||||
mode='outline'
|
||||
color='neutral'
|
||||
className={styles.modelLabel}
|
||||
>
|
||||
{getLocale(S.CHAT_UI_MODEL_BETA_LABEL)}
|
||||
</Label>
|
||||
)
|
||||
}
|
||||
if (
|
||||
model.options.leoModelOptions?.access === Mojom.ModelAccess.PREMIUM
|
||||
&& showPremiumLabel
|
||||
|
||||
@@ -310,7 +310,7 @@ describe('ModelSelector', () => {
|
||||
expect(alert).toHaveTextContent('CHAT_UI_AGENT_MODE_MODEL_INFO')
|
||||
},
|
||||
)
|
||||
it('should display near icon for near models', async () => {
|
||||
it('should display near icon and beta label for near models', async () => {
|
||||
render(<ModelSelector />)
|
||||
|
||||
// Make sure the anchor button is visible
|
||||
@@ -327,11 +327,13 @@ describe('ModelSelector', () => {
|
||||
|
||||
// Make sure the default menu items are visible
|
||||
const menuItems = document.querySelectorAll<HTMLElement>('leo-menu-item')
|
||||
expect(menuItems[2]).toHaveTextContent('Premium Model')
|
||||
const nearMenuItem = menuItems[2]
|
||||
|
||||
// Check that the beta label is visible
|
||||
expect(nearMenuItem).toHaveTextContent('CHAT_UI_MODEL_BETA_LABEL')
|
||||
|
||||
// Check that the near icon is present in the Premium Model menu item
|
||||
const premiumMenuItem = within(menuItems[2])
|
||||
const nearIcon = premiumMenuItem.getByRole('img')
|
||||
const nearIcon = within(nearMenuItem).getByRole('img')
|
||||
expect(nearIcon).toHaveClass('nearIcon')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -147,6 +147,9 @@
|
||||
<message name="IDS_CHAT_UI_MODEL_LOCAL_LABEL" desc="Label identifying that an AI Chat model is a local model" formatter_data="webui=AiChat">
|
||||
Local
|
||||
</message>
|
||||
<message name="IDS_CHAT_UI_MODEL_BETA_LABEL" desc="Label identifying that an AI Chat model is a Beta model" formatter_data="webui=AiChat">
|
||||
Beta
|
||||
</message>
|
||||
<message name="IDS_CHAT_UI_RECOMMENDED_MODELS_BUTTON" desc="Button label to show recommended models" formatter_data="webui=AiChat">
|
||||
Recommended models
|
||||
</message>
|
||||
|
||||
Reference in New Issue
Block a user