462 lines
12 KiB
JavaScript
462 lines
12 KiB
JavaScript
/*
|
|
* Extracted from browser-delivered Turbopack chunk: 36466d3530b7d918.083c839b6e.js
|
|
* Module id: 299750
|
|
* For reading/searching only; this factory depends on the original Turbopack runtime.
|
|
*/
|
|
|
|
const moduleFactory = (e) => {
|
|
"use strict";
|
|
var t = e.i(325528),
|
|
r = e.i(505e3);
|
|
e.i(135623);
|
|
var a = e.i(168823),
|
|
n = e.i(704030),
|
|
o = e.i(383924),
|
|
i = e.i(185990);
|
|
function s({ name: e, message: t, properties: r }) {
|
|
(0, n.rumErrorReport)({
|
|
name: e,
|
|
message: t,
|
|
file: "request/models.ts",
|
|
properties: r,
|
|
});
|
|
}
|
|
function l({ name: e, properties: t }) {
|
|
(0, n.rumCustomReport)({
|
|
type: "batch_api",
|
|
name: e,
|
|
file: "request/models.ts",
|
|
properties: t,
|
|
});
|
|
}
|
|
let c = async (e) => {
|
|
try {
|
|
let t = e
|
|
? `${i.default.modelSchema}?env=${e}`
|
|
: i.default.modelSchema;
|
|
return await o.apiClient.get(t);
|
|
} catch (e) {
|
|
throw (console.error("[API] getModelSchema failed:", e), e);
|
|
}
|
|
},
|
|
u = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(i.default.generate, e);
|
|
} catch (e) {
|
|
throw (console.error("[API] createGenerationTask failed:", e), e);
|
|
}
|
|
},
|
|
d = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(i.default.generateLighting, e);
|
|
} catch (e) {
|
|
throw (console.error("[API] createLightingTask failed:", e), e);
|
|
}
|
|
},
|
|
p = new Set([2, 3]),
|
|
m = async (e) => {
|
|
try {
|
|
let t = await o.apiClient.post(i.default.generateStatus, {
|
|
taskIds: e,
|
|
});
|
|
return (
|
|
t?.code !== 0 &&
|
|
s({
|
|
name: "libtv.api.progress.business_error",
|
|
message: t?.msg || "getGenerationProgress code != 0",
|
|
properties: {
|
|
endpoint: i.default.generateStatus,
|
|
taskIds: e,
|
|
code: t?.code,
|
|
traceId: t?.trace_id,
|
|
response: t,
|
|
},
|
|
}),
|
|
t
|
|
);
|
|
} catch (t) {
|
|
throw (
|
|
(console.error("[API] getGenerationProgress failed:", t),
|
|
s({
|
|
name: "libtv.api.progress.exception",
|
|
message: "[API] getGenerationProgress failed",
|
|
properties: {
|
|
endpoint: i.default.generateStatus,
|
|
taskIds: e,
|
|
error: t,
|
|
},
|
|
}),
|
|
t)
|
|
);
|
|
}
|
|
},
|
|
f = async () => {
|
|
try {
|
|
let e = await o.apiClient.post(i.default.checkTaskProgressBatch);
|
|
return (
|
|
e?.code !== 0 &&
|
|
(l({
|
|
name: "libtv.api.batch.progress.fail",
|
|
properties: {
|
|
endpoint: i.default.checkTaskProgressBatch,
|
|
code: e?.code,
|
|
traceId: e?.trace_id,
|
|
msg: e?.msg,
|
|
response: e,
|
|
},
|
|
}),
|
|
s({
|
|
name: "libtv.api.batch.progress.business_error",
|
|
message: e?.msg || "checkTaskProgressBatch code != 0",
|
|
properties: {
|
|
endpoint: i.default.checkTaskProgressBatch,
|
|
code: e?.code,
|
|
traceId: e?.trace_id,
|
|
response: e,
|
|
},
|
|
})),
|
|
e
|
|
);
|
|
} catch (e) {
|
|
throw (
|
|
(console.error("[API] checkTaskProgressBatch failed:", e),
|
|
l({
|
|
name: "libtv.api.batch.progress.exception",
|
|
properties: {
|
|
endpoint: i.default.checkTaskProgressBatch,
|
|
error: e,
|
|
},
|
|
}),
|
|
s({
|
|
name: "libtv.api.batch.progress.exception",
|
|
message: "[API] checkTaskProgressBatch failed",
|
|
properties: {
|
|
endpoint: i.default.checkTaskProgressBatch,
|
|
error: e,
|
|
},
|
|
}),
|
|
e)
|
|
);
|
|
}
|
|
},
|
|
h = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(i.default.videoOpt, e);
|
|
} catch (e) {
|
|
throw (console.error("[API] createVideoOptTask failed:", e), e);
|
|
}
|
|
},
|
|
g = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(i.default.calculatePower, e);
|
|
} catch (e) {
|
|
throw (console.error("[API] calculatePower failed:", e), e);
|
|
}
|
|
},
|
|
v = async (e, t) => {
|
|
try {
|
|
let r = await o.apiClient.post(i.default.calculatePowerBatch, {
|
|
list: e,
|
|
infiniteSwitch: t,
|
|
});
|
|
return (
|
|
r?.code !== 0 &&
|
|
(l({
|
|
name: "libtv.api.batch.calculate_power.fail",
|
|
properties: {
|
|
endpoint: i.default.calculatePowerBatch,
|
|
code: r?.code,
|
|
listCount: e.length,
|
|
taskIds: e.map((e) => e.taskId),
|
|
infiniteSwitch: t ?? null,
|
|
msg: r?.msg,
|
|
response: r,
|
|
},
|
|
}),
|
|
s({
|
|
name: "libtv.api.batch.calculate_power.business_error",
|
|
message: r?.msg || "calculatePowerBatch code != 0",
|
|
properties: {
|
|
endpoint: i.default.calculatePowerBatch,
|
|
code: r?.code,
|
|
listCount: e.length,
|
|
taskIds: e.map((e) => e.taskId),
|
|
infiniteSwitch: t ?? null,
|
|
response: r,
|
|
},
|
|
})),
|
|
r
|
|
);
|
|
} catch (r) {
|
|
throw (
|
|
(console.error("[API] calculatePowerBatch failed:", r),
|
|
l({
|
|
name: "libtv.api.batch.calculate_power.exception",
|
|
properties: {
|
|
endpoint: i.default.calculatePowerBatch,
|
|
listCount: e.length,
|
|
taskIds: e.map((e) => e.taskId),
|
|
infiniteSwitch: t ?? null,
|
|
error: r,
|
|
},
|
|
}),
|
|
s({
|
|
name: "libtv.api.batch.calculate_power.exception",
|
|
message: "[API] calculatePowerBatch failed",
|
|
properties: {
|
|
endpoint: i.default.calculatePowerBatch,
|
|
listCount: e.length,
|
|
taskIds: e.map((e) => e.taskId),
|
|
infiniteSwitch: t ?? null,
|
|
error: r,
|
|
},
|
|
}),
|
|
r)
|
|
);
|
|
}
|
|
},
|
|
x = async (e) => {
|
|
try {
|
|
let t = await o.apiClient.post(i.default.stopTaskBatch, {
|
|
taskIds: e,
|
|
});
|
|
return (
|
|
t?.code !== 0 &&
|
|
(l({
|
|
name: "libtv.api.batch.stop_task.fail",
|
|
properties: {
|
|
endpoint: i.default.stopTaskBatch,
|
|
code: t?.code,
|
|
taskIds: e,
|
|
msg: t?.msg,
|
|
response: t,
|
|
},
|
|
}),
|
|
s({
|
|
name: "libtv.api.batch.stop_task.business_error",
|
|
message: t?.msg || "stopTaskBatch code != 0",
|
|
properties: {
|
|
endpoint: i.default.stopTaskBatch,
|
|
code: t?.code,
|
|
taskIds: e,
|
|
response: t,
|
|
},
|
|
})),
|
|
t
|
|
);
|
|
} catch (t) {
|
|
throw (
|
|
(console.error("[API] stopTaskBatch failed:", t),
|
|
l({
|
|
name: "libtv.api.batch.stop_task.exception",
|
|
properties: {
|
|
endpoint: i.default.stopTaskBatch,
|
|
taskIds: e,
|
|
error: t,
|
|
},
|
|
}),
|
|
s({
|
|
name: "libtv.api.batch.stop_task.exception",
|
|
message: "[API] stopTaskBatch failed",
|
|
properties: {
|
|
endpoint: i.default.stopTaskBatch,
|
|
taskIds: e,
|
|
error: t,
|
|
},
|
|
}),
|
|
t)
|
|
);
|
|
}
|
|
},
|
|
b = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(
|
|
`${t.config.tv.internalApiHost}/api/www/model/feed/stream`,
|
|
e,
|
|
);
|
|
} catch {}
|
|
},
|
|
y = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(
|
|
`${t.config.tv.internalApiHost}/api/www/model/video/stream`,
|
|
e,
|
|
);
|
|
} catch {}
|
|
},
|
|
w = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(
|
|
`${t.config.tv.internalApiHost}/api/www/model/search`,
|
|
e,
|
|
);
|
|
} catch {}
|
|
},
|
|
k = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(
|
|
`${t.config.tv.bridgeApiHost}/gateway/sd-api/model/searchV2`,
|
|
e,
|
|
);
|
|
} catch {}
|
|
},
|
|
S = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(
|
|
`${t.config.tv.internalApiHost}/api/www/image1/styleList`,
|
|
e,
|
|
);
|
|
} catch {}
|
|
},
|
|
C = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(
|
|
`${t.config.tv.internalApiHost}/api/www/image1/doubao/styleList`,
|
|
e,
|
|
);
|
|
} catch {}
|
|
},
|
|
P = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(
|
|
`${t.config.tv.internalApiHost}/api/www/image1/kontext/styleList`,
|
|
e,
|
|
);
|
|
} catch {}
|
|
},
|
|
M = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(
|
|
`${t.config.tv.internalApiHost}/api/www/public/tag/v2`,
|
|
e,
|
|
);
|
|
} catch {}
|
|
},
|
|
_ = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(
|
|
`${t.config.tv.internalApiHost}/api/www/model/model-version/subscribe`,
|
|
e,
|
|
);
|
|
} catch {}
|
|
},
|
|
T = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(
|
|
`${t.config.tv.internalApiHost}/api/www/model/model-version/unsubscribe`,
|
|
e,
|
|
);
|
|
} catch {}
|
|
},
|
|
I = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(
|
|
`${t.config.tv.internalApiHost}/api/www/model/used/history/add`,
|
|
e,
|
|
);
|
|
} catch {}
|
|
};
|
|
function j(e) {
|
|
let t = i.default.removeBackgroundImageBase.replace(/\/$/, ""),
|
|
r = e.startsWith("/") ? e.slice(1) : e;
|
|
return `${t}/${r}`;
|
|
}
|
|
let N = async (e) => {
|
|
try {
|
|
return await o.apiClient.post(i.default.removeBackgroundInference, e);
|
|
} catch (e) {
|
|
throw (
|
|
(console.error("[API] removeBackgroundInference failed:", e), e)
|
|
);
|
|
}
|
|
},
|
|
B = async (e) => {
|
|
let t = { "Content-Type": "application/json" },
|
|
n = (0, a.getCookie)(r.USER_TOKEN_COOKIE_KEY);
|
|
n && "string" == typeof n && (t.token = n);
|
|
let o = await fetch(i.default.clickSuggest, {
|
|
method: "POST",
|
|
headers: t,
|
|
body: JSON.stringify(e),
|
|
});
|
|
if (!o.ok)
|
|
throw Error(`[API] clickSuggest failed: ${o.status} ${o.statusText}`);
|
|
return o.json();
|
|
};
|
|
e.s([
|
|
"TERMINAL_PROGRESS_STATUS",
|
|
0,
|
|
p,
|
|
"addModelHistoryUsed",
|
|
0,
|
|
I,
|
|
"calculatePower",
|
|
0,
|
|
g,
|
|
"calculatePowerBatch",
|
|
0,
|
|
v,
|
|
"checkTaskProgressBatch",
|
|
0,
|
|
f,
|
|
"clickSuggest",
|
|
0,
|
|
B,
|
|
"createGenerationTask",
|
|
0,
|
|
u,
|
|
"createLightingTask",
|
|
0,
|
|
d,
|
|
"createVideoOptTask",
|
|
0,
|
|
h,
|
|
"getCollectOrHistoryModels",
|
|
0,
|
|
k,
|
|
"getGenerationProgress",
|
|
0,
|
|
m,
|
|
"getKontextStyleList",
|
|
0,
|
|
P,
|
|
"getModelFeedStream",
|
|
0,
|
|
b,
|
|
"getModelSchema",
|
|
0,
|
|
c,
|
|
"getPublicTags",
|
|
0,
|
|
M,
|
|
"getRemoveBackgroundImageUrl",
|
|
() => j,
|
|
"getSeedreamStyleList",
|
|
0,
|
|
C,
|
|
"getStyleList",
|
|
0,
|
|
S,
|
|
"getVideoModelFeedStream",
|
|
0,
|
|
y,
|
|
"removeBackgroundInference",
|
|
0,
|
|
N,
|
|
"searchModelByKeyword",
|
|
0,
|
|
w,
|
|
"stopTaskBatch",
|
|
0,
|
|
x,
|
|
"subscribeModel",
|
|
0,
|
|
_,
|
|
"unsubscribeModel",
|
|
0,
|
|
T,
|
|
]);
|
|
};
|
|
|
|
export default moduleFactory;
|