From 32ac82b08b024c4e5e99901d919e462e0a5e8fc8 Mon Sep 17 00:00:00 2001 From: zhishi <1951671751@qq.com> Date: Sat, 7 Feb 2026 23:32:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dapi=E5=88=A0=E9=99=A4?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E8=87=B4=E6=A8=A1=E5=9E=8B=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/initDB.ts | 26 ++++++++++++-------------- src/routes/setting/delModel.ts | 2 +- src/routes/setting/getAiModelMap.ts | 2 +- src/utils/ai/text/index.ts | 2 +- src/utils/ai/text/modelList.ts | 20 ++++++++++---------- 5 files changed, 25 insertions(+), 27 deletions(-) diff --git a/src/lib/initDB.ts b/src/lib/initDB.ts index 8876fe0..71c2672 100644 --- a/src/lib/initDB.ts +++ b/src/lib/initDB.ts @@ -212,7 +212,7 @@ export default async (knex: Knex, forceInit: boolean = false): Promise => table.integer("id").notNullable(); table.integer("scriptId"); // 关联的脚本ID table.integer("projectId"); // 关联的项目ID - table.integer("aiConfigId");//ai配置ID + table.integer("aiConfigId"); //ai配置ID table.text("manufacturer"); // 厂商:volcengine/runninghub/openAi table.text("mode"); // 模式:startEnd/multi/single table.text("startFrame"); // 首帧图片信息 JSON @@ -249,41 +249,39 @@ export default async (knex: Knex, forceInit: boolean = false): Promise => { id: 2, configId: null, - - name: "大纲故事线Agent", - key: "outlineScriptAgent", + name: "分镜Agent图片生成", + key: "storyboardImage", }, { id: 3, configId: null, - + name: "大纲故事线Agent", + key: "outlineScriptAgent", + }, + { + id: 4, + configId: null, name: "资产提示词润色", key: "assetsPrompt", }, { - id: 4, + id: 5, configId: null, name: "资产图片生成", key: "assetsImage", }, { - id: 5, + id: 6, configId: null, name: "剧本生成", key: "generateScript", }, { - id: 6, + id: 7, configId: null, name: "视频提示词生成", key: "videoPrompt", }, - { - id: 7, - configId: null, - name: "分镜图片生成", - key: "storyboardImage", - }, { id: 8, configId: null, diff --git a/src/routes/setting/delModel.ts b/src/routes/setting/delModel.ts index 718eca7..802ae0c 100644 --- a/src/routes/setting/delModel.ts +++ b/src/routes/setting/delModel.ts @@ -13,7 +13,7 @@ export default router.post( async (req, res) => { const { id } = req.body; await u.db("t_config").where("id", id).delete(); - await u.db("t_aiModelMap").where("configId", id).delete(); + await u.db("t_aiModelMap").where("configId", id).update("configId",null); res.status(200).send(success("删除成功")); }, ); diff --git a/src/routes/setting/getAiModelMap.ts b/src/routes/setting/getAiModelMap.ts index ebd6d66..fa10f51 100644 --- a/src/routes/setting/getAiModelMap.ts +++ b/src/routes/setting/getAiModelMap.ts @@ -8,6 +8,6 @@ export default router.post("/", async (req, res) => { const configData = await u .db("t_aiModelMap") .leftJoin("t_config", "t_aiModelMap.configId", "t_config.id") - .select("t_aiModelMap.name", "t_config.model", "t_aiModelMap.id"); + .select("t_aiModelMap.name", "t_config.model", "t_aiModelMap.id", "t_aiModelMap.key"); res.status(200).send(success(configData)); }); diff --git a/src/utils/ai/text/index.ts b/src/utils/ai/text/index.ts index a353ab3..bfc45d7 100644 --- a/src/utils/ai/text/index.ts +++ b/src/utils/ai/text/index.ts @@ -23,7 +23,7 @@ interface AIConfig { } const buildOptions = async (input: AIInput, config: AIConfig = {}) => { - if (!config || !config?.model || !config?.apiKey || !config?.baseURL || !config?.manufacturer) throw new Error("请检查模型配置是否正确"); + if (!config || !config?.model || !config?.apiKey || !config?.manufacturer) throw new Error("请检查模型配置是否正确"); const { model, apiKey, baseURL, manufacturer } = { ...config }; let owned; if (manufacturer == "other") { diff --git a/src/utils/ai/text/modelList.ts b/src/utils/ai/text/modelList.ts index 4aca5ac..421885a 100644 --- a/src/utils/ai/text/modelList.ts +++ b/src/utils/ai/text/modelList.ts @@ -48,7 +48,7 @@ const modelList: Owned[] = [ // 豆包 { manufacturer: "doubao", - model: "doubao-seed-1-8", + model: "doubao-seed-1-8-251228", responseFormat: "schema", image: true, think: true, @@ -57,7 +57,7 @@ const modelList: Owned[] = [ }, { manufacturer: "doubao", - model: "doubao-seed-1-6", + model: "doubao-seed-1-6-251015", responseFormat: "schema", image: true, think: true, @@ -66,7 +66,7 @@ const modelList: Owned[] = [ }, { manufacturer: "doubao", - model: "doubao-seed-1-6-lite", + model: "doubao-seed-1-6-lite-251015", responseFormat: "schema", image: true, think: true, @@ -75,7 +75,7 @@ const modelList: Owned[] = [ }, { manufacturer: "doubao", - model: "doubao-seed-1-6-flash", + model: "doubao-seed-1-6-flash-250828", responseFormat: "schema", image: true, think: true, @@ -286,7 +286,7 @@ const modelList: Owned[] = [ // Gemini { - manufacturer: "google", + manufacturer: "gemini", model: "gemini-2.5-pro", responseFormat: "schema", image: true, @@ -295,7 +295,7 @@ const modelList: Owned[] = [ tool: true, }, { - manufacturer: "google", + manufacturer: "gemini", model: "gemini-2.5-flash", responseFormat: "schema", image: true, @@ -304,7 +304,7 @@ const modelList: Owned[] = [ tool: true, }, { - manufacturer: "google", + manufacturer: "gemini", model: "gemini-2.0-flash", responseFormat: "schema", image: true, @@ -313,7 +313,7 @@ const modelList: Owned[] = [ tool: true, }, { - manufacturer: "google", + manufacturer: "gemini", model: "gemini-2.0-flash-lite", responseFormat: "schema", image: true, @@ -322,7 +322,7 @@ const modelList: Owned[] = [ tool: true, }, { - manufacturer: "google", + manufacturer: "gemini", model: "gemini-1.5-pro", responseFormat: "schema", image: true, @@ -331,7 +331,7 @@ const modelList: Owned[] = [ tool: true, }, { - manufacturer: "google", + manufacturer: "gemini", model: "gemini-1.5-flash", responseFormat: "schema", image: true,