导入剪辑台

This commit is contained in:
小帅 2026-03-24 10:18:35 +08:00
parent ec94185704
commit 37e72af1fd
5 changed files with 33 additions and 28 deletions

View File

@ -42,20 +42,21 @@ export default router.post(
.select("o_image.filePath as imageFilePath") .select("o_image.filePath as imageFilePath")
.first(); .first();
if (row?.imageFilePath) { 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; return null;
} }
if (d.type === "storyboard" && d.id) { if (d.type === "storyboard" && d.id) {
const row = await u.db("o_storyboard").where("id", d.id).select("filePath").first(); const row = await u.db("o_storyboard").where("id", d.id).select("filePath").first();
if (row?.filePath) { 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 null; return null;
}), }),
); );
return { return {
...item, ...item,
data: dataWithFilePath, data: dataWithFilePath,

View File

@ -29,6 +29,8 @@ export default router.post(
}), }),
async (req, res) => { async (req, res) => {
const { scriptId, projectId, storyboardId, prompt, data, model, duration, resolution, audio, mode } = req.body; 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 videoPath = `/${projectId}/video/${uuidv4()}.mp4`; //视频保存路径
//新增 //新增
const videoData = { const videoData = {

View File

@ -7,11 +7,30 @@ import { validateFields } from "@/middleware/middleware";
import { Output } from "ai"; import { Output } from "ai";
const router = express.Router(); const router = express.Router();
export default router.post("/", validateFields({}), async (req, res) => { export default router.post(
const {} = req.body; "/",
}); 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({ const resText = await u.Ai.Text("eventExtractAgent").invoke({
messages: [ messages: [
{ {
@ -32,9 +51,7 @@ async function getLines() {
}, },
{ {
role: "user", role: "user",
content: ` content: prompt,
`,
}, },
], ],
output: Output.array({ output: Output.array({
@ -44,6 +61,6 @@ async function getLines() {
}), }),
}); });
const parseLines = JSON.parse(resText.text); 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; return chatLines;
} }

View File

@ -16,4 +16,4 @@ export default router.post(
const data = await u.db("o_video").where("scriptId", scriptId).whereIn("id", specifyIds).andWhere("state", "生成中").select("*"); const data = await u.db("o_video").where("scriptId", scriptId).whereIn("id", specifyIds).andWhere("state", "生成中").select("*");
res.status(200).send(success(data)); res.status(200).send(success(data));
}, },
); );

View File

@ -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 { export interface memories {
'content': string; 'content': string;
'createTime': number; 'createTime': number;
@ -90,9 +79,6 @@ export interface o_novel {
'chapterData'?: string | null; 'chapterData'?: string | null;
'chapterIndex'?: number | null; 'chapterIndex'?: number | null;
'createTime'?: number | null; 'createTime'?: number | null;
'errorReason'?: string | null;
'event'?: string | null;
'eventState'?: number | null;
'id'?: number; 'id'?: number;
'projectId'?: number | null; 'projectId'?: number | null;
'reel'?: string | null; 'reel'?: string | null;
@ -127,7 +113,7 @@ export interface o_script {
'projectId'?: number | null; 'projectId'?: number | null;
} }
export interface o_scriptAssets { export interface o_scriptAssets {
'assetsId'?: number; 'assetId'?: number;
'scriptId'?: number; 'scriptId'?: number;
} }
export interface o_setting { export interface o_setting {
@ -207,7 +193,6 @@ export interface o_videoConfig {
} }
export interface DB { export interface DB {
"_o_novel_old_20260323": _o_novel_old_20260323;
"memories": memories; "memories": memories;
"o_agentDeploy": o_agentDeploy; "o_agentDeploy": o_agentDeploy;
"o_artStyle": o_artStyle; "o_artStyle": o_artStyle;