矫正出图方法
This commit is contained in:
parent
02883472e7
commit
d908844c6c
36
NOTICES.txt
36
NOTICES.txt
@ -70,6 +70,12 @@ Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
-----------------------------
|
||||
|
||||
Name: @types/graphlib
|
||||
License: MIT
|
||||
Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
-----------------------------
|
||||
|
||||
Name: @types/jsonwebtoken
|
||||
License: MIT
|
||||
Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@ -142,18 +148,18 @@ Repository: https://github.com/motdotla/dotenv
|
||||
|
||||
-----------------------------
|
||||
|
||||
Name: dotenv
|
||||
License: BSD-2-Clause
|
||||
Repository: https://github.com/motdotla/dotenv
|
||||
|
||||
-----------------------------
|
||||
|
||||
Name: electron-builder
|
||||
License: MIT
|
||||
Repository: https://github.com/electron-userland/electron-builder
|
||||
|
||||
-----------------------------
|
||||
|
||||
Name: electron-rebuild
|
||||
License: MIT
|
||||
Repository: https://github.com/electron/electron-rebuild
|
||||
|
||||
-----------------------------
|
||||
|
||||
Name: electron
|
||||
License: MIT
|
||||
Repository: https://github.com/electron/electron
|
||||
@ -244,15 +250,15 @@ Repository: https://github.com/remy/nodemon
|
||||
|
||||
-----------------------------
|
||||
|
||||
Name: qwen-ai-provider-v5
|
||||
License: Apache-2.0
|
||||
Repository: https://github.com/bolechen/qwen-ai-provider-v5
|
||||
Name: p-limit
|
||||
License: MIT
|
||||
Repository: https://github.com/sindresorhus/p-limit
|
||||
|
||||
-----------------------------
|
||||
|
||||
Name: serialize-error
|
||||
License: MIT
|
||||
Repository: https://github.com/sindresorhus/serialize-error
|
||||
Name: qwen-ai-provider-v5
|
||||
License: Apache-2.0
|
||||
Repository: https://github.com/bolechen/qwen-ai-provider-v5
|
||||
|
||||
-----------------------------
|
||||
|
||||
@ -304,6 +310,12 @@ Repository: https://github.com/uuidjs/uuid
|
||||
|
||||
-----------------------------
|
||||
|
||||
Name: vercel-minimax-ai-provider
|
||||
License: Apache-2.0
|
||||
Repository: https://github.com/MiniMax-AI/vercel-minimax-ai-provider
|
||||
|
||||
-----------------------------
|
||||
|
||||
Name: vm2
|
||||
License: MIT
|
||||
Repository: https://github.com/patriksimek/vm2
|
||||
|
||||
@ -1 +1 @@
|
||||
1.1.2
|
||||
1.1.3
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "toonflow",
|
||||
"version": "1.1.2",
|
||||
"version": "1.1.3",
|
||||
"description": "Toonflow 是一款 AI 短剧漫剧工具,能够利用 AI 技术将小说自动转化为剧本,并结合 AI 生成的图片和视频,实现高效的短剧创作。",
|
||||
"author": "HBAI-Ltd <ltlctools@outlook.com>",
|
||||
"license": "Apache-2.0",
|
||||
@ -49,7 +49,6 @@
|
||||
"better-sqlite3": "^12.8.0",
|
||||
"compressing": "^2.1.0",
|
||||
"cors": "^2.8.5",
|
||||
"custom-electron-titlebar": "^4.2.8",
|
||||
"dotenv": "^17.2.3",
|
||||
"express": "^5.2.1",
|
||||
"express-ws": "^5.0.2",
|
||||
|
||||
@ -61,7 +61,34 @@ checker.init({ start: process.cwd() }, (err: Error, packages: Record<string, any
|
||||
|
||||
// 排除名单过滤
|
||||
const filteredDeclare = needDeclare.filter((pkg) => pkg.name && !excludeNames.some((exName) => pkg.name.startsWith(exName)));
|
||||
const content = filteredDeclare
|
||||
|
||||
// 去重:同一个 name@version 只保留一条,并合并 licenses
|
||||
const dedupedDeclare = Array.from(
|
||||
filteredDeclare
|
||||
.reduce((acc, pkg) => {
|
||||
const key = `${pkg.name}@${pkg.version}`;
|
||||
const licenseList = Array.isArray(pkg.licenses) ? pkg.licenses : [pkg.licenses];
|
||||
const existing = acc.get(key);
|
||||
|
||||
if (!existing) {
|
||||
acc.set(key, {
|
||||
...pkg,
|
||||
licenses: [...new Set(licenseList.filter(Boolean))],
|
||||
});
|
||||
return acc;
|
||||
}
|
||||
|
||||
const existingLicenses = Array.isArray(existing.licenses) ? existing.licenses : [existing.licenses];
|
||||
existing.licenses = [...new Set([...existingLicenses, ...licenseList].filter(Boolean))];
|
||||
if (!existing.repository && pkg.repository) {
|
||||
existing.repository = pkg.repository;
|
||||
}
|
||||
return acc;
|
||||
}, new Map<string, PackageInfo>())
|
||||
.values()
|
||||
);
|
||||
|
||||
const content = dedupedDeclare
|
||||
.map(
|
||||
(pkg) =>
|
||||
`Name: ${pkg.name}\nLicense: ${Array.isArray(pkg.licenses) ? pkg.licenses.join(", ") : pkg.licenses}\nRepository: ${pkg.repository ?? "N/A"}`
|
||||
|
||||
@ -116,7 +116,7 @@ export default router.post("/", validateFields(requestSchema), async (req, res)
|
||||
await aiImage.run(
|
||||
{
|
||||
prompt: userPrompt,
|
||||
imageBase64: item.base64 ? [item.base64] : [],
|
||||
referenceList: item.base64 ? [{ base64: item.base64, type: "image" }] : [],
|
||||
size: resolution,
|
||||
aspectRatio: "16:9",
|
||||
},
|
||||
|
||||
@ -100,7 +100,7 @@ export default router.post("/", validateFields(requestSchema), async (req, res)
|
||||
await aiImage.run(
|
||||
{
|
||||
prompt: userPrompt,
|
||||
imageBase64: base64 ? [base64] : [],
|
||||
referenceList: base64 ? [{ type: "image", base64 }] : [],
|
||||
size: resolution,
|
||||
aspectRatio: "16:9",
|
||||
},
|
||||
|
||||
@ -101,7 +101,7 @@ export default router.post(
|
||||
};
|
||||
const imageCls = await u.Ai.Image(projectSettingData?.imageModel as `${string}:${string}`).run(
|
||||
{
|
||||
imageBase64: imageBase64 ? [imageBase64] : [],
|
||||
referenceList: imageBase64 ? [{ type: "image", base64: imageBase64 }] : [],
|
||||
...repeloadObj,
|
||||
},
|
||||
{
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
import express from "express";
|
||||
import u from "@/utils";
|
||||
import { z } from "zod";
|
||||
import { base64, z } from "zod";
|
||||
import { success } from "@/lib/responseFormat";
|
||||
import { validateFields } from "@/middleware/middleware";
|
||||
import axios from "axios";
|
||||
@ -28,7 +28,8 @@ export default router.post(
|
||||
const imageClass = await u.Ai.Image(model).run(
|
||||
{
|
||||
prompt: prompt,
|
||||
imageBase64: references && references.length ? await Promise.all(references.map((url: string) => urlToBase64(url))) : [],
|
||||
referenceList:
|
||||
references && references.length ? await Promise.all(references.map((url: string) => ({ type: "image", base64: urlToBase64(url) }))) : [],
|
||||
size: quality,
|
||||
aspectRatio: ratio,
|
||||
},
|
||||
|
||||
@ -73,6 +73,7 @@ export default router.post(
|
||||
storyboardTable: "",
|
||||
storyboard: [],
|
||||
//todo:矫正workbench数据
|
||||
//@ts-ignore
|
||||
workbench: {
|
||||
videoList: [],
|
||||
},
|
||||
|
||||
@ -88,7 +88,7 @@ export default router.post(
|
||||
await u.Ai.Image(projectSettingData?.imageModel as `${string}:${string}`)
|
||||
.run(
|
||||
{
|
||||
imageBase64: await getAssetsImageBase64(assetRecord[item.id!] || []),
|
||||
referenceList: await getAssetsImageBase64(assetRecord[item.id!] || []),
|
||||
...repeloadObj,
|
||||
},
|
||||
{
|
||||
@ -152,5 +152,5 @@ async function getAssetsImageBase64(imageIds: number[]) {
|
||||
}),
|
||||
);
|
||||
// 保留顺序,并且过滤掉无效项
|
||||
return imageUrls.filter(Boolean) as string[];
|
||||
return (imageUrls.filter(Boolean) as string[]).map((url) => ({ type: "image" as const, base64: url }));
|
||||
}
|
||||
|
||||
@ -95,10 +95,10 @@ export default router.post(
|
||||
await aiVideo.run(
|
||||
{
|
||||
prompt,
|
||||
imageBase64: base64.filter((item) => item !== null) as string[],
|
||||
referenceList: base64.filter((item) => item !== null).map((item) => ({ type: "image" as const, base64: item! })),
|
||||
mode: modeData.length > 0 ? modeData : mode,
|
||||
duration,
|
||||
aspectRatio: (ratio?.videoRatio as `${number}:${number}`) || "16:9",
|
||||
aspectRatio: (ratio?.videoRatio as "16:9" | "9:16") || "16:9",
|
||||
resolution,
|
||||
audio,
|
||||
},
|
||||
|
||||
@ -103,7 +103,6 @@ export default router.post(
|
||||
inputs: JSON.stringify(vendor.inputs ?? []),
|
||||
inputValues: JSON.stringify(vendor.inputValues ?? {}),
|
||||
models: JSON.stringify(vendor.models ?? []),
|
||||
code: tsCode,
|
||||
createTime: Date.now(),
|
||||
enable: vendor.id == "toonflow" ? 1 : 0,
|
||||
});
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
import express from "express";
|
||||
import { success, error } from "@/lib/responseFormat";
|
||||
import { validateFields } from "@/middleware/middleware";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
import u from "@/utils";
|
||||
import { z } from "zod";
|
||||
const router = express.Router();
|
||||
@ -16,6 +18,7 @@ export default router.post(
|
||||
model: null,
|
||||
vendorId: null,
|
||||
});
|
||||
fs.rmSync(path.join(u.getPath("vendor"), `${id}.ts`), { recursive: true, force: true });
|
||||
res.status(200).send(success("删除成功"));
|
||||
},
|
||||
);
|
||||
|
||||
@ -133,10 +133,7 @@ class AiText {
|
||||
}
|
||||
}
|
||||
|
||||
type ReferenceList =
|
||||
| ({ type: "image" } & ({ sourceType: "url"; url: string } | { sourceType: "base64"; base64: string }))
|
||||
| ({ type: "audio" } & ({ sourceType: "url"; url: string } | { sourceType: "base64"; base64: string }))
|
||||
| ({ type: "video" } & ({ sourceType: "url"; url: string } | { sourceType: "base64"; base64: string }));
|
||||
type ReferenceList = { type: "image"; base64: string } | { type: "audio"; base64: string } | { type: "video"; base64: string };
|
||||
|
||||
interface ImageConfig {
|
||||
prompt: string;
|
||||
|
||||
@ -1869,11 +1869,6 @@ cross-spawn@^7.0.1, cross-spawn@^7.0.6:
|
||||
shebang-command "^2.0.0"
|
||||
which "^2.0.1"
|
||||
|
||||
custom-electron-titlebar@^4.2.8:
|
||||
version "4.4.1"
|
||||
resolved "https://registry.npmmirror.com/custom-electron-titlebar/-/custom-electron-titlebar-4.4.1.tgz#aea64f009697c9771cb2a67d2eb5ac8059696906"
|
||||
integrity sha512-I+sOGBdslrGpuCWlhda8P0vtRAZK+W2NzjHLsxTiE2bNmhAIs9YLDe6iRBExwU1xVZt+J1hSXzUT67BlAuMWLA==
|
||||
|
||||
debug@2.6.9:
|
||||
version "2.6.9"
|
||||
resolved "https://registry.npmmirror.com/debug/-/debug-2.6.9.tgz#5d128515df134ff327e90a4c93f4e077a536341f"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user