diff --git a/webui/public/brand/provider-icons-NOTICE.txt b/webui/public/brand/provider-icons-NOTICE.txt new file mode 100644 index 000000000..1a6f4abe2 --- /dev/null +++ b/webui/public/brand/provider-icons-NOTICE.txt @@ -0,0 +1,25 @@ +Bundled provider icons: deepseek-color.svg, anthropic.svg, openai.svg, gemini-color.svg. +Source: https://github.com/lobehub/lobe-icons/tree/79b551cf26aab9ea4ac701fb807160950a5b860f/packages/static-svg/icons +Unmodified SVG assets. Brand marks belong to their respective owners. + +MIT License + +Copyright (c) 2023 LobeHub + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/webui/src/assets/providers/anthropic.svg b/webui/src/assets/providers/anthropic.svg new file mode 100644 index 000000000..b93d6a02f --- /dev/null +++ b/webui/src/assets/providers/anthropic.svg @@ -0,0 +1 @@ +Anthropic diff --git a/webui/src/assets/providers/deepseek-color.svg b/webui/src/assets/providers/deepseek-color.svg new file mode 100644 index 000000000..52eec25cd --- /dev/null +++ b/webui/src/assets/providers/deepseek-color.svg @@ -0,0 +1 @@ +DeepSeek diff --git a/webui/src/assets/providers/gemini-color.svg b/webui/src/assets/providers/gemini-color.svg new file mode 100644 index 000000000..0f2e39809 --- /dev/null +++ b/webui/src/assets/providers/gemini-color.svg @@ -0,0 +1 @@ +Gemini diff --git a/webui/src/assets/providers/openai.svg b/webui/src/assets/providers/openai.svg new file mode 100644 index 000000000..8c3e68d52 --- /dev/null +++ b/webui/src/assets/providers/openai.svg @@ -0,0 +1 @@ +OpenAI diff --git a/webui/src/components/settings/overview/OverviewSettings.tsx b/webui/src/components/settings/overview/OverviewSettings.tsx index b09d8222b..f55eae321 100644 --- a/webui/src/components/settings/overview/OverviewSettings.tsx +++ b/webui/src/components/settings/overview/OverviewSettings.tsx @@ -442,6 +442,15 @@ function OverviewValueLogo({ )} aria-hidden > + + {brand.initials} + + + {brand?.initials} + index === listedIndex ? activePreset : preset); const opensSetup = Boolean(onClick); const canSwitch = !opensSetup && Boolean(onPresetChange) && activeName !== "" && presets.length > 1; + const canOpenPicker = !opensSetup && (canSwitch || Boolean(onManageModels)); + const pickerPresets = activeName && onPresetChange ? presets : [activePreset]; const currentIndex = Math.max(0, presets.findIndex((preset) => preset.name === activeName)); const pillHeight = isHero ? 32 : 36; const pillStride = pillHeight + PILL_GAP_PX; @@ -250,6 +252,7 @@ export function ModelPresetBadge({ }; const handleKeyDown = (event: KeyboardEvent) => { + if (!canSwitch) return; const targetByKey: Record = { ArrowUp: currentIndex - 1, ArrowDown: currentIndex + 1, @@ -276,7 +279,7 @@ export function ModelPresetBadge({ ); const Container = opensSetup ? "button" : "span"; - const badge = !canSwitch ? ( + const badge = !canOpenPicker ? ( @@ -388,6 +391,7 @@ export function ModelPresetBadge({ align="end" side="top" sideOffset={10} + collisionPadding={12} role="dialog" aria-label={switchModelLabel} onOpenAutoFocus={(event) => { @@ -407,12 +411,24 @@ export function ModelPresetBadge({
{ + const options = Array.from(event.currentTarget.querySelectorAll('[role="option"]')); + const index = options.indexOf(document.activeElement as HTMLButtonElement); + const targets: Record = { + ArrowUp: index - 1, ArrowDown: index + 1, Home: 0, End: options.length - 1, + }; + const target = targets[event.key]; + if (target === undefined || options.length === 0) return; + event.preventDefault(); + options[wrapIndex(target, options.length)].focus(); + }} className="max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto py-1 scrollbar-thin scrollbar-track-transparent" > - {presets.map((preset) => ( + {pickerPresets.map((preset) => ( @@ -450,10 +466,12 @@ export function ModelPresetBadge({ function PresetOption({ preset, + label, selected, onSelect, }: { preset: ModelPresetOption; + label: string; selected: boolean; onSelect: (name: string) => void; }) { @@ -462,7 +480,7 @@ function PresetOption({