修复bug
This commit is contained in:
parent
4ef9060b97
commit
9c2694f842
@ -26,8 +26,9 @@ export default router.post(
|
|||||||
}),
|
}),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const { prompt, duration, state, src, scriptId, projectId, videoDesc, shouldGenerateImage } = req.body;
|
const { prompt, duration, state, src, scriptId, projectId, videoDesc, shouldGenerateImage } = req.body;
|
||||||
|
const trackId = Date.now()
|
||||||
const [trackId] = await u.db("o_videoTrack").insert({
|
await u.db("o_videoTrack").insert({
|
||||||
|
id: trackId,
|
||||||
scriptId: scriptId,
|
scriptId: scriptId,
|
||||||
projectId,
|
projectId,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -77,7 +77,9 @@ export default router.post(
|
|||||||
await u.db("o_videoTrack").where("id", trackId).update({ duration: trackDuration });
|
await u.db("o_videoTrack").where("id", trackId).update({ duration: trackDuration });
|
||||||
} else {
|
} else {
|
||||||
// 不存在,新建videoTrack
|
// 不存在,新建videoTrack
|
||||||
const [newTrackId] = await u.db("o_videoTrack").insert({
|
const newTrackId = Date.now()
|
||||||
|
await u.db("o_videoTrack").insert({
|
||||||
|
id: newTrackId,
|
||||||
scriptId,
|
scriptId,
|
||||||
projectId,
|
projectId,
|
||||||
duration: trackDuration,
|
duration: trackDuration,
|
||||||
|
|||||||
@ -16,11 +16,13 @@ export default router.post(
|
|||||||
const data = await u.db("o_project").where("id", projectId).first();
|
const data = await u.db("o_project").where("id", projectId).first();
|
||||||
const video = data?.videoModel?.split(":");
|
const video = data?.videoModel?.split(":");
|
||||||
const vemdor = await u.vendor.getModelList(video?.[0]!);
|
const vemdor = await u.vendor.getModelList(video?.[0]!);
|
||||||
const [id] = await u.db("o_videoTrack").insert({
|
const trackId = Date.now()
|
||||||
|
await u.db("o_videoTrack").insert({
|
||||||
|
id: trackId,
|
||||||
projectId,
|
projectId,
|
||||||
scriptId,
|
scriptId,
|
||||||
duration,
|
duration,
|
||||||
});
|
});
|
||||||
res.status(200).send(success(id));
|
res.status(200).send(success(trackId));
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@ -16,7 +16,6 @@ export default router.post(
|
|||||||
}),
|
}),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const { name, content, projectId, assets } = req.body;
|
const { name, content, projectId, assets } = req.body;
|
||||||
if (content.length >= 3000) return res.status(400).send(error("内容不能超过3000字"));
|
|
||||||
const [scriptId] = await u.db("o_script").insert({
|
const [scriptId] = await u.db("o_script").insert({
|
||||||
name,
|
name,
|
||||||
content,
|
content,
|
||||||
|
|||||||
@ -134,7 +134,7 @@ export default router.post(
|
|||||||
const uniqueRows = [
|
const uniqueRows = [
|
||||||
...new Map(scriptAssetRows.map((r) => [`${r.scriptId}_${r.assetId}`, r])).values(),
|
...new Map(scriptAssetRows.map((r) => [`${r.scriptId}_${r.assetId}`, r])).values(),
|
||||||
];
|
];
|
||||||
console.log("%c Line:135 🥝 uniqueRows", "background:#7f2b82", uniqueRows);
|
|
||||||
|
|
||||||
// 先删除本批 scriptId 的旧关联,再插入新的
|
// 先删除本批 scriptId 的旧关联,再插入新的
|
||||||
await u.db("o_scriptAssets").whereIn("scriptId", batchScriptIds).delete();
|
await u.db("o_scriptAssets").whereIn("scriptId", batchScriptIds).delete();
|
||||||
@ -197,7 +197,7 @@ export default router.post(
|
|||||||
.describe("已有资产的引用列表(在已有资产列表中已存在的),只需给出资产名称和使用该资产的 scriptIds"),
|
.describe("已有资产的引用列表(在已有资产列表中已存在的),只需给出资产名称和使用该资产的 scriptIds"),
|
||||||
}),
|
}),
|
||||||
execute: async ({ newAssets, existingAssetRefs }) => {
|
execute: async ({ newAssets, existingAssetRefs }) => {
|
||||||
console.log("[tools] extractAssets result", { newAssets, existingAssetRefs });
|
|
||||||
if (newAssets?.length) collectedNew = newAssets;
|
if (newAssets?.length) collectedNew = newAssets;
|
||||||
if (existingAssetRefs?.length) collectedExisting = existingAssetRefs;
|
if (existingAssetRefs?.length) collectedExisting = existingAssetRefs;
|
||||||
return "无需回复用户任何内容";
|
return "无需回复用户任何内容";
|
||||||
|
|||||||
@ -16,8 +16,6 @@ export default router.post(
|
|||||||
}),
|
}),
|
||||||
async (req, res) => {
|
async (req, res) => {
|
||||||
const { id, name, content, assets } = req.body;
|
const { id, name, content, assets } = req.body;
|
||||||
if (content.length >= 3000) return res.status(400).send(error("内容不能超过3000字"));
|
|
||||||
|
|
||||||
await u.db("o_script").where({ id }).update({
|
await u.db("o_script").where({ id }).update({
|
||||||
name,
|
name,
|
||||||
content,
|
content,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user