diff --git a/data/latest.zip b/data/latest.zip new file mode 100644 index 0000000..259f86e Binary files /dev/null and b/data/latest.zip differ diff --git a/src/agents/productionAgent/index.ts b/src/agents/productionAgent/index.ts index 441d3e7..3228770 100644 --- a/src/agents/productionAgent/index.ts +++ b/src/agents/productionAgent/index.ts @@ -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) { "分镜面板:", "```", ].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, ""); diff --git a/src/routes/setting/about/downloadApp.ts b/src/routes/setting/about/downloadApp.ts index 4e64d7c..1a01072 100644 --- a/src/routes/setting/about/downloadApp.ts +++ b/src/routes/setting/about/downloadApp.ts @@ -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秒后重启")); } diff --git a/src/routes/setting/skillManagement/getSkillList.ts b/src/routes/setting/skillManagement/getSkillList.ts index 39c0371..99c33c4 100644 --- a/src/routes/setting/skillManagement/getSkillList.ts +++ b/src/routes/setting/skillManagement/getSkillList.ts @@ -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)); }); diff --git a/src/types/database.d.ts b/src/types/database.d.ts index 0c14533..1af96b9 100644 --- a/src/types/database.d.ts +++ b/src/types/database.d.ts @@ -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;