fix(ai): 产物地址兼容字符串元素,创意助手与助手页链接可复制
video_result/photo_files 的元素可能直接是地址字符串,原实现按对象取 url, 字符串元素一律取空——视频有文件却不播放、复制链接永远为空。
This commit is contained in:
@@ -197,7 +197,8 @@
|
||||
import type { FileRecord } from '@/api/system/file/model';
|
||||
import type {
|
||||
CreativeAssistantOutputs,
|
||||
CreativeAssistantResponse
|
||||
CreativeAssistantResponse,
|
||||
CreativeFileList
|
||||
} from '@/api/ai/creativeAssistant/model';
|
||||
import { copyText } from '@/utils/common';
|
||||
import { resolveDisplayText, isFailedPayload, FAILED_TEXT } from '@/utils/ai-result';
|
||||
@@ -227,9 +228,27 @@
|
||||
return !!content.value.trim();
|
||||
});
|
||||
|
||||
const videoFiles = computed(() => workflowOutputs.value?.video_result || []);
|
||||
/**
|
||||
* 文件列表兜底:上游可能给成单个对象或裸地址字符串,不是数组时当一项处理,
|
||||
* 否则视频区直接空掉(见禅道 bug #1)。
|
||||
*/
|
||||
const asFileList = (
|
||||
value?: CreativeFileList | null
|
||||
): Partial<FileRecord>[] => {
|
||||
const items = !value ? [] : Array.isArray(value) ? value : [value];
|
||||
// 裸地址统一包成 { url },下游的 resolveFileUrl / getFileName 不必各自判类型。
|
||||
return items.map((item) =>
|
||||
typeof item === 'string' ? { url: item } : item
|
||||
);
|
||||
};
|
||||
|
||||
const videoFiles = computed(() =>
|
||||
asFileList(workflowOutputs.value?.video_result)
|
||||
);
|
||||
const scriptMarkdown = computed(() => workflowOutputs.value?.Script_result || '');
|
||||
const photoFiles = computed(() => workflowOutputs.value?.photo_files || []);
|
||||
const photoFiles = computed(() =>
|
||||
asFileList(workflowOutputs.value?.photo_files)
|
||||
);
|
||||
const statusMessage = computed(() => {
|
||||
// 失败态优先:后端失败时 outputs 为空,若不先判失败,用户既看不到正文
|
||||
// 也看不到原因,只有一个 toast 一闪而过(见 issue 10)。
|
||||
|
||||
Reference in New Issue
Block a user