Merge branch 'develop' of https://github.com/HBAI-Ltd/Toonflow-app into develop

This commit is contained in:
zhishi 2026-02-06 16:58:28 +08:00
commit 981b6fe863
5 changed files with 5 additions and 10 deletions

View File

@ -1,5 +1,5 @@
{ {
"name": "toonflow-app", "name": "toonflow-app",
"version": "1.0.5", "version": "1.0.5",
"description": "Toonflow 是一款 AI 短剧漫剧工具,能够利用 AI 技术将小说自动转化为剧本,并结合 AI 生成的图片和视频,实现高效的短剧创作。", "description": "Toonflow 是一款 AI 短剧漫剧工具,能够利用 AI 技术将小说自动转化为剧本,并结合 AI 生成的图片和视频,实现高效的短剧创作。",
"author": "HBAI-Ltd <ltlctools@outlook.com>", "author": "HBAI-Ltd <ltlctools@outlook.com>",

View File

@ -7,7 +7,6 @@ import logger from "morgan";
import cors from "cors"; import cors from "cors";
import buildRoute from "@/core"; import buildRoute from "@/core";
import fs from "fs"; import fs from "fs";
import router from "@/router";
import path from "path"; import path from "path";
import u from "@/utils"; import u from "@/utils";
import jwt from "jsonwebtoken"; 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 处理 // 404 处理
app.use((_, res, next: NextFunction) => { app.use((_, res, next: NextFunction) => {

View File

@ -1,7 +1,6 @@
import axios from "axios"; import axios from "axios";
import u from "@/utils"; import u from "@/utils";
import FormData from "form-data"; import FormData from "form-data";
import axiosRetry from "axios-retry";
import sharp from "sharp"; import sharp from "sharp";
type VideoAspectRatio = "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "21:9" | "adaptive"; type VideoAspectRatio = "16:9" | "9:16" | "1:1" | "4:3" | "3:4" | "21:9" | "adaptive";

View File

@ -1,8 +1,6 @@
import axios from "axios"; import axios from "axios";
import axiosRetry from "axios-retry";
import { pollTask } from "@/utils/ai/utils"; import { pollTask } from "@/utils/ai/utils";
axiosRetry(axios, { retries: 3, retryDelay: () => 200 });
export default async (input: ImageConfig, config: AIConfig): Promise<string> => { export default async (input: ImageConfig, config: AIConfig): Promise<string> => {
if (!config.apiKey) throw new Error("缺少API Key"); if (!config.apiKey) throw new Error("缺少API Key");

View File

@ -1,10 +1,8 @@
import axios from "axios"; import axios from "axios";
import FormData from "form-data"; import FormData from "form-data";
import axiosRetry from "axios-retry";
import sharp from "sharp"; import sharp from "sharp";
import { pollTask } from "@/utils/ai/utils"; import { pollTask } from "@/utils/ai/utils";
axiosRetry(axios, { retries: 3, retryDelay: () => 200 });
// 上传 base64 图片到 runninghub // 上传 base64 图片到 runninghub
const uploadBase64ToRunninghub = async (base64Image: string, apiKey: string, baseURL: string): Promise<string> => { const uploadBase64ToRunninghub = async (base64Image: string, apiKey: string, baseURL: string): Promise<string> => {
try { try {
@ -13,8 +11,8 @@ const uploadBase64ToRunninghub = async (base64Image: string, apiKey: string, bas
const base64Data = base64Image.replace(/^data:image\/\w+;base64,/, ""); const base64Data = base64Image.replace(/^data:image\/\w+;base64,/, "");
let buffer = Buffer.from(base64Data, "base64"); let buffer = Buffer.from(base64Data, "base64");
// 压缩图片到 5MB 以下 // 压缩图片到 7MB 以下
const MAX_SIZE = 5 * 1024 * 1024; // 5MB const MAX_SIZE = 7 * 1024 * 1024; // 7MB
if (buffer.length > MAX_SIZE) { if (buffer.length > MAX_SIZE) {
let quality = 90; let quality = 90;