0.1.13 AI功能大改
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
|
||||
export async function GET() {
|
||||
const backendUrl = process.env.BACKEND_URL ?? process.env.NEXT_PUBLIC_BACKEND_URL;
|
||||
if (!backendUrl) {
|
||||
return NextResponse.json({ status: "disabled" }, { status: 200 });
|
||||
}
|
||||
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), 2500);
|
||||
try {
|
||||
const response = await fetch(`${backendUrl}/health`, {
|
||||
method: "GET",
|
||||
signal: controller.signal,
|
||||
});
|
||||
return NextResponse.json({ status: response.ok ? "ok" : "error" }, { status: 200 });
|
||||
} catch {
|
||||
return NextResponse.json({ status: "error" }, { status: 200 });
|
||||
} finally {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user