MCPcopy Create free account
hub / github.com/CopilotKit/OpenGenerativeUI / GET

Function GET

apps/app/src/app/api/pick/route.ts:5–20  ·  view source on GitHub ↗
(req: NextRequest)

Source from the content-addressed store, hash-verified

3
4/** GET — poll session status (desktop polls this) */
5export async function GET(req: NextRequest) {
6 const sessionId = req.nextUrl.searchParams.get("sessionId");
7 if (!sessionId) return NextResponse.json({ error: "missing sessionId" }, { status: 400 });
8
9 const session = getSession(sessionId);
10 if (!session) return NextResponse.json({ status: "waiting" });
11
12 // Consume the prompt on first read so duplicate polls don't re-trigger
13 if (session.status === "picked" && session.prompt) {
14 const prompt = session.prompt;
15 setSession(sessionId, { status: "picked" });
16 return NextResponse.json({ status: "picked", prompt });
17 }
18
19 return NextResponse.json(session);
20}
21
22/** PUT — mark session as scanned (mobile calls this on page load) */
23export async function PUT(req: NextRequest) {

Callers

nothing calls this directly

Calls 2

getSessionFunction · 0.90
setSessionFunction · 0.90

Tested by

no test coverage detected