chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1 @@
|
||||
OPENAI_API_KEY=your-openai-api-key
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "@copilotkit/example-runtime-cf-workers",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"example-dev": "wrangler dev",
|
||||
"example-deploy": "wrangler deploy"
|
||||
},
|
||||
"dependencies": {
|
||||
"@copilotkit/runtime": "workspace:^"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cloudflare/workers-types": "^4.20250214.0",
|
||||
"typescript": "^5.8.2",
|
||||
"wrangler": "^4.6.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
import {
|
||||
CopilotRuntime,
|
||||
createCopilotRuntimeHandler,
|
||||
BuiltInAgent,
|
||||
} from "@copilotkit/runtime/v2";
|
||||
|
||||
export interface Env {
|
||||
OPENAI_API_KEY: string;
|
||||
}
|
||||
|
||||
export default {
|
||||
async fetch(request: Request, env: Env): Promise<Response> {
|
||||
const runtime = new CopilotRuntime({
|
||||
agents: {
|
||||
default: new BuiltInAgent({ model: "openai/gpt-5-mini" }),
|
||||
},
|
||||
});
|
||||
|
||||
const handler = createCopilotRuntimeHandler({
|
||||
runtime,
|
||||
basePath: "/api/copilotkit",
|
||||
cors: true,
|
||||
});
|
||||
|
||||
return handler(request);
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"types": ["@cloudflare/workers-types"],
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"esModuleInterop": true,
|
||||
"outDir": "dist",
|
||||
"rootDir": "src"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist"]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
name = "copilotkit-runtime"
|
||||
main = "src/index.ts"
|
||||
compatibility_date = "2025-02-01"
|
||||
|
||||
[vars]
|
||||
PORT = "4006"
|
||||
Reference in New Issue
Block a user