修改接口名,完善资产

This commit is contained in:
zhishi 2026-03-24 23:00:05 +08:00
parent 80d0c8143f
commit dbccdbf770
10 changed files with 48 additions and 29 deletions

View File

@ -33,7 +33,7 @@ description: >
1. 调用 `get_flowData` 分别获取 `script`(剧本)和 `assets`(现有资产列表)
2. 根据[分镜表生成](references/storyboard-generation.md)文档中的拆分原则和字段填写指引将剧本拆分为分镜填写每条分镜的所有字段id、title、description、camera、duration、frameMode、prompt、lines、sound、associateAssetsIds
3. 调用 `set_flowData({ key: "storyboardTable", value: 分镜数组 })` 一次性保存完整分镜表
3. 调用 `set_flowData({ key: "storyboard", value: 分镜数组 })` 一次性保存完整分镜表
4. 告知用户分镜表生成完成,列出分镜概要(总条数、主要场景)
5. **询问用户是否需要生成分镜图片**
- 如果用户确认需要,调用 `generate_storyboard_images({ script: 剧本文本 })` 生成分镜图

View File

@ -1,4 +1,4 @@
# 分镜面板生成(从剧本 + 资产 → storyboardTable
# 分镜面板生成(从剧本 + 资产 → storyboard
本指南只做一件事:
根据剧本内容和已有资产,将剧本拆分为一系列分镜,生成结构化的分镜面板。
@ -18,7 +18,7 @@
```ts
set_flowData({
key: "storyboardTable",
key: "storyboard",
value: [
{
id: 1,
@ -185,7 +185,7 @@ set_flowData({
```ts
set_flowData({
key: "storyboardTable",
key: "storyboard",
value: [
{
id: 1,
@ -232,7 +232,7 @@ set_flowData({
1. `get_flowData("script")` — 获取剧本内容
2. `get_flowData("assets")` — 获取已有资产列表
3. 分析剧本,按照拆分原则划分分镜,并为每条分镜填写所有字段
4. 调用 `set_flowData({ key: "storyboardTable", value: 分镜数组 })` 一次性保存完整分镜面板
4. 调用 `set_flowData({ key: "storyboard", value: 分镜数组 })` 一次性保存完整分镜面板
5. 向用户汇报分镜面板概要(总共多少条分镜,覆盖的场景概括)
6. **询问用户是否需要生成分镜图片**
- 如果用户确认,调用 `generate_storyboard_images({ script: 剧本文本 })` 生成分镜图

View File

@ -24,7 +24,7 @@ export const assetItemSchema = z.object({
derive: z.array(deriveAssetSchema).describe("衍生资产列表"),
});
export const storyboardSchema = z.object({
id: z.number().optional().describe("分镜ID,未从工作区获得的分镜列表视为需要新增;如需新增则为空"),
id: z.number().optional().describe("分镜ID,未从工作区获得的分镜面板视为需要新增;如需新增则为空"),
title: z.string().describe("分镜标题"),
description: z.string().describe("分镜描述"),
camera: z.string().describe("镜头信息"),
@ -52,8 +52,8 @@ export const flowDataSchema = z.object({
script: z.string().describe("剧本内容"),
scriptPlan: z.string().describe("拍摄计划"),
assets: z.array(assetItemSchema).describe("衍生资产"),
storyboardTable: z.string().describe("分镜面板"),
storyboard: z.array(storyboardSchema).describe("分镜列表"),
storyboardTable: z.string().describe("分镜"),
storyboard: z.array(storyboardSchema).describe("分镜面板"),
workbench: workbenchDataSchema.describe("工作台配置"),
poster: z
.object({
@ -183,21 +183,21 @@ export default (resTool: ResTool, toolsNames?: string[]) => {
},
}),
set_flowData_storyboardTable: tool({
description: "保存分镜模板到工作区",
description: "保存分镜到工作区",
inputSchema: z.object({ value: flowDataSchema.shape.storyboardTable }),
execute: async ({ value }) => {
console.log("[tools] set_flowData storyboardTable", value);
resTool.systemMessage("正在保存 分镜面板 数据...");
resTool.systemMessage("正在保存 分镜 数据...");
socket.emit("setFlowData", { key: "storyboardTable", value });
return true;
},
}),
set_flowData_storyboard: tool({
description: "保存分镜列表到工作区",
description: "保存分镜面板到工作区",
inputSchema: z.object({ value: flowDataSchema.shape.storyboard }),
execute: async ({ value }) => {
console.log("[tools] set_flowData storyboard", value);
resTool.systemMessage("正在保存 分镜列表 数据...");
resTool.systemMessage("正在保存 分镜面板 数据...");
for (const item of value) {
if (!item.id) {
const [insertedId] = await u.db("o_storyboard").insert({
@ -211,6 +211,7 @@ export default (resTool: ResTool, toolsNames?: string[]) => {
sound: item.sound,
lines: item.lines,
state: "未生成",
scriptId: resTool.data.scriptId,
});
if (item.associateAssetsIds.length) {
await u.db("o_assets2Storyboard").insert(item.associateAssetsIds.map((i) => ({ storyboardId: insertedId, assetId: i })));

View File

@ -414,13 +414,14 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
table.index(["isolationKey", "summarized"]);
},
},
//分镜工作流表
//图片工作流表
{
name: "o_storyboardFlow",
name: "o_imageFlow",
builder: (table) => {
table.integer("id").notNullable();
table.text("flowData").notNullable();
table.integer("storyboardId").notNullable();
table.integer("storyboardId");
table.integer("assetsId");
table.primary(["id"]);
table.unique(["id"]);
},

View File

@ -1,4 +1,4 @@
// @routes-hash 055f8c83508ff9dfc8b98eb5108287f7
// @routes-hash 27c3b6ded51fc0de03bec6512e84485b
import { Express } from "express";
import route1 from "./routes/agents/clearMemory";
@ -40,10 +40,10 @@ import route36 from "./routes/novel/updateNovel";
import route37 from "./routes/other/deleteAllData";
import route38 from "./routes/other/getCaptcha";
import route39 from "./routes/production/assets/getAssetsData";
import route40 from "./routes/production/editStoryboard/generateStoryboardImage";
import route41 from "./routes/production/editStoryboard/getStoryboardFlow";
import route42 from "./routes/production/editStoryboard/saveStoryboardFlow";
import route43 from "./routes/production/editStoryboard/updateStoryboardFlow";
import route40 from "./routes/production/editImage/generateStoryboardImage";
import route41 from "./routes/production/editImage/getStoryboardFlow";
import route42 from "./routes/production/editImage/saveStoryboardFlow";
import route43 from "./routes/production/editImage/updateStoryboardFlow";
import route44 from "./routes/production/exportImage";
import route45 from "./routes/production/getFlowData";
import route46 from "./routes/production/getProductionData";
@ -125,10 +125,10 @@ export default async (app: Express) => {
app.use("/api/other/deleteAllData", route37);
app.use("/api/other/getCaptcha", route38);
app.use("/api/production/assets/getAssetsData", route39);
app.use("/api/production/editStoryboard/generateStoryboardImage", route40);
app.use("/api/production/editStoryboard/getStoryboardFlow", route41);
app.use("/api/production/editStoryboard/saveStoryboardFlow", route42);
app.use("/api/production/editStoryboard/updateStoryboardFlow", route43);
app.use("/api/production/editImage/generateStoryboardImage", route40);
app.use("/api/production/editImage/getStoryboardFlow", route41);
app.use("/api/production/editImage/saveStoryboardFlow", route42);
app.use("/api/production/editImage/updateStoryboardFlow", route43);
app.use("/api/production/exportImage", route44);
app.use("/api/production/getFlowData", route45);
app.use("/api/production/getProductionData", route46);

View File

@ -9,10 +9,20 @@ export default router.post(
"/",
validateFields({
id: z.number(),
type: z.enum(["assets", "storyboard"]),
}),
async (req, res) => {
const { id } = req.body;
const storyboardFlowData = await u.db("o_storyboardFlow").where("storyboardId", id).first();
const { id, type } = req.body;
const storyboardFlowData = await u
.db("o_imageFlow")
.modify((qb) => {
if (type === "assets") {
qb.where("assetsId", id);
} else if (type === "storyboard") {
qb.where("storyboardId", id);
}
})
.first();
if (storyboardFlowData?.flowData) {
const parseFlow = JSON.parse(storyboardFlowData.flowData);
await Promise.all(

View File

@ -29,7 +29,7 @@ export default router.post(
filePath: new URL(imageUrl).pathname,
createTime: Date.now(),
});
await u.db("o_storyboardFlow").insert({
await u.db("o_imageFlow").insert({
storyboardId: id,
flowData: JSON.stringify({ edges, nodes }),
});

View File

@ -31,7 +31,7 @@ export default router.post(
.where("id", id)
.update({ filePath: new URL(imageUrl).pathname });
await u
.db("o_storyboardFlow")
.db("o_imageFlow")
.where("storyboardId", id)
.update({
flowData: JSON.stringify({ edges, nodes }),

View File

@ -1,4 +1,4 @@
// @db-hash 1ce1a8f10cb90caac306536b78942cb3
// @db-hash e7f6b28afeff91fb2a3544abed8c4a73
//该文件由脚本自动生成,请勿手动修改
export interface _o_storyboard_old_20260324 {
@ -93,6 +93,12 @@ export interface o_image {
'state'?: string | null;
'type'?: string | null;
}
export interface o_imageFlow {
'assetsId'?: number | null;
'flowData': string;
'id'?: number;
'storyboardId'?: number | null;
}
export interface o_novel {
'chapter'?: string | null;
'chapterData'?: string | null;
@ -228,6 +234,7 @@ export interface DB {
"o_event": o_event;
"o_eventChapter": o_eventChapter;
"o_image": o_image;
"o_imageFlow": o_imageFlow;
"o_novel": o_novel;
"o_outline": o_outline;
"o_outlineNovel": o_outlineNovel;