From bd5b2cc64ee1e64b925a0bda441745b8d2071ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?ACT=E4=B8=B6=E6=B5=81=E6=98=9F=E9=9B=A8?= <1340145680@qq.com> Date: Fri, 6 Feb 2026 16:51:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4axios=E9=87=8D=E8=AF=95?= =?UTF-8?q?=EF=BC=8C=E6=98=8E=E7=A1=AEruninghub=E7=9A=84=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/utils/ai/generateVideo.ts | 1 - src/utils/ai/image/owned/apimart.ts | 2 -- src/utils/ai/image/owned/runninghub.ts | 6 ++---- 3 files changed, 2 insertions(+), 7 deletions(-) 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;