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*
34
34
# typescript
35
35
* .tsbuildinfo
36
36
next-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";
7
7
import "@copilotkit/react-ui/styles.css" ;
8
8
9
9
export default function Home ( ) {
10
- const COPILOT_CLOUD_PUBLIC_API_KEY = process . env . NEXT_PUBLIC_COPILOT_CLOUD_PUBLIC_API_KEY ;
11
-
12
10
return (
13
11
< >
14
- < CopilotKit publicApiKey = { COPILOT_CLOUD_PUBLIC_API_KEY } >
12
+ < CopilotKit runtimeUrl = "/api/copilotkit" >
15
13
< TasksProvider >
16
14
< TasksList />
17
15
</ TasksProvider >
Original file line number Diff line number Diff line change 9
9
"lint" : " next lint"
10
10
},
11
11
"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" ,
15
16
"@radix-ui/react-checkbox" : " ^1.1.1" ,
16
17
"@radix-ui/react-dialog" : " ^1.1.1" ,
17
18
"@radix-ui/react-label" : " ^2.1.0" ,
You can’t perform that action at this time.
0 commit comments