mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
4acf4dd71d
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
20 lines
471 B
TypeScript
20 lines
471 B
TypeScript
import {
|
|
CopilotRuntime,
|
|
OpenAIAdapter,
|
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
} from '@copilotkit/runtime';
|
|
|
|
import { NextRequest } from 'next/server';
|
|
|
|
const serviceAdapter = new OpenAIAdapter();
|
|
const runtime = new CopilotRuntime();
|
|
|
|
export const POST = async (req: NextRequest) => {
|
|
const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({
|
|
runtime,
|
|
serviceAdapter,
|
|
endpoint: '/api/copilotkit',
|
|
});
|
|
|
|
return handleRequest(req);
|
|
}; |