导入剪辑台
This commit is contained in:
parent
ec94185704
commit
37e72af1fd
@ -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,
|
||||
|
||||
@ -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 = {
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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));
|
||||
},
|
||||
);
|
||||
);
|
||||
19
src/types/database.d.ts
vendored
19
src/types/database.d.ts
vendored
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user