dedupe canvas agent model entry
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled

This commit is contained in:
Your Name 2026-03-08 20:53:25 +08:00
parent 14ee1cfdaa
commit 76c684ff82

View File

@ -2724,10 +2724,11 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
allModels.filter(
(model) =>
model.id !== "auto" &&
model.id !== modelsData?.agentModel?.id &&
model.isMultimodal &&
!VIDEO_PROVIDER_TYPES.has(model.providerType)
),
[allModels]
[allModels, modelsData?.agentModel?.id]
);
const videoOnlyModels = useMemo(
() => visualModels.filter((model) => VIDEO_PROVIDER_TYPES.has(model.providerType)),
@ -2775,7 +2776,6 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
SMART_AUTO_MODEL;
const agentDisplayName =
currentModel?.displayName || selectDisplayModel?.displayName || "Agent模式";
const agentAvatarUrl = currentModel?.avatarUrl || selectDisplayModel?.avatarUrl || null;
const videoFrameSlots = useMemo(() => {
if (!isVideoModel || !videoParams) return [] as string[];
if (videoParams.mode === "first-last-frame") return ["首帧", "尾帧"] as string[];
@ -8857,31 +8857,6 @@ export function CanvasChatPanel({ chatId, initialMessages = [], onClose, onOpenF
</div>
<div className="flex items-center gap-2 flex-shrink-0">
{activeComposerMode === "agent" ? (
<div
className="h-8 w-8 overflow-hidden rounded-full border border-[#cfd4dc] bg-white flex items-center justify-center"
title={agentDisplayName}
aria-label={agentDisplayName}
>
{agentAvatarUrl ? (
<img
src={buildPreviewImageUrl(agentAvatarUrl, 64)}
alt={agentDisplayName}
className="h-full w-full object-cover"
loading="lazy"
decoding="async"
onError={(event) => {
if (event.currentTarget.src !== agentAvatarUrl) {
event.currentTarget.src = agentAvatarUrl;
}
}}
/>
) : (
<Sparkles className="h-4 w-4 text-[#8b95a7]" />
)}
</div>
) : null}
{activeComposerMode === "image" ? (
<Button
variant="ghost"