修复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("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<void> =>
{
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,

View File

@ -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("删除成功"));
},
);

View File

@ -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));
});

View File

@ -23,7 +23,7 @@ interface 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 };
let owned;
if (manufacturer == "other") {

View File

@ -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,