diff --git a/src/components/TemplateCard/index.tsx b/src/components/TemplateCard/index.tsx
index f5d243b..f921966 100644
--- a/src/components/TemplateCard/index.tsx
+++ b/src/components/TemplateCard/index.tsx
@@ -18,12 +18,12 @@ export default function TemplateCard({ template, onClick }: TemplateCardProps) {
// 检测output是否为视频
const isOutputVideo = useMemo(() => {
- return /\.(mp4|webm|ogg|mov|avi|mkv|flv)$/i.test(template.outputExampleUrl);
+ return /\.(mp4|webm|ogg|mov|avi|mkv|flv)$/i.test(template.outputExampleUrl || '');
}, [template.outputExampleUrl]);
// 检测input是否为视频
const isInputVideo = useMemo(() => {
- return /\.(mp4|webm|ogg|mov|avi|mkv|flv)$/i.test(template.inputExampleUrl);
+ return /\.(mp4|webm|ogg|mov|avi|mkv|flv)$/i.test(template.inputExampleUrl || ``);
}, [template.inputExampleUrl]);
const handleClick = () => {
@@ -86,10 +86,10 @@ export default function TemplateCard({ template, onClick }: TemplateCardProps) {
{isOutputVideo ? (
// 当output是视频时,只显示单个视频
-
+
) : (
-
+
)}
@@ -138,7 +138,7 @@ export default function TemplateCard({ template, onClick }: TemplateCardProps) {
clipPath: `polygon(${splitPosition}% 0%, 100% 0%, 100% 100%, ${splitPosition}% 100%)`,
}}
>
-
+
{/* 可拖拽的分割线 */}
diff --git a/src/pages/home/index.tsx b/src/pages/home/index.tsx
index 906aeeb..063a95a 100644
--- a/src/pages/home/index.tsx
+++ b/src/pages/home/index.tsx
@@ -92,7 +92,7 @@ export default function Home() {
const handleTemplateClick = async (template: Template) => {
try {
// 第一步:选择并上传图片
- const imageCount = template.templateType === '2image-to-video' ? 2 : 1;
+ const imageCount = template.code === '2image-to-video' ? 2 : 1;
const imageUrl = await sdk.chooseAndUploadImage({
count: imageCount,
onImageSelected: () => {
diff --git a/src/pages/result/index.tsx b/src/pages/result/index.tsx
index 90b76b7..41ad505 100644
--- a/src/pages/result/index.tsx
+++ b/src/pages/result/index.tsx
@@ -30,9 +30,9 @@ const ResultPage: React.FC = () => {
return;
} else if (result.status === 'failed') {
// 任务失败,停止轮询并设置错误
- setError(result.error || result.errorMessage || '任务执行失败');
+ setError('任务执行失败');
return;
- } else if (result.status === 'processing' || result.status === 'pending') {
+ } else if (result.status === 'running' || result.status === 'pending') {
// 任务仍在进行中,继续轮询
if (attempts < maxAttempts) {
timerRef.current = setTimeout(poll, 1000);