移除axios重试,明确runinghub的文件大小限制

This commit is contained in:
ACT丶流星雨 2026-02-06 16:51:30 +08:00
parent b41c788bcb
commit bd5b2cc64e
3 changed files with 2 additions and 7 deletions

View File

@ -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";

View File

@ -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<string> => {
if (!config.apiKey) throw new Error("缺少API Key");

View File

@ -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<string> => {
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;