From b30d0ff0696415f36736467947046b6e8d298b79 Mon Sep 17 00:00:00 2001 From: clawdbot Date: Wed, 28 Jan 2026 04:47:00 +0800 Subject: [PATCH] refactor(sdk): improve goView video/iframe inference --- packages/sdk/src/core/goview/convert.ts | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/packages/sdk/src/core/goview/convert.ts b/packages/sdk/src/core/goview/convert.ts index b245def..9f45616 100644 --- a/packages/sdk/src/core/goview/convert.ts +++ b/packages/sdk/src/core/goview/convert.ts @@ -421,17 +421,26 @@ export function convertGoViewProjectToScreen(input: GoViewProjectLike | GoViewSt // Important: run media/embed checks before text checks. // Some goView/fork widgets have misleading keys that contain "text" even though // the option payload is clearly video/iframe. + // 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 optionSaysVideo = looksLikeVideoOption(option); + const optionSaysIframe = looksLikeIframeOption(option); + const inferredType: 'text' | 'image' | 'iframe' | 'video' | undefined = isImage(c) || looksLikeImageOption(option) ? 'image' - : // Important: run video checks before iframe checks; iframe URL detection is broader. - isVideo(c) || looksLikeVideoOption(option) + : optionSaysVideo ? 'video' - : isIframe(c) || looksLikeIframeOption(option) + : optionSaysIframe ? 'iframe' - : isTextCommon(c) - ? 'text' - : undefined; + : isVideo(c) + ? 'video' + : isIframe(c) + ? 'iframe' + : isTextCommon(c) + ? 'text' + : undefined; const defaults = inferredType === 'text'