MCPcopy Create free account
hub / github.com/admineral/OpenAI-Assistant-API-Chat / POST

Function POST

app/api/checkRunStatus/route.ts:24–46  ·  view source on GitHub ↗
(req: NextRequest)

Source from the content-addressed store, hash-verified

22});
23
24export async function POST(req: NextRequest) {
25 try {
26 // Extract JSON data from the request
27 const data = await req.json();
28 const threadId = data.threadId;
29 const runId = data.runId;
30
31 // Log the received thread ID and run ID for debugging
32 console.log(`Received request with threadId: ${threadId} and runId: ${runId}`);
33
34 // Retrieve the status of the run for the given thread ID and run ID using the OpenAI API
35 const runStatus = await openai.beta.threads.runs.retrieve(threadId, runId);
36
37 // Log the retrieved run status for debugging
38 console.log(`Retrieved run status: ${runStatus.status}`);
39
40 // Return the retrieved run status as a JSON response
41 return NextResponse.json({ status: runStatus.status });
42 } catch (error) {
43 // Log any errors that occur during the process
44 console.error(`Error occurred: ${error}`);
45 }
46}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected