fix(webui): show provider logos in model notices
This commit is contained in:
1 parent
448767d147
commit
8473538e7a
4 files changed
+48
-6
No files matched your search
@@ -1,11 +1,13 @@
|
||||
import { ArrowRightLeft, KeyRound, X } from "lucide-react";
|
||||
import { X } from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { PresetProviderIcon } from "@/components/thread/ModelPresetBadge";
|
||||
|
||||
/** A live fallback is informative, not a failed message or a changed preset. */
|
||||
export function ModelFallbackNotice({ model, reauthProviderLabel, onDismiss, onOpenSettings }: {
|
||||
export function ModelFallbackNotice({ model, reauthProvider, reauthProviderLabel, onDismiss, onOpenSettings }: {
|
||||
model: string;
|
||||
reauthProvider?: string;
|
||||
reauthProviderLabel?: string;
|
||||
onDismiss: () => void;
|
||||
onOpenSettings?: () => void;
|
||||
@@ -16,9 +18,12 @@ export function ModelFallbackNotice({ model, reauthProviderLabel, onDismiss, onO
|
||||
role="status"
|
||||
className="mx-auto mb-2 flex w-full max-w-[49.5rem] items-start gap-2 rounded-control border border-border/60 bg-muted/40 px-3 py-2 text-xs text-foreground/80 animate-in fade-in-0 slide-in-from-bottom-1 motion-reduce:animate-none"
|
||||
>
|
||||
{reauthProviderLabel
|
||||
? <KeyRound className="mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-400" aria-hidden />
|
||||
: <ArrowRightLeft className="mt-0.5 h-3.5 w-3.5 shrink-0 text-amber-600 dark:text-amber-400" aria-hidden />}
|
||||
<PresetProviderIcon
|
||||
provider={reauthProvider}
|
||||
label={reauthProviderLabel || model}
|
||||
testId="model-fallback-notice-logo"
|
||||
isHero={false}
|
||||
/>
|
||||
<div className="flex min-w-0 flex-1 flex-wrap items-baseline gap-x-3 gap-y-1 leading-5">
|
||||
<span className="min-w-0 break-words [overflow-wrap:anywhere]">
|
||||
{reauthProviderLabel ? <>
|
||||
|
||||
@@ -584,7 +584,7 @@ function SetupPromptLabel({ label }: { label: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
function PresetProviderIcon({
|
||||
export function PresetProviderIcon({
|
||||
label,
|
||||
modelDetail,
|
||||
provider,
|
||||
|
||||
@@ -1559,6 +1559,7 @@ export function ThreadShell({
|
||||
{modelFallback?.chatId === chatId && !modelFallback.dismissed ? (
|
||||
<ModelFallbackNotice
|
||||
model={modelFallback.model}
|
||||
reauthProvider={modelFallback.reauthProvider}
|
||||
reauthProviderLabel={modelFallback.reauthProvider
|
||||
? providerDisplayLabel(settings?.providers ?? [], modelFallback.reauthProvider)
|
||||
: undefined}
|
||||
|
||||
Reference in new issue
Block a user