修复bug
This commit is contained in:
parent
b3154989e2
commit
76ed47f77d
@ -12,7 +12,7 @@ import { createXai } from "@ai-sdk/xai";
|
|||||||
import { createMinimax } from "vercel-minimax-ai-provider";
|
import { createMinimax } from "vercel-minimax-ai-provider";
|
||||||
import FormData from "form-data";
|
import FormData from "form-data";
|
||||||
import jsonwebtoken from "jsonwebtoken";
|
import jsonwebtoken from "jsonwebtoken";
|
||||||
|
import u from "@/utils";
|
||||||
export default function runCode(code: string, vendor?: Record<string, any>) {
|
export default function runCode(code: string, vendor?: Record<string, any>) {
|
||||||
// 创建一个沙盒
|
// 创建一个沙盒
|
||||||
const exports = {};
|
const exports = {};
|
||||||
@ -94,6 +94,7 @@ export async function pollTask(
|
|||||||
try {
|
try {
|
||||||
const result = await fn();
|
const result = await fn();
|
||||||
if (result.completed) return result;
|
if (result.completed) return result;
|
||||||
|
if(result?.error) return result;
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
return { completed: false, error: e?.message || "poll error" };
|
return { completed: false, error: e?.message || "poll error" };
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user