Your Name 1912bcd25b
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
chore: sync all remaining local workspace changes
2026-05-08 11:26:57 +08:00

299 lines
8.8 KiB
JavaScript

/*
* Extracted from browser-delivered Turbopack chunk: 36466d3530b7d918.083c839b6e.js
* Module id: 562530
* For reading/searching only; this factory depends on the original Turbopack runtime.
*/
const moduleFactory = (e) => {
"use strict";
var t = e.i(299750),
r = e.i(19408),
a = e.i(185264);
let n = new Set();
function o(e) {
n.add(e);
}
function i(e) {
n.delete(e);
}
function s(e) {
return n.has(e);
}
let l = new Map(),
c = new Map();
async function u(e) {
let { rateLimitBenefitStatus: n } = a.useUserVipInfo.getState();
0 === n && (e.params.infiniteSwitch = 0);
let o = e.metadata?.node_id ?? "";
if (o) {
let e = Date.now(),
t = l.get(o);
if (null != t && e - t < 2e3)
return {
success: !1,
taskId: "",
handledByCommercial: !1,
skippedDuplicate: !0,
};
l.set(o, e);
let r = c.get(o);
r && clearTimeout(r),
c.set(
o,
setTimeout(() => {
l.delete(o), c.delete(o);
}, 2e3),
);
}
let i = await (0, t.createGenerationTask)(e);
if (i?.code === 0) {
let e = i.data ?? {},
t = e.taskId || e.task_id || "";
try {
a.useUserVipInfo.getState().syncVipInfo();
} catch (e) {
console.warn("syncVipInfo error", e);
}
return { success: !0, taskId: t, handledByCommercial: !1, response: i };
}
return (0, r.handleCommercialError)({
response: i,
defaultMsg: "生成失败",
})
? {
success: !1,
taskId: "",
handledByCommercial: !0,
response: i,
errorMsg: i?.msg,
}
: {
success: !1,
taskId: "",
handledByCommercial: !1,
response: i,
errorMsg: i?.msg ?? "网络异常,请重试",
};
}
e.s(
[
"isNodeSubmitting",
() => s,
"markNodeSubmitting",
() => o,
"submitGenerationTask",
() => u,
"unmarkNodeSubmitting",
() => i,
],
562530,
);
var d = e.i(216257);
let p = "aurora-3-lite",
m = (e) => new Promise((t) => setTimeout(t, e));
function f(e) {
return "number" == typeof e
? e
: "string" == typeof e
? parseFloat(e)
: NaN;
}
function h(e, t) {
let r,
a =
"number" == typeof e.shot_number
? e.shot_number
: parseInt(String(e.shot_number), 10),
n = Number.isFinite(a) && a > 0 ? a : t + 1,
o = f(e.duration_seconds);
(!Number.isFinite(o) || o <= 0) && (o = f(e.duration));
let i = Number.isFinite(o) && o > 0 ? o : 5,
s = Array.isArray(e.characters)
? e.characters.map((e) => ({
characterName: e.character_name || "",
characterDescription: e.character_description || "",
characterImageUrl:
"null" === e.character_image_url ||
"undefined" === e.character_image_url
? ""
: e.character_image_url || "",
}))
: [];
if (e.video_reference && "object" == typeof e.video_reference) {
let t = e.video_reference;
r = {
startTime: "number" == typeof t.start_time ? t.start_time : 0,
endTime: "number" == typeof t.end_time ? t.end_time : 0,
referenceFrameImage:
"null" === t.reference_frame_image ||
"undefined" === t.reference_frame_image
? ""
: t.reference_frame_image || "",
};
} else if (null != e.start_time || null != e.end_time) {
let t = f(e.start_time),
a = f(e.end_time);
r = {
startTime: Number.isFinite(t) ? t : 0,
endTime: Number.isFinite(a) ? a : 0,
referenceFrameImage: "",
};
}
let l = e.plot_description || e.visual_description || e.content || "",
c = e.lighting_and_atmosphere || e.lighting || "",
u = e.audio_effects || e.audio_music || "",
d = e.dialogue || e.audio_voice || "",
p = e.character_action || e.camera_movement || "",
m = e.emotion || "",
h = e.scene_tags || "";
return {
shotNumber: n,
durationSeconds: i,
plotDescription: l,
characters: s,
videoReference: r,
shotSize: e.shot_size || "",
characterAction: p,
emotion: m,
sceneTags: h,
lightingAndAtmosphere: c,
audioEffects: u,
dialogue: d,
imageGenerationPrompt: e.image_generation_prompt || "",
videoMotionPrompt: e.video_motion_prompt || "",
hiddenUuid: crypto.randomUUID(),
};
}
function g(e) {
let t,
r,
a = JSON.parse(e),
n = "";
if (Array.isArray(a.texts)) {
let e = a.texts;
if (!e.length) throw Error("taskResult 中 texts 为空");
let o = JSON.parse(e[0]);
(t = o.shots),
(n = o.meta?.title || ""),
Array.isArray(a.columns) && (r = a.columns);
}
if (!t || !Array.isArray(t) || 0 === t.length)
throw Error("taskResult 中 shots 为空或格式不合法");
return { title: n, rows: t.map((e, t) => h(e, t)), shotColumns: r };
}
function v(e) {
let t = JSON.parse(e),
r = t.shots ?? [];
return { title: t.meta?.title ?? "", rows: r.map((e, t) => h(e, t)) };
}
function x(e) {
let t,
r,
a = JSON.parse(e);
if (Array.isArray(a.texts)) {
let e = a.texts;
if (!e.length) throw Error("taskResult 中 texts 为空");
(t = JSON.parse(e[0]).shots),
Array.isArray(a.columns) && (r = a.columns);
}
if (!t || !Array.isArray(t) || 0 === t.length)
throw Error("taskResult 中 shots 为空或格式不合法");
return { rows: t, columns: r };
}
async function b(e) {
let r,
a,
{ videoUrl: n, nodeId: o, projectId: i } = e,
s =
((a = d.stores.global?.getModelSchema(p)),
a?.modelVendor || "aurora");
try {
r = await u({
params: {
prompt: "",
textList: [],
imageList: [],
videoList: [n],
audioList: [],
scene: "video-parsing",
},
metadata: { node_id: o, project_id: i },
provider: s,
model: p,
taskType: "text",
requestId: crypto.randomUUID(),
});
} catch (e) {
return (
console.error("[storyboard] 提交解析任务失败:", e),
{ code: -1, msg: "提交解析任务失败", data: { rows: [] } }
);
}
if (!r.success)
return {
code: -1,
msg: r.errorMsg || "提交解析任务失败",
data: { rows: [] },
};
let l = r.taskId;
if (!l) return { code: -1, msg: "未获取到任务 ID", data: { rows: [] } };
console.log("[storyboard] 视频解析任务已提交, taskId:", l);
for (let e = 0; e < 120; e++) {
let e;
await m(3e3);
try {
e = await (0, t.getGenerationProgress)([l]);
} catch {
continue;
}
if (!e || 0 !== e.code || !e.data?.progresses) continue;
let r = e.data.progresses.find((e) => e.taskId === l);
if (r && 0 !== r.status && 1 !== r.status) {
if (3 === r.status)
return {
code: -1,
msg: r.failedReason || "视频解析失败",
data: { rows: [] },
};
if (2 === r.status)
try {
let { rows: e, columns: t } = x(r.taskResult || "");
return (
console.log(
"[storyboard] 视频解析完成, 共",
e.length,
"个镜头",
),
{ code: 0, msg: "success", data: { rows: e, columns: t } }
);
} catch (e) {
return (
console.error("[storyboard] 解析 taskResult 失败:", e),
{
code: -1,
msg: `解析结果格式错误: ${e instanceof Error ? e.message : String(e)}`,
data: { rows: [] },
}
);
}
}
}
return { code: -1, msg: "视频解析超时,请稍后重试", data: { rows: [] } };
}
e.s(
[
"parseScriptTablePayload",
() => v,
"parseStoryboardResult",
() => g,
"parseVideoParsingRawResult",
() => x,
"parseVideoToVideoStory",
() => b,
],
192189,
);
};
export default moduleFactory;