diff --git a/src/lib/initDB.ts b/src/lib/initDB.ts index 283b4cd..a17a7a5 100644 --- a/src/lib/initDB.ts +++ b/src/lib/initDB.ts @@ -43,6 +43,7 @@ export default async (knex: Knex, forceInit: boolean = false): Promise => table.integer("createTime"); table.integer("userId"); table.primary(["id"]); + table.unique(["id"]); }, }, //风格表 diff --git a/src/routes/production/workbench/generateVideoPrompt.ts b/src/routes/production/workbench/generateVideoPrompt.ts index 74a1deb..a0bf5ca 100644 --- a/src/routes/production/workbench/generateVideoPrompt.ts +++ b/src/routes/production/workbench/generateVideoPrompt.ts @@ -92,22 +92,26 @@ export default router.post( )}, `; - const { text } = await u.Ai.Text("universalAi").invoke({ - system: videoPrompt?.data!, - messages: [ - { - role: "assistant", - content: `${visualManual}`, - }, - { - role: "user", - content: content, - }, - ], - }); - await u.db("o_videoTrack").where({ id: trackId }).update({ - prompt: text, - }); - res.status(200).send(success(text)); + try { + const { text } = await u.Ai.Text("universalAi").invoke({ + system: videoPrompt?.data!, + messages: [ + { + role: "assistant", + content: `${visualManual}`, + }, + { + role: "user", + content: content, + }, + ], + }); + await u.db("o_videoTrack").where({ id: trackId }).update({ + prompt: text, + }); + res.status(200).send(success(text)); + } catch (error) { + res.status(500).send(error); + } }, ); diff --git a/src/types/database.d.ts b/src/types/database.d.ts index 1af96b9..dc02b6a 100644 --- a/src/types/database.d.ts +++ b/src/types/database.d.ts @@ -1,6 +1,22 @@ -// @db-hash 6fa5017e455bc367c9c902ba574d11b4 +// @db-hash 19c726e36479d905346c772cfa8007ba //该文件由脚本自动生成,请勿手动修改 +export interface _o_project_old_20260404 { + 'artStyle'?: string | null; + 'createTime'?: number | null; + 'directorManual'?: string | 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 memories { 'content': string; 'createTime': number; @@ -231,6 +247,7 @@ export interface o_videoTrack { } export interface DB { + "_o_project_old_20260404": _o_project_old_20260404; "memories": memories; "o_agentDeploy": o_agentDeploy; "o_agentWorkData": o_agentWorkData;