From e3e37fe515773413333d5f0d4a9f33e2c13196b7 Mon Sep 17 00:00:00 2001 From: songtianlun Date: Sun, 31 Aug 2025 13:48:02 +0800 Subject: [PATCH] fix image url --- src/app/simulator/[id]/page.tsx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/app/simulator/[id]/page.tsx b/src/app/simulator/[id]/page.tsx index ed0f106..3f2ec8f 100644 --- a/src/app/simulator/[id]/page.tsx +++ b/src/app/simulator/[id]/page.tsx @@ -165,7 +165,7 @@ export default function SimulatorRunPage({ params }: { params: Promise<{ id: str setRun(data) // 如果是图片类型,优先使用 generatedFilePath 获取临时URL - if (data.outputType === 'image') { + if (data.model?.outputType === 'image') { if (data.generatedFilePath) { // 有文件路径,获取临时URL fetchImageUrl(runId) @@ -435,13 +435,13 @@ export default function SimulatorRunPage({ params }: { params: Promise<{ id: str // 对于图片类型,不显示 output 作为文本内容 const currentOutput = (isExecuting && run.status === 'pending') ? streamOutput - : (run?.outputType === 'image' ? '' : run.output) + : (run?.model?.outputType === 'image' ? '' : run.output) // 获取图片数据(使用临时URL或提取的URL) const imageData = generatedImageUrl // 调试:在开发环境中显示图片数据信息 - if (process.env.NODE_ENV === 'development' && run?.outputType === 'image') { + if (process.env.NODE_ENV === 'development' && run?.model?.outputType === 'image') { console.log('Image data info:', { hasGeneratedFilePath: !!run?.generatedFilePath, generatedFilePath: run?.generatedFilePath, @@ -897,7 +897,7 @@ export default function SimulatorRunPage({ params }: { params: Promise<{ id: str {t('generating')} {/* 只在非图片类型时显示流式输出 */} - {run.outputType !== 'image' && ( + {run.model?.outputType !== 'image' && (
)} {/* 图片类型显示等待状态 */} - {run.outputType === 'image' && ( + {run.model?.outputType === 'image' && (
@@ -941,7 +941,7 @@ export default function SimulatorRunPage({ params }: { params: Promise<{ id: str
- ) : (run.outputType === 'image' && imageData) || (run.outputType !== 'image' && currentOutput) ? ( + ) : (run.model?.outputType === 'image' && imageData) || (run.model?.outputType !== 'image' && currentOutput) ? (
@@ -949,7 +949,7 @@ export default function SimulatorRunPage({ params }: { params: Promise<{ id: str
{/* 图片输出 */} - {run.outputType === 'image' && imageData && ( + {run.model?.outputType === 'image' && imageData && (
@@ -1032,7 +1032,7 @@ export default function SimulatorRunPage({ params }: { params: Promise<{ id: str )} {/* 文本输出 - 只在非图片类型时显示 */} - {run.outputType !== 'image' && currentOutput && ( + {run.model?.outputType !== 'image' && currentOutput && (
{currentOutput} @@ -1041,7 +1041,7 @@ export default function SimulatorRunPage({ params }: { params: Promise<{ id: str )} {/* 图片错误状态 */} - {run.outputType === 'image' && imageData && imageLoadError && ( + {run.model?.outputType === 'image' && imageData && imageLoadError && (
@@ -1069,7 +1069,7 @@ export default function SimulatorRunPage({ params }: { params: Promise<{ id: str )} {/* 图片加载中状态 */} - {run.outputType === 'image' && !imageData && isLoadingImage && ( + {run.model?.outputType === 'image' && !imageData && isLoadingImage && (
@@ -1089,7 +1089,7 @@ export default function SimulatorRunPage({ params }: { params: Promise<{ id: str
)}
- ) : run.outputType === 'image' && !imageData && !isLoadingImage ? ( + ) : run.model?.outputType === 'image' && !imageData && !isLoadingImage ? (