🎬 火宝短剧 - 基于AI的一站式短剧生成平台 《一句话生成完整短剧,从剧本到成片全自动化》 Huobao Drama - An AI-Powered End-to-End Short Drama Generator "One Sentence to Complete Drama: Fully Automated from Script to Final Video"
TypeScript
fix: preserve original images for video generation references
Connor8419ff301f13
diff --git a/backend/src/services/generation.ts b/backend/src/services/generation.tsindex a2401a6..c513355 100644--- a/backend/src/services/generation.ts+++ b/backend/src/services/generation.ts@@ -6,7 +6,7 @@ import { db, getInsertId, schema } from '../db/index.js'import { eq } from 'drizzle-orm'import { getActiveConfig, getConfigById } from './ai.js'import { now } from '../utils/response.js'-import { downloadFile, fetchImageAsCompressedDataUrl, generateImageThumb, readImageAsCompressedDataUrl, saveBase64Image } from '../utils/storage.js'+import { downloadFile, fetchImageAsCompressedDataUrl, generateImageThumb, readImageAsCompressedDataUrl, readImageAsDataUrl, saveBase64Image } from '../utils/storage.js'import { extractVideoPoster } from '../utils/video-poster.js'import { getImageAdapter, getVideoAdapter } from './adapters/registry'import type { AIConfig } from './adapters/types'@@ -529,11 +529,8 @@ async function normalizeVideoReferenceUrl(value: string | null | undefined): Proif (raw.startsWith('static/') || raw.startsWith('/static/')) {const localPath = raw.startsWith('/static/') ? raw.slice(1) : rawtry {- return await readImageAsCompressedDataUrl(localPath, {- maxWidth: 768,- maxHeight: 768,- quality: 68,- })+ // 视频参考图直接编码原文件,保留原始尺寸、格式、透明通道和画质。+ return readImageAsDataUrl(localPath)} catch (err) {logTaskWarn('VideoTask', 'reference-read-failed', { path: localPath, error: (err as Error).message })return null