mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
68f9b8ad45
Example projects demonstrating the new fetch-based runtime adapters across six server frameworks/runtimes.
24 lines
564 B
TypeScript
24 lines
564 B
TypeScript
import { Elysia } from "elysia";
|
|
import {
|
|
CopilotRuntime,
|
|
createCopilotRuntimeHandler,
|
|
BuiltInAgent,
|
|
} from "@copilotkit/runtime/v2";
|
|
|
|
const runtime = new CopilotRuntime({
|
|
agents: {
|
|
default: new BuiltInAgent({ model: "openai/gpt-5-mini" }),
|
|
},
|
|
});
|
|
|
|
const handler = createCopilotRuntimeHandler({ runtime, cors: true });
|
|
|
|
const port = Number(process.env.PORT ?? 4004);
|
|
new Elysia()
|
|
.all("/api/copilotkit/*", ({ request }) => handler(request))
|
|
.listen(port);
|
|
|
|
console.log(
|
|
`Elysia runtime listening on http://localhost:${port}/api/copilotkit`,
|
|
);
|