File tree Expand file tree Collapse file tree 9 files changed +2545
-40
lines changed Expand file tree Collapse file tree 9 files changed +2545
-40
lines changed Original file line number Diff line number Diff line change @@ -34,3 +34,4 @@ yarn-error.log*
3434# typescript
3535* .tsbuildinfo
3636next-env.d.ts
37+ .env
Original file line number Diff line number Diff line change 1+ import {
2+ CopilotRuntime ,
3+ OpenAIAdapter ,
4+ copilotRuntimeNextJSAppRouterEndpoint ,
5+ } from "@copilotkit/runtime" ;
6+
7+ import { NextRequest } from "next/server" ;
8+
9+ const serviceAdapter = new OpenAIAdapter ( ) ;
10+ const runtime = new CopilotRuntime ( ) ;
11+
12+ export const POST = async ( req : NextRequest ) => {
13+ const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint ( {
14+ runtime,
15+ serviceAdapter,
16+ endpoint : "/api/copilotkit" ,
17+ } ) ;
18+
19+ return handleRequest ( req ) ;
20+ } ;
Original file line number Diff line number Diff line change @@ -7,11 +7,9 @@ import { CopilotPopup } from "@copilotkit/react-ui";
77import "@copilotkit/react-ui/styles.css" ;
88
99export default function Home ( ) {
10- const COPILOT_CLOUD_PUBLIC_API_KEY = process . env . NEXT_PUBLIC_COPILOT_CLOUD_PUBLIC_API_KEY ;
11-
1210 return (
1311 < >
14- < CopilotKit publicApiKey = { COPILOT_CLOUD_PUBLIC_API_KEY } >
12+ < CopilotKit runtimeUrl = "/api/copilotkit" >
1513 < TasksProvider >
1614 < TasksList />
1715 </ TasksProvider >
Original file line number Diff line number Diff line change 99 "lint" : " next lint"
1010 },
1111 "dependencies" : {
12- "@copilotkit/react-core" : " ^1.3.1" ,
13- "@copilotkit/react-ui" : " ^1.3.1" ,
14- "@copilotkit/runtime-client-gql" : " ^1.3.1" ,
12+ "@copilotkit/react-core" : " 1.8.12-next.4" ,
13+ "@copilotkit/react-ui" : " 1.8.12-next.4" ,
14+ "@copilotkit/runtime" : " 1.8.12-next.4" ,
15+ "@copilotkit/runtime-client-gql" : " 1.8.12-next.4" ,
1516 "@radix-ui/react-checkbox" : " ^1.1.1" ,
1617 "@radix-ui/react-dialog" : " ^1.1.1" ,
1718 "@radix-ui/react-label" : " ^2.1.0" ,
You can’t perform that action at this time.
0 commit comments