diff --git a/components/agents/AgentWorkflowPanelDarkV2.tsx b/components/agents/AgentWorkflowPanelDarkV2.tsx index d7a466a1d..e273b9785 100644 --- a/components/agents/AgentWorkflowPanelDarkV2.tsx +++ b/components/agents/AgentWorkflowPanelDarkV2.tsx @@ -159,17 +159,18 @@ function buildWorkflowOptionPreviewUrl(url?: string | null, sourceUrl?: string | function handleWorkflowOptionPreviewError( event: SyntheticEvent, originalUrl?: string | null -) { +): boolean { const fallbackUrl = String(originalUrl || "").trim(); - if (!fallbackUrl) return; + if (!fallbackUrl) return false; const image = event.currentTarget; if (image.dataset.workflowPreviewFallbackApplied === "1") { - return; + return false; } image.dataset.workflowPreviewFallbackApplied = "1"; image.src = fallbackUrl; + return true; } function appendWorkflowOptionPreviewUrls( @@ -434,7 +435,13 @@ const StepOptionCard = memo(function StepOptionCard({ () => buildWorkflowOptionPreviewUrl(option.previewImageUrl, option.previewImageSourceUrl), [option.previewImageSourceUrl, option.previewImageUrl] ); + const [previewFailed, setPreviewFailed] = useState(false); + useEffect(() => { + setPreviewFailed(false); + }, [previewUrl]); const shouldLoadFast = selected || index < WORKFLOW_OPTION_PREVIEW_EAGER_COUNT; + const hasPreview = Boolean(previewUrl && !previewFailed); + const isAutoConfiguredOption = /根据风格已配置/.test(option.buttonName); return (