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.
// Some goView/fork widgets mislabel embedded platforms (YouTube/Vimeo/etc) as "Video" even
// though they are best represented as an iframe.
const optionSaysImage = looksLikeImageOption(option);
const optionSaysVideo = looksLikeVideoOption(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 =
isImage(c) || looksLikeImageOption(option)
? 'image'
: optionSaysIframe
optionSaysIframe
? 'iframe'
: optionSaysVideo
? 'video'
: optionSaysImage
? 'image'
: isIframe(c)
? 'iframe'
: isVideo(c)
? 'video'
: isImage(c)
? 'image'
: isTextCommon(c)
? 'text'
: undefined;