修复api删除,导致模型删除问题

This commit is contained in:
zhishi 2026-02-07 23:32:47 +08:00
parent 5d92896eb4
commit 32ac82b08b
5 changed files with 25 additions and 27 deletions

View File

@ -212,7 +212,7 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
table.integer("id").notNullable(); table.integer("id").notNullable();
table.integer("scriptId"); // 关联的脚本ID table.integer("scriptId"); // 关联的脚本ID
table.integer("projectId"); // 关联的项目ID table.integer("projectId"); // 关联的项目ID
table.integer("aiConfigId");//ai配置ID table.integer("aiConfigId"); //ai配置ID
table.text("manufacturer"); // 厂商volcengine/runninghub/openAi table.text("manufacturer"); // 厂商volcengine/runninghub/openAi
table.text("mode"); // 模式startEnd/multi/single table.text("mode"); // 模式startEnd/multi/single
table.text("startFrame"); // 首帧图片信息 JSON table.text("startFrame"); // 首帧图片信息 JSON
@ -249,41 +249,39 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
{ {
id: 2, id: 2,
configId: null, configId: null,
name: "分镜Agent图片生成",
name: "大纲故事线Agent", key: "storyboardImage",
key: "outlineScriptAgent",
}, },
{ {
id: 3, id: 3,
configId: null, configId: null,
name: "大纲故事线Agent",
key: "outlineScriptAgent",
},
{
id: 4,
configId: null,
name: "资产提示词润色", name: "资产提示词润色",
key: "assetsPrompt", key: "assetsPrompt",
}, },
{ {
id: 4, id: 5,
configId: null, configId: null,
name: "资产图片生成", name: "资产图片生成",
key: "assetsImage", key: "assetsImage",
}, },
{ {
id: 5, id: 6,
configId: null, configId: null,
name: "剧本生成", name: "剧本生成",
key: "generateScript", key: "generateScript",
}, },
{ {
id: 6, id: 7,
configId: null, configId: null,
name: "视频提示词生成", name: "视频提示词生成",
key: "videoPrompt", key: "videoPrompt",
}, },
{
id: 7,
configId: null,
name: "分镜图片生成",
key: "storyboardImage",
},
{ {
id: 8, id: 8,
configId: null, configId: null,

View File

@ -13,7 +13,7 @@ export default router.post(
async (req, res) => { async (req, res) => {
const { id } = req.body; const { id } = req.body;
await u.db("t_config").where("id", id).delete(); 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("删除成功")); res.status(200).send(success("删除成功"));
}, },
); );

View File

@ -8,6 +8,6 @@ export default router.post("/", async (req, res) => {
const configData = await u const configData = await u
.db("t_aiModelMap") .db("t_aiModelMap")
.leftJoin("t_config", "t_aiModelMap.configId", "t_config.id") .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)); res.status(200).send(success(configData));
}); });

View File

@ -23,7 +23,7 @@ interface AIConfig {
} }
const buildOptions = async (input: AIInput<any>, config: AIConfig = {}) => { const buildOptions = async (input: AIInput<any>, 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 }; const { model, apiKey, baseURL, manufacturer } = { ...config };
let owned; let owned;
if (manufacturer == "other") { if (manufacturer == "other") {

View File

@ -48,7 +48,7 @@ const modelList: Owned[] = [
// 豆包 // 豆包
{ {
manufacturer: "doubao", manufacturer: "doubao",
model: "doubao-seed-1-8", model: "doubao-seed-1-8-251228",
responseFormat: "schema", responseFormat: "schema",
image: true, image: true,
think: true, think: true,
@ -57,7 +57,7 @@ const modelList: Owned[] = [
}, },
{ {
manufacturer: "doubao", manufacturer: "doubao",
model: "doubao-seed-1-6", model: "doubao-seed-1-6-251015",
responseFormat: "schema", responseFormat: "schema",
image: true, image: true,
think: true, think: true,
@ -66,7 +66,7 @@ const modelList: Owned[] = [
}, },
{ {
manufacturer: "doubao", manufacturer: "doubao",
model: "doubao-seed-1-6-lite", model: "doubao-seed-1-6-lite-251015",
responseFormat: "schema", responseFormat: "schema",
image: true, image: true,
think: true, think: true,
@ -75,7 +75,7 @@ const modelList: Owned[] = [
}, },
{ {
manufacturer: "doubao", manufacturer: "doubao",
model: "doubao-seed-1-6-flash", model: "doubao-seed-1-6-flash-250828",
responseFormat: "schema", responseFormat: "schema",
image: true, image: true,
think: true, think: true,
@ -286,7 +286,7 @@ const modelList: Owned[] = [
// Gemini // Gemini
{ {
manufacturer: "google", manufacturer: "gemini",
model: "gemini-2.5-pro", model: "gemini-2.5-pro",
responseFormat: "schema", responseFormat: "schema",
image: true, image: true,
@ -295,7 +295,7 @@ const modelList: Owned[] = [
tool: true, tool: true,
}, },
{ {
manufacturer: "google", manufacturer: "gemini",
model: "gemini-2.5-flash", model: "gemini-2.5-flash",
responseFormat: "schema", responseFormat: "schema",
image: true, image: true,
@ -304,7 +304,7 @@ const modelList: Owned[] = [
tool: true, tool: true,
}, },
{ {
manufacturer: "google", manufacturer: "gemini",
model: "gemini-2.0-flash", model: "gemini-2.0-flash",
responseFormat: "schema", responseFormat: "schema",
image: true, image: true,
@ -313,7 +313,7 @@ const modelList: Owned[] = [
tool: true, tool: true,
}, },
{ {
manufacturer: "google", manufacturer: "gemini",
model: "gemini-2.0-flash-lite", model: "gemini-2.0-flash-lite",
responseFormat: "schema", responseFormat: "schema",
image: true, image: true,
@ -322,7 +322,7 @@ const modelList: Owned[] = [
tool: true, tool: true,
}, },
{ {
manufacturer: "google", manufacturer: "gemini",
model: "gemini-1.5-pro", model: "gemini-1.5-pro",
responseFormat: "schema", responseFormat: "schema",
image: true, image: true,
@ -331,7 +331,7 @@ const modelList: Owned[] = [
tool: true, tool: true,
}, },
{ {
manufacturer: "google", manufacturer: "gemini",
model: "gemini-1.5-flash", model: "gemini-1.5-flash",
responseFormat: "schema", responseFormat: "schema",
image: true, image: true,