mirror of
https://github.com/Anil-matcha/Open-Generative-AI.git
synced 2026-05-07 01:17:18 +00:00
29 lines
704 B
JavaScript
29 lines
704 B
JavaScript
import { cookies } from "next/headers";
|
|
import AgentCreateClient from "./AgentCreateClient";
|
|
|
|
const BASE_URL = 'https://api.muapi.ai';
|
|
|
|
async function fetchUserData(apiKey) {
|
|
if (!apiKey) return null;
|
|
try {
|
|
const res = await fetch(`${BASE_URL}/api/v1/account/balance`, {
|
|
cache: "no-store",
|
|
headers: { "x-api-key": apiKey },
|
|
});
|
|
if (!res.ok) return null;
|
|
return await res.json();
|
|
} catch {
|
|
return null;
|
|
}
|
|
}
|
|
|
|
export default async function CreateAgentPage() {
|
|
const cookieStore = await cookies();
|
|
const apiKey = cookieStore.get("muapi_key")?.value;
|
|
|
|
const userData = await fetchUserData(apiKey);
|
|
|
|
return (
|
|
<AgentCreateClient userData={userData} />
|
|
);
|
|
}
|