Skip to content
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

Ensure consistent UX #4222

Merged
merged 3 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 20 additions & 23 deletions web/src/app/admin/configuration/llm/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
IconProps,
OpenAIISVG,
DeepseekIcon,
OpenAISVG,
} from "@/components/icons/icons";

export interface CustomConfigKey {
Expand Down Expand Up @@ -74,7 +75,7 @@ export interface LLMProviderDescriptor {
}

export const getProviderIcon = (providerName: string, modelName?: string) => {
const modelIconMap: Record<
const iconMap: Record<
string,
({ size, className }: IconProps) => JSX.Element
> = {
Expand All @@ -86,34 +87,30 @@ export const getProviderIcon = (providerName: string, modelName?: string) => {
gemini: GeminiIcon,
deepseek: DeepseekIcon,
claude: AnthropicIcon,
anthropic: AnthropicIcon,
openai: OpenAISVG,
microsoft: MicrosoftIconSVG,
meta: MetaIcon,
google: GeminiIcon,
};

const modelNameToIcon = (
modelName: string,
fallbackIcon: ({ size, className }: IconProps) => JSX.Element
): (({ size, className }: IconProps) => JSX.Element) => {
const lowerModelName = modelName?.toLowerCase();
for (const [key, icon] of Object.entries(modelIconMap)) {
if (lowerModelName?.includes(key)) {
// First check if provider name directly matches an icon
if (providerName?.toLowerCase() in iconMap) {
return iconMap[providerName.toLowerCase()];
}

// Then check if model name contains any of the keys
if (modelName) {
const lowerModelName = modelName.toLowerCase();
for (const [key, icon] of Object.entries(iconMap)) {
if (lowerModelName.includes(key)) {
return icon;
}
}
return fallbackIcon;
};

switch (providerName) {
case "openai":
// Special cases for openai based on modelName
return modelNameToIcon(modelName || "", OpenAIISVG);
case "anthropic":
return AnthropicSVG;
case "bedrock":
return AWSIcon;
case "azure":
return AzureIcon;
default:
return modelNameToIcon(modelName || "", CPUIcon);
}

// Fallback to CPU icon if no matches
return CPUIcon;
};

export const isAnthropic = (provider: string, modelName: string) =>
Expand Down
7 changes: 5 additions & 2 deletions web/src/app/admin/indexing/status/FilterComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,10 @@ export const FilterComponent = forwardRef<
hasActiveFilters ? "border-primary bg-primary/5" : ""
}`}
>
<SortIcon size={20} className="text-neutral-800" />
<SortIcon
size={20}
className="text-neutral-800 dark:text-neutral-200"
/>
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent
Expand Down Expand Up @@ -365,7 +368,7 @@ export const FilterComponent = forwardRef<

{hasActiveFilters && (
<div className="absolute -top-1 -right-1">
<Badge className="h-2 bg-red-400 border-red-400 w-2 p-0 border-2 flex items-center justify-center" />
<Badge className="h-2 !bg-red-400 !border-red-400 w-2 p-0 border-2 flex items-center justify-center" />
</div>
)}
</div>
Expand Down
Loading