diff --git a/package.json b/package.json index aef8b37..35962ed 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "toonflow-app", + "name": "toonflow-app", "version": "1.0.5", "description": "Toonflow 是一款 AI 短剧漫剧工具,能够利用 AI 技术将小说自动转化为剧本,并结合 AI 生成的图片和视频,实现高效的短剧创作。", "author": "HBAI-Ltd ", diff --git a/src/app.ts b/src/app.ts index f3f8513..28e6263 100644 --- a/src/app.ts +++ b/src/app.ts @@ -7,7 +7,6 @@ import logger from "morgan"; import cors from "cors"; import buildRoute from "@/core"; import fs from "fs"; -import router from "@/router"; import path from "path"; import u from "@/utils"; import jwt from "jsonwebtoken"; @@ -62,7 +61,8 @@ export default async function startServe() { } }); - await router(app); + const router = await import("@/router"); + await router.default(app); // 404 处理 app.use((_, res, next: NextFunction) => { diff --git a/src/utils/ai/generateVideo.ts b/src/utils/ai/generateVideo.ts index d82e6b1..6ace39d 100644 --- a/src/utils/ai/generateVideo.ts +++ b/src/utils/ai/generateVideo.ts @@ -1,7 +1,6 @@ import axios from "axios"; import u from "@/utils"; import FormData from "form-data"; -import axiosRetry from "axios-retry"; import sharp from "sharp"; type VideoAspectRatio = "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "21:9" | "adaptive"; diff --git a/src/utils/ai/image/owned/apimart.ts b/src/utils/ai/image/owned/apimart.ts index 914aaeb..eab1174 100644 --- a/src/utils/ai/image/owned/apimart.ts +++ b/src/utils/ai/image/owned/apimart.ts @@ -1,8 +1,6 @@ import axios from "axios"; -import axiosRetry from "axios-retry"; import { pollTask } from "@/utils/ai/utils"; -axiosRetry(axios, { retries: 3, retryDelay: () => 200 }); export default async (input: ImageConfig, config: AIConfig): Promise => { if (!config.apiKey) throw new Error("缺少API Key"); diff --git a/src/utils/ai/image/owned/runninghub.ts b/src/utils/ai/image/owned/runninghub.ts index 032a15c..79a00d5 100644 --- a/src/utils/ai/image/owned/runninghub.ts +++ b/src/utils/ai/image/owned/runninghub.ts @@ -1,10 +1,8 @@ import axios from "axios"; import FormData from "form-data"; -import axiosRetry from "axios-retry"; import sharp from "sharp"; import { pollTask } from "@/utils/ai/utils"; -axiosRetry(axios, { retries: 3, retryDelay: () => 200 }); // 上传 base64 图片到 runninghub const uploadBase64ToRunninghub = async (base64Image: string, apiKey: string, baseURL: string): Promise => { try { @@ -13,8 +11,8 @@ const uploadBase64ToRunninghub = async (base64Image: string, apiKey: string, bas const base64Data = base64Image.replace(/^data:image\/\w+;base64,/, ""); let buffer = Buffer.from(base64Data, "base64"); - // 压缩图片到 5MB 以下 - const MAX_SIZE = 5 * 1024 * 1024; // 5MB + // 压缩图片到 7MB 以下 + const MAX_SIZE = 7 * 1024 * 1024; // 7MB if (buffer.length > MAX_SIZE) { let quality = 90;