添加模型多参参数
This commit is contained in:
parent
e654c09b82
commit
abfdef1a4a
BIN
data/latest.zip
Normal file
BIN
data/latest.zip
Normal file
Binary file not shown.
@ -43,12 +43,23 @@ export async function decisionAI(ctx: AgentContext) {
|
||||
const skill = path.join(u.getPath("skills"), "production_agent_decision.md");
|
||||
const prompt = await fs.promises.readFile(skill, "utf-8");
|
||||
|
||||
const projectInfo = await u.db("o_project").where("id", ctx.resTool.data.projectId).first();
|
||||
if (!projectInfo) throw new Error(`项目不存在,ID: ${ctx.resTool.data.projectId}`);
|
||||
const [_, imageModelName] = projectInfo.imageModel!.split(":");
|
||||
const [id, videoModelName] = projectInfo.videoModel!.split(":");
|
||||
const data = await u.db("o_vendorConfig").where("id", id).select("models").first();
|
||||
const models = JSON.parse(data!.models!);
|
||||
const findData = models.find((i: any) => i.modelName == name);
|
||||
const isRef = findData.mode.every((i: any) => Array.isArray(i));
|
||||
const modelInfo = `项目使用的模型如下:\n图像模型:${imageModelName}\n视频模型:${videoModelName}\n多参:${isRef ? "是" : "否"}`;
|
||||
|
||||
|
||||
const mem = buildMemPrompt(await memory.get(text));
|
||||
|
||||
const { textStream } = await u.Ai.Text("productionAgent").stream({
|
||||
messages: [
|
||||
{ role: "system", content: prompt },
|
||||
{ role: "assistant", content: mem },
|
||||
{ role: "assistant", content: mem + "\n" + modelInfo },
|
||||
{ role: "user", content: text },
|
||||
],
|
||||
abortSignal,
|
||||
@ -138,13 +149,20 @@ function createSubAgent(parentCtx: AgentContext) {
|
||||
"分镜面板:<storyboardItem videoDesc='视频描述' prompt=提示词内容 track='分组' duration='视频推荐时间' associateAssetsIds='[该分镜所需的资产ID列表]'></storyboardItem>",
|
||||
"```",
|
||||
].join("\n");
|
||||
const projectData = await u.db("o_project").where("id", resTool.data.projectId).first();
|
||||
const modelInfo = `项目使用的模型如下:\n图像模型:${projectData?.imageModel}\n视频模型:${projectData?.videoModel}`;
|
||||
|
||||
|
||||
const projectInfo = await u.db("o_project").where("id", resTool.data.projectId).first();
|
||||
if (!projectInfo) throw new Error(`项目不存在,ID: ${resTool.data.projectId}`);
|
||||
const artSkills = await createArtSkills(projectInfo?.artStyle!);
|
||||
|
||||
const [_, imageModelName] = projectInfo.imageModel!.split(":");
|
||||
const [id, videoModelName] = projectInfo.videoModel!.split(":");
|
||||
const data = await u.db("o_vendorConfig").where("id", id).select("models").first();
|
||||
const models = JSON.parse(data!.models!);
|
||||
const findData = models.find((i: any) => i.modelName == name);
|
||||
const isRef = findData.mode.every((i: any) => Array.isArray(i));
|
||||
const modelInfo = `项目使用的模型如下:\n图像模型:${imageModelName}\n视频模型:${videoModelName}\n多参:${isRef ? "是" : "否"}`;
|
||||
|
||||
return runAgent({
|
||||
prompt,
|
||||
system: systemPrompt + addPrompt,
|
||||
@ -194,7 +212,6 @@ async function createArtSkills(artName: string) {
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
function removeAllXmlTags(text: string): string {
|
||||
text = text.replace(/<([a-zA-Z][\w-]*)(\s+[^>]*)?>([\s\S]*?)<\/\1>/g, "");
|
||||
text = text.replace(/<([a-zA-Z][\w-]*)(\s+[^>]*)?\/>/g, "");
|
||||
|
||||
@ -28,10 +28,11 @@ export default router.post(
|
||||
async (req, res) => {
|
||||
const { reinstall, url } = req.body;
|
||||
const rootDir = u.getPath(["temp"]);
|
||||
fs.mkdirSync(rootDir, { recursive: true });
|
||||
fs.mkdirSync(rootDir, { recursive: true });
|
||||
if (reinstall) {
|
||||
const response = await axios.get(url, { responseType: "arraybuffer" });
|
||||
const ext = path.extname(new URL(url).pathname) || (process.platform === "win32" ? ".exe" : process.platform === "darwin" ? ".dmg" : ".AppImage");
|
||||
const ext =
|
||||
path.extname(new URL(url).pathname) || (process.platform === "win32" ? ".exe" : process.platform === "darwin" ? ".dmg" : ".AppImage");
|
||||
const installerPath = path.join(rootDir, `latest${ext}`);
|
||||
fs.writeFileSync(installerPath, response.data);
|
||||
runInstaller(installerPath);
|
||||
@ -41,13 +42,21 @@ export default router.post(
|
||||
fs.writeFileSync(`${rootDir}/latest.zip`, zip);
|
||||
await compressing.zip.uncompress(`${rootDir}/latest.zip`, rootDir);
|
||||
const tempServerPath = u.getPath(["temp", "serve"]);
|
||||
const webPath = u.getPath(["temp", "web"]);
|
||||
if (!fs.existsSync(tempServerPath) || !fs.existsSync(webPath)) {
|
||||
fs.rmSync(rootDir, { recursive: true, force: true });
|
||||
return res.status(400).send(error("服务器文件不存在"));
|
||||
if (fs.existsSync(tempServerPath)) {
|
||||
fs.cpSync(tempServerPath, u.getPath(["serve"]), { recursive: true });
|
||||
}
|
||||
const webPath = u.getPath(["temp", "web"]);
|
||||
if (fs.existsSync(webPath)) {
|
||||
fs.cpSync(webPath, u.getPath(["web"]), { recursive: true });
|
||||
}
|
||||
const tempSkillsPath = u.getPath(["temp", "skills"]);
|
||||
if (fs.existsSync(tempSkillsPath)) {
|
||||
fs.cpSync(tempSkillsPath, u.getPath(["skills"]), { recursive: true, force: false });
|
||||
}
|
||||
const tempModelsPath = u.getPath(["temp", "models"]);
|
||||
if (fs.existsSync(tempModelsPath)) {
|
||||
fs.cpSync(tempModelsPath, u.getPath(["models"]), { recursive: true, force: false });
|
||||
}
|
||||
fs.cpSync(tempServerPath, u.getPath(["serve"]), { recursive: true });
|
||||
fs.cpSync(webPath, u.getPath(["web"]), { recursive: true });
|
||||
fs.rmSync(rootDir, { recursive: true, force: true });
|
||||
res.status(200).send(success("更新成功,5秒后重启"));
|
||||
}
|
||||
|
||||
@ -14,7 +14,5 @@ export default router.post("/", async (req, res) => {
|
||||
onlyFiles: true,
|
||||
});
|
||||
|
||||
console.log("%c Line:15 🍺 entries", "background:#e41a6a", entries);
|
||||
|
||||
res.status(200).send(success(entries));
|
||||
});
|
||||
|
||||
86
src/types/database.d.ts
vendored
86
src/types/database.d.ts
vendored
@ -1,81 +1,6 @@
|
||||
<<<<<<< HEAD
|
||||
// @db-hash a716ace4700f9295d6e6ba5efb945fec
|
||||
// @db-hash 6fa5017e455bc367c9c902ba574d11b4
|
||||
//该文件由脚本自动生成,请勿手动修改
|
||||
|
||||
=======
|
||||
// @db-hash 34cef71f073127ef469a712aa9d9ba8f
|
||||
//该文件由脚本自动生成,请勿手动修改
|
||||
|
||||
export interface _o_project_old_20260402 {
|
||||
'artStyle'?: string | null;
|
||||
'createTime'?: number | null;
|
||||
'id'?: number | null;
|
||||
'imageModel'?: string | null;
|
||||
'imageQuality'?: string | null;
|
||||
'intro'?: string | null;
|
||||
'mode'?: string | null;
|
||||
'name'?: string | null;
|
||||
'projectType'?: string | null;
|
||||
'type'?: string | null;
|
||||
'userId'?: number | null;
|
||||
'videoModel'?: string | null;
|
||||
'videoRatio'?: string | null;
|
||||
}
|
||||
export interface _o_storyboard_old_20260402 {
|
||||
'createTime'?: number | null;
|
||||
'duration'?: string | null;
|
||||
'filePath'?: string | null;
|
||||
'flowId'?: number | null;
|
||||
'id'?: number;
|
||||
'index'?: number | null;
|
||||
'projectId'?: number | null;
|
||||
'prompt'?: string | null;
|
||||
'reason'?: string | null;
|
||||
'scriptId'?: number | null;
|
||||
'state'?: string | null;
|
||||
'trackId'?: number | null;
|
||||
}
|
||||
export interface _o_storyboard_old_20260402_1 {
|
||||
'createTime'?: number | null;
|
||||
'duration'?: string | null;
|
||||
'filePath'?: string | null;
|
||||
'flowId'?: number | null;
|
||||
'id'?: number;
|
||||
'index'?: number | null;
|
||||
'projectId'?: number | null;
|
||||
'prompt'?: string | null;
|
||||
'reason'?: string | null;
|
||||
'scriptId'?: number | null;
|
||||
'shouldGenerateImage'?: number | null;
|
||||
'state'?: string | null;
|
||||
'track'?: string | null;
|
||||
'trackId'?: number | null;
|
||||
'videoPrompt'?: string | null;
|
||||
}
|
||||
export interface _o_vendorConfig_old_20260401 {
|
||||
'author'?: string | null;
|
||||
'code'?: string | null;
|
||||
'createTime'?: number | null;
|
||||
'description'?: string | null;
|
||||
'enableEnglish'?: number | null;
|
||||
'icon'?: string | null;
|
||||
'id'?: string;
|
||||
'inputs'?: string | null;
|
||||
'inputValues'?: string | null;
|
||||
'models'?: string | null;
|
||||
'name'?: string | null;
|
||||
}
|
||||
export interface _o_videoTrack_old_20260402 {
|
||||
'id'?: number;
|
||||
'projectId'?: number | null;
|
||||
'prompt'?: string | null;
|
||||
'reason'?: string | null;
|
||||
'scriptId'?: number | null;
|
||||
'selectVideoId'?: number | null;
|
||||
'state'?: string | null;
|
||||
'videoId'?: number | null;
|
||||
}
|
||||
>>>>>>> 9d683e67bba6b5a4d4489a4202e4af4a738bca59
|
||||
export interface memories {
|
||||
'content': string;
|
||||
'createTime': number;
|
||||
@ -250,6 +175,7 @@ export interface o_storyboard {
|
||||
'scriptId'?: number | null;
|
||||
'shouldGenerateImage'?: number | null;
|
||||
'state'?: string | null;
|
||||
'track'?: string | null;
|
||||
'trackId'?: number | null;
|
||||
'videoDesc'?: string | null;
|
||||
}
|
||||
@ -305,14 +231,6 @@ export interface o_videoTrack {
|
||||
}
|
||||
|
||||
export interface DB {
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
"_o_project_old_20260402": _o_project_old_20260402;
|
||||
"_o_storyboard_old_20260402": _o_storyboard_old_20260402;
|
||||
"_o_storyboard_old_20260402_1": _o_storyboard_old_20260402_1;
|
||||
"_o_vendorConfig_old_20260401": _o_vendorConfig_old_20260401;
|
||||
"_o_videoTrack_old_20260402": _o_videoTrack_old_20260402;
|
||||
>>>>>>> 9d683e67bba6b5a4d4489a4202e4af4a738bca59
|
||||
"memories": memories;
|
||||
"o_agentDeploy": o_agentDeploy;
|
||||
"o_agentWorkData": o_agentWorkData;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user