diff --git a/src/components/image-editor/ImageCanvasMetadataModalView.test.tsx b/src/components/image-editor/ImageCanvasMetadataModalView.test.tsx
index cd1aaf265..2ca6814df 100644
--- a/src/components/image-editor/ImageCanvasMetadataModalView.test.tsx
+++ b/src/components/image-editor/ImageCanvasMetadataModalView.test.tsx
@@ -380,6 +380,65 @@ describe('ImageCanvasMetadataModalView', () => {
expect(within(dialog).queryByText('1234')).toBeNull();
});
+ it('keeps the task id display tied to the resource kind across asset tag overrides', () => {
+ // 中文注释:素材标签只改 assetKindOverride,资源原始类型才是展示口径的依据。背景音乐被
+ // 改标成「音效」不该换用完整 id,音效被改标成「背景音乐」更不能退回截断假值。
+ const { unmount } = render(
+ ,
+ );
+
+ const musicDialog = screen.getByRole('dialog', { name: '音频信息' });
+ expect(within(musicDialog).getByText('75')).toBeTruthy();
+ expect(within(musicDialog).queryByText('audio-task-75')).toBeNull();
+ unmount();
+
+ render(
+ ,
+ );
+
+ const soundEffectDialog = screen.getByRole('dialog', { name: '音频信息' });
+ expect(
+ within(soundEffectDialog).getByText('task-sfx-v2-1234-abcd'),
+ ).toBeTruthy();
+ expect(within(soundEffectDialog).queryByText('1234')).toBeNull();
+ });
+
it('does not render a dialog when no layer is selected', () => {
render();
diff --git a/src/components/image-editor/ImageCanvasMetadataModalView.tsx b/src/components/image-editor/ImageCanvasMetadataModalView.tsx
index 7a9237bd9..c3385dda8 100644
--- a/src/components/image-editor/ImageCanvasMetadataModalView.tsx
+++ b/src/components/image-editor/ImageCanvasMetadataModalView.tsx
@@ -1,4 +1,5 @@
import { UnifiedModal } from '../common/UnifiedModal';
+import { resolveLayerResourceAssetKind } from './ImageCanvasEditorModel';
import type { CanvasLayer } from './ImageCanvasEditorTypes';
import { formatTaskIdForDisplay } from './ImageCanvasExportModel';
import {
@@ -106,10 +107,12 @@ export function ImageCanvasMetadataModalView({
Task
{/* 中文注释:音效的 taskId 是 operation id 形态,`formatTaskIdForDisplay` 的
- 「取最后一段数字」会把它截成 `0` 这类误导值。判据取图层自身的 assetKind,
- 不再依赖 soundEffect 元数据是否解析成功——元数据一旦缺失,Task 这一栏不该
- 跟着降级成假值。 */}
- {layer.assetKind === 'sound-effect' ||
+ 「取最后一段数字」会把它截成 `0` 这类误导值。判据必须落在资源原始类型上:
+ `layer.assetKind` 是 `assetKindOverride ?? resourceAssetKind`,用户在画布上
+ 改一次「素材标签」就能让音效层显示成截断假值、让背景音乐层改用完整 id。
+ soundEffect 那一支只是补充——它和 action 一样长在 generationInputs 上,元数据
+ 整块缺失时会一并消失,而那正是这里要兜住的场景。 */}
+ {resolveLayerResourceAssetKind(layer) === 'sound-effect' ||
layer.generationInputs?.soundEffect?.schemaVersion === 2
? layer.taskId || '-'
: formatTaskIdForDisplay(layer.taskId)}