From 04e5512777f91637a31fd8a278d4c19955605fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Thu, 17 Sep 2026 16:19:26 +0800 Subject: [PATCH] =?UTF-8?q?UI=20=E7=BC=96=E8=BE=91=E5=99=A8=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E8=B5=84=E4=BA=A7=E7=9A=84=20kind=20+=20mediaType=20?= =?UTF-8?q?=E5=88=A4=E6=8D=AE=E6=94=B6=E6=95=9B=E5=88=B0=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E5=A5=91=E7=BA=A6=E5=94=AF=E4=B8=80=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - packages/shared/src/contracts/gameCreationApp.ts:新增 `isGameCreationAppUiDesignDocAsset(asset)`,`kind` 严格解析后再比文档 kind、`mediaType` 比 `application/json`,这是该判据的唯一定义。 - packages/shared/src/contracts/gameCreationApp.test.ts:补用例钉住判据——只满足一半(kind 对 / mediaType 不符、mediaType 对 / kind 不是文档)与 legacy kind(`UI`、`ui`、带空格、大写)一律返回 false。 - apps/ai-game-creator-shell/src/view/project-development/index.tsx:桥接结果校验与「自动打开 ui-workflow 完成资源」两处改用共享判据,删掉本地 kind/mediaType 双条件。 - apps/ai-game-creator-shell/src/features/ui-editor/uiDesignResourceBridge.ts:`findLinkedUiDesignResource` 的过滤条件改用共享判据。 - apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx:缩略图文档分支改用共享判据(原来只看 mediaType,kind 不同也能命中)。 --- .../ResourceReferenceInput.tsx | 4 +-- .../ui-editor/uiDesignResourceBridge.ts | 9 ++--- .../src/view/project-development/index.tsx | 8 ++--- .../src/contracts/gameCreationApp.test.ts | 36 +++++++++++++++++++ .../shared/src/contracts/gameCreationApp.ts | 17 +++++++++ 5 files changed, 60 insertions(+), 14 deletions(-) diff --git a/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx b/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx index 2b25d8d4c..76c357582 100644 --- a/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx +++ b/apps/ai-game-creator-shell/src/features/project-workspace/ResourceReferenceInput.tsx @@ -53,10 +53,10 @@ import { createPortal, flushSync } from 'react-dom'; import { PlatformResourceFilterBar } from '../../../../../packages/shared/src/components/PlatformResourceFilterBar'; import { PlatformSegmentedTabs } from '../../../../../packages/shared/src/components/PlatformSegmentedTabs'; import { - GAME_CREATION_APP_UI_DESIGN_DOC_MEDIA_TYPE, type GameCreationAppAssetManifestEntry, gameCreationAppAssetTags, type GameIterationVersion, + isGameCreationAppUiDesignDocAsset, } from '../../../../../packages/shared/src/contracts/gameCreationApp'; import { resolveTauriInvoke } from '../../app/tauri'; import { @@ -1311,7 +1311,7 @@ function ResourcePickerThumbnail({ if (mediaType.startsWith('image/')) { return