-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(site): align AI Settings model provider dropdowns #27391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
f28acd5
4bb418c
e9f36b4
3951dfc
4e0b930
d30afba
bcf7517
5dd5736
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,9 @@ | ||
| import { ServerIcon } from "lucide-react"; | ||
| import { Building2Icon } from "lucide-react"; | ||
| import type { FC } from "react"; | ||
| import { ExternalImage } from "#/components/ExternalImage/ExternalImage"; | ||
| import { normalizeProvider } from "#/modules/aiModels/helpers"; | ||
| import { getProviderIcon } from "#/pages/AISettingsPage/ProvidersPage/components/ProviderIcon"; | ||
| import { cn } from "#/utils/cn"; | ||
| import { formatProviderLabel } from "../../utils/modelOptions"; | ||
|
|
||
| const providerIconMap: Record<string, string> = { | ||
| openai: "/icon/openai.svg", | ||
| anthropic: "/icon/anthropic.svg", | ||
| azure: "/icon/azure.svg", | ||
| bedrock: "/icon/aws.svg", | ||
| google: "/icon/google.svg", | ||
| gemini: "/icon/gemini.svg", | ||
| }; | ||
|
|
||
| interface ProviderIconProps { | ||
| provider: string; | ||
|
|
@@ -23,32 +14,19 @@ export const ProviderIcon: FC<ProviderIconProps> = ({ | |
| provider, | ||
| className, | ||
| }) => { | ||
| const normalized = normalizeProvider(provider); | ||
| const iconPath = providerIconMap[normalized]; | ||
| if (iconPath) { | ||
| return ( | ||
| <div | ||
| className={cn( | ||
| "flex shrink-0 items-center justify-center rounded-full bg-surface-secondary", | ||
| className, | ||
| )} | ||
| > | ||
| <ExternalImage | ||
| src={iconPath} | ||
| alt={`${formatProviderLabel(provider)} logo`} | ||
| className="size-3/5" | ||
| /> | ||
| </div> | ||
| ); | ||
| } | ||
| const iconPath = getProviderIcon(normalizeProvider(provider)); | ||
| return ( | ||
| <div | ||
| className={cn( | ||
| "flex shrink-0 items-center justify-center rounded-full bg-surface-secondary", | ||
| className, | ||
| )} | ||
| > | ||
| <ServerIcon className="size-3/5 text-content-secondary" /> | ||
| {iconPath ? ( | ||
| <ExternalImage src={iconPath} alt="" className="size-3/5" /> | ||
|
DanielleMaywood marked this conversation as resolved.
|
||
| ) : ( | ||
| <Building2Icon className="size-3/5 text-content-secondary" /> | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So if there is no provider icon, what are we showing? Do we have a test for this?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for context: This appears to only be used in the Coder Agents model compaction personal settings page. If there is no ProviderIcon we're showing a building icon. Same fallback as used in the AISettingsPage. When we eventually get round to redesigning the compaction page (it does not look good) we'll likely bin this entire component. As for test coverage on this, it appears we do not have any coverage but I'm not entirely convinced we need it here. |
||
| )} | ||
| </div> | ||
| ); | ||
| }; | ||
Uh oh!
There was an error while loading. Please reload this page.