fix(sdk): prefer option payload for goView iframe/video detection

This commit is contained in:
clawdbot 2026-01-28 06:01:23 +08:00
parent b667b02b79
commit 1d2a712f70

View File

@ -459,20 +459,26 @@ export function convertGoViewProjectToScreen(input: GoViewProjectLike | GoViewSt
// Prefer evidence from the option payload over the widget key. // Prefer evidence from the option payload over the widget key.
// Some goView/fork widgets mislabel embedded platforms (YouTube/Vimeo/etc) as "Video" even // Some goView/fork widgets mislabel embedded platforms (YouTube/Vimeo/etc) as "Video" even
// though they are best represented as an iframe. // though they are best represented as an iframe.
const optionSaysImage = looksLikeImageOption(option);
const optionSaysVideo = looksLikeVideoOption(option); const optionSaysVideo = looksLikeVideoOption(option);
const optionSaysIframe = looksLikeIframeOption(option); const optionSaysIframe = looksLikeIframeOption(option);
// Prefer evidence from the option payload over the widget key.
// Many forks mislabel widget keys (e.g. "Text*" / "Image*"), but the option payload
// clearly indicates iframe/video/image.
const inferredType: 'text' | 'image' | 'iframe' | 'video' | undefined = const inferredType: 'text' | 'image' | 'iframe' | 'video' | undefined =
isImage(c) || looksLikeImageOption(option) optionSaysIframe
? 'image'
: optionSaysIframe
? 'iframe' ? 'iframe'
: optionSaysVideo : optionSaysVideo
? 'video' ? 'video'
: optionSaysImage
? 'image'
: isIframe(c) : isIframe(c)
? 'iframe' ? 'iframe'
: isVideo(c) : isVideo(c)
? 'video' ? 'video'
: isImage(c)
? 'image'
: isTextCommon(c) : isTextCommon(c)
? 'text' ? 'text'
: undefined; : undefined;