mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
f6fab281ae
* feat(runtime): rename remoteActions argument to remoteEndpoints * feat(remote-actions): integrate langgraph-cloud as a remote action for CoAgents * feat(runtime): rename remoteActions argument to remoteEndpoints * feat(remote-actions): integrate langgraph-cloud as a remote action for CoAgents * feat(sdk-js): add SDK for LangGraph JS support --------- Co-authored-by: Markus Ecker <markus.ecker@gmail.com> Co-authored-by: Ariel Weinberger <weinberger.ariel@gmail.com>
29 lines
656 B
TypeScript
29 lines
656 B
TypeScript
import { NextRequest } from "next/server";
|
|
import {
|
|
CopilotRuntime,
|
|
OpenAIAdapter,
|
|
copilotRuntimeNextJSAppRouterEndpoint,
|
|
} from "@copilotkit/runtime";
|
|
import OpenAI from "openai";
|
|
|
|
const openai = new OpenAI();
|
|
const serviceAdapter = new OpenAIAdapter({ openai });
|
|
|
|
const runtime = new CopilotRuntime({
|
|
remoteEndpoints: [
|
|
{
|
|
url: process.env.REMOTE_ACTION_URL || "http://localhost:8000/copilotkit",
|
|
},
|
|
],
|
|
});
|
|
|
|
export const POST = async (req: NextRequest) => {
|
|
const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({
|
|
runtime,
|
|
serviceAdapter,
|
|
endpoint: "/api/copilotkit",
|
|
});
|
|
|
|
return handleRequest(req);
|
|
};
|