no message

This commit is contained in:
ACT丶流星雨 2026-02-05 10:15:41 +08:00
parent 88a58b886b
commit 709127cbfa

View File

@ -1,6 +1,6 @@
import "../type"; import "../type";
import axios from "axios"; import axios from "axios";
import u from "@/utils"; import { pollTask } from "@/utils/ai/utils";
interface DoubaoVideoConfig { interface DoubaoVideoConfig {
prompt: string; prompt: string;
@ -11,20 +11,6 @@ interface DoubaoVideoConfig {
audio?: boolean; audio?: boolean;
} }
const pollTask = async (
queryFn: () => Promise<{ completed: boolean; imageUrl?: string; error?: string }>,
maxAttempts = 500,
interval = 2000,
): Promise<string> => {
for (let i = 0; i < maxAttempts; i++) {
await new Promise((resolve) => setTimeout(resolve, interval));
const { completed, imageUrl, error } = await queryFn();
if (error) throw new Error(error);
if (completed && imageUrl) return imageUrl;
}
throw new Error(`任务轮询超时,已尝试 ${maxAttempts}`);
};
export default async (input: ImageConfig, config: AIConfig) => { export default async (input: ImageConfig, config: AIConfig) => {
console.log("%c Line:5 🍓 input", "background:#7f2b82", input); console.log("%c Line:5 🍓 input", "background:#7f2b82", input);
console.log("%c Line:5 🍎 config", "background:#93c0a4", config); console.log("%c Line:5 🍎 config", "background:#93c0a4", config);