From 37e72af1fd8c03a12f2d48891fe6eea97b7256d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E5=B8=85?= <2944435683> Date: Tue, 24 Mar 2026 10:18:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=89=AA=E8=BE=91=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/routes/production/getProductionData.ts | 5 +-- .../production/workbench/generateVideo.ts | 2 ++ .../production/workbench/getChatLines.ts | 33 ++++++++++++++----- .../production/workbench/videoPolling.ts | 2 +- src/types/database.d.ts | 19 ++--------- 5 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/routes/production/getProductionData.ts b/src/routes/production/getProductionData.ts index 68d6dff..d8a166d 100644 --- a/src/routes/production/getProductionData.ts +++ b/src/routes/production/getProductionData.ts @@ -42,20 +42,21 @@ export default router.post( .select("o_image.filePath as imageFilePath") .first(); if (row?.imageFilePath) { - return await u.oss.getFileUrl(row.imageFilePath); + return { id: d.id, type: "assets", url: await u.oss.getFileUrl(row.imageFilePath) }; } return null; } if (d.type === "storyboard" && d.id) { const row = await u.db("o_storyboard").where("id", d.id).select("filePath").first(); if (row?.filePath) { - return await u.oss.getFileUrl(row.filePath); + return { id: d.id, type: "storyboard", url: await u.oss.getFileUrl(row.filePath) }; } return null; } return null; }), ); + return { ...item, data: dataWithFilePath, diff --git a/src/routes/production/workbench/generateVideo.ts b/src/routes/production/workbench/generateVideo.ts index dcfbd7d..996f5e9 100644 --- a/src/routes/production/workbench/generateVideo.ts +++ b/src/routes/production/workbench/generateVideo.ts @@ -29,6 +29,8 @@ export default router.post( }), async (req, res) => { const { scriptId, projectId, storyboardId, prompt, data, model, duration, resolution, audio, mode } = req.body; + console.log("%c Line:32 🥤 req.body", "background:#465975", req.body); + const videoPath = `/${projectId}/video/${uuidv4()}.mp4`; //视频保存路径 //新增 const videoData = { diff --git a/src/routes/production/workbench/getChatLines.ts b/src/routes/production/workbench/getChatLines.ts index 3e2b98a..504565b 100644 --- a/src/routes/production/workbench/getChatLines.ts +++ b/src/routes/production/workbench/getChatLines.ts @@ -7,11 +7,30 @@ import { validateFields } from "@/middleware/middleware"; import { Output } from "ai"; const router = express.Router(); -export default router.post("/", validateFields({}), async (req, res) => { - const {} = req.body; -}); +export default router.post( + "/", + validateFields({ + list: z.array( + z.object({ + prompt: z.string(), + videoId: z.number(), + }), + ), + }), + async (req, res) => { + const { list } = req.body; + const data = await Promise.all( + list.map(async (item: any) => { + const output = await getLines(item.prompt); + return { ...item, prompt: output }; + }), + ); + console.log("%c Line:23 🍅 data", "background:#f5ce50", data); + res.status(200).send(success(data)); + }, +); -async function getLines() { +async function getLines(prompt: string) { const resText = await u.Ai.Text("eventExtractAgent").invoke({ messages: [ { @@ -32,9 +51,7 @@ async function getLines() { }, { role: "user", - content: ` - - `, + content: prompt, }, ], output: Output.array({ @@ -44,6 +61,6 @@ async function getLines() { }), }); const parseLines = JSON.parse(resText.text); - const chatLines = parseLines.elements.map((i) => i.lines); + const chatLines = parseLines.elements.map((i: any) => i.lines); return chatLines; } diff --git a/src/routes/production/workbench/videoPolling.ts b/src/routes/production/workbench/videoPolling.ts index 09bd3b0..2d68b51 100644 --- a/src/routes/production/workbench/videoPolling.ts +++ b/src/routes/production/workbench/videoPolling.ts @@ -16,4 +16,4 @@ export default router.post( const data = await u.db("o_video").where("scriptId", scriptId).whereIn("id", specifyIds).andWhere("state", "生成中").select("*"); res.status(200).send(success(data)); }, -); +); \ No newline at end of file diff --git a/src/types/database.d.ts b/src/types/database.d.ts index 4cf9a82..f8ebc17 100644 --- a/src/types/database.d.ts +++ b/src/types/database.d.ts @@ -1,17 +1,6 @@ -// @db-hash 2e39d6c2e0f11467eb8a669c22a4f771 +// @db-hash 5c0247c298d78d118c90ddfde129e6e6 //该文件由脚本自动生成,请勿手动修改 -export interface _o_novel_old_20260323 { - 'chapter'?: string | null; - 'chapterData'?: string | null; - 'chapterIndex'?: number | null; - 'createTime'?: number | null; - 'event'?: string | null; - 'eventState'?: number | null; - 'id'?: number; - 'projectId'?: number | null; - 'reel'?: string | null; -} export interface memories { 'content': string; 'createTime': number; @@ -90,9 +79,6 @@ export interface o_novel { 'chapterData'?: string | null; 'chapterIndex'?: number | null; 'createTime'?: number | null; - 'errorReason'?: string | null; - 'event'?: string | null; - 'eventState'?: number | null; 'id'?: number; 'projectId'?: number | null; 'reel'?: string | null; @@ -127,7 +113,7 @@ export interface o_script { 'projectId'?: number | null; } export interface o_scriptAssets { - 'assetsId'?: number; + 'assetId'?: number; 'scriptId'?: number; } export interface o_setting { @@ -207,7 +193,6 @@ export interface o_videoConfig { } export interface DB { - "_o_novel_old_20260323": _o_novel_old_20260323; "memories": memories; "o_agentDeploy": o_agentDeploy; "o_artStyle": o_artStyle;