diff --git a/src/routes/setting/vendorConfig/addVendor.ts b/src/routes/setting/vendorConfig/addVendor.ts index 5ed265b..19797cd 100644 --- a/src/routes/setting/vendorConfig/addVendor.ts +++ b/src/routes/setting/vendorConfig/addVendor.ts @@ -81,6 +81,8 @@ export default router.post( } if ((vendor.id as string).includes(":")) return res.status(400).send(error("id不能包含英文冒号")); + const data = await u.db("o_vendorConfig").where("id", vendor.id).first(); + if (data) return res.status(500).send(error("供应商id已存在")); await u.db("o_vendorConfig").insert({ id: vendor.id, author: vendor.author, @@ -92,7 +94,7 @@ export default router.post( models: JSON.stringify(vendor.models ?? []), code: tsCode, createTime: Date.now(), - enable: 1, + enable: vendor.id == "toonflow" ? 1 : 0, }); res.status(200).send(success(result.data)); }, diff --git a/src/routes/setting/vendorConfig/updateCode.ts b/src/routes/setting/vendorConfig/updateCode.ts index 07333dc..838242f 100644 --- a/src/routes/setting/vendorConfig/updateCode.ts +++ b/src/routes/setting/vendorConfig/updateCode.ts @@ -36,7 +36,7 @@ const vendorConfigSchema = z.object({ modelName: z.string(), type: z.literal("image"), mode: z.array(z.enum(["text", "singleImage", "multiReference"])), - associationSkills:z.string().optional(), + associationSkills: z.string().optional(), }), z.object({ name: z.string(), @@ -44,19 +44,11 @@ const vendorConfigSchema = z.object({ type: z.literal("video"), mode: z.array( z.union([ - z.enum([ - "singleImage", - "startEndRequired", - "endFrameOptional", - "startFrameOptional", - "text", - "audioReference", - "videoReference", - ]), - z.array(z.enum(["audioReference", "videoReference", "textReference", "imageReference"])), + z.enum(["singleImage", "startEndRequired", "endFrameOptional", "startFrameOptional", "text", "audioReference", "videoReference"]), + z.array(z.enum(["audioReference", "videoReference", "textReference", "imageReference"])), ]), ), - associationSkills:z.string().optional(), + associationSkills: z.string().optional(), audio: z.union([z.literal("optional"), z.boolean()]), durationResolutionMap: z.array( z.object({ @@ -103,7 +95,7 @@ export default router.post( inputValues: JSON.stringify(vendor.inputValues ?? {}), models: JSON.stringify(vendor.models ?? []), code: tsCode, - enable: 0, + enable: vendor.id == "toonflow" ? 1 : 0, createTime: Date.now(), }); res.status(200).send(success(result.data)); diff --git a/src/routes/setting/vendorConfig/updateVendor.ts b/src/routes/setting/vendorConfig/updateVendor.ts index 788b327..6313450 100644 --- a/src/routes/setting/vendorConfig/updateVendor.ts +++ b/src/routes/setting/vendorConfig/updateVendor.ts @@ -67,7 +67,7 @@ export default router.post( inputs: JSON.stringify(inputs), inputValues: JSON.stringify(inputValues), models: JSON.stringify(models), - enable: 0, + enable: id == "toonflow" ? 1 : 0, }); res.status(200).send(success("更新成功")); }, diff --git a/src/types/database.d.ts b/src/types/database.d.ts index 1af96b9..62a13d9 100644 --- a/src/types/database.d.ts +++ b/src/types/database.d.ts @@ -1,6 +1,75 @@ -// @db-hash 6fa5017e455bc367c9c902ba574d11b4 +// @db-hash 35cf00f711e9d4df398703de70511684 //该文件由脚本自动生成,请勿手动修改 +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; +} export interface memories { 'content': string; 'createTime': number; @@ -76,6 +145,7 @@ export interface o_image { 'filePath'?: string | null; 'id'?: number; 'model'?: string | null; + 'reason'?: string | null; 'resolution'?: string | null; 'state'?: string | null; 'type'?: string | null; @@ -201,6 +271,7 @@ export interface o_vendorConfig { 'createTime'?: number | null; 'description'?: string | null; 'enable'?: number | null; + 'enableEnglish'?: number | null; 'icon'?: string | null; 'id'?: string; 'inputs'?: string | null; @@ -225,12 +296,16 @@ export interface o_videoTrack { 'prompt'?: string | null; 'reason'?: string | null; 'scriptId'?: number | null; - 'selectVideoId'?: number | null; 'state'?: string | null; 'videoId'?: number | null; } export interface DB { + "_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; "memories": memories; "o_agentDeploy": o_agentDeploy; "o_agentWorkData": o_agentWorkData;