1. 修复无法生成视频的问题

This commit is contained in:
ACT丶流星雨 2026-01-31 16:40:57 +08:00
parent 57d88cbb09
commit b44e7b6e59
6 changed files with 20 additions and 3 deletions

View File

@ -1,6 +1,6 @@
{
"name": "toonflow-serve",
"version": "1.0.3",
"version": "1.0.4",
"description": "ToonFlow Serve - Electron Application",
"main": "build/main.js",
"author": "ToonFlow Team",

13
src/lib/fixDB.ts Normal file
View File

@ -0,0 +1,13 @@
import { Knex } from "knex";
export default async (knex: Knex): Promise<void> => {
const hasTime = await knex.schema.hasColumn("t_video", "time");
if (!hasTime) {
await knex.schema.alterTable("t_video", (table) => {
table.integer("time");
});
console.log("字段 'time' 已添加到 t_video 表");
} else {
console.log("t_video 表已存在 'time' 字段");
}
};

View File

@ -151,6 +151,7 @@ export default async (knex: Knex, forceInit: boolean = false): Promise<void> =>
table.text("firstFrame");
table.text("storyboardImgs");
table.text("model");
table.integer("time");
table.integer("state");
table.integer("scriptId");
table.integer("configId"); // 关联的视频配置ID

View File

@ -1,4 +1,4 @@
// @db-hash f95df46ccfda3c7f0b2a9cefdc399035
// @db-hash b6b4d8cdc25a2f4d60f1c239cd7e7060
//该文件由脚本自动生成,请勿手动修改
export interface t_assets {
@ -128,6 +128,7 @@ export interface t_video {
'scriptId'?: number | null;
'state'?: number | null;
'storyboardImgs'?: string | null;
'time'?: number | null;
}
export interface t_videoConfig {
'createTime'?: number | null;

View File

@ -239,7 +239,7 @@ const generateVideoWithConfig = async (config: VideoConfig, configItem: { model:
const createRes = await axios.post(
baseURL ?? "https://ark.cn-beijing.volces.com/api/v3/contents/generations/tasks",
{
model,
model: "doubao-seedance-1-5-pro-251215",
content: [
{ type: "text", text: config.prompt },
...(doubaoConfig.imageBase64

View File

@ -4,6 +4,7 @@ import fs from "fs";
import path from "path";
import knex from "knex";
import initDB from "@/lib/initDB";
import fixDB from "@/lib/fixDB";
import type { DB } from "@/types/database";
import crypto from "crypto";
@ -40,6 +41,7 @@ const db = knex({
});
initDB(db);
fixDB(db);
if (process.env.NODE_ENV == "dev") initKnexType(db);