Files
copilotkit--copilotkit/scripts/qa/lib/node/express.ts
T
2026-07-13 12:58:18 +08:00

30 lines
598 B
TypeScript

/**
* @filePath server.ts
*/
import express from "express";
import {
CopilotRuntime,
OpenAIAdapter,
copilotRuntimeNodeHttpEndpoint,
} from "@copilotkit/runtime";
import OpenAI from "openai";
const openai = new OpenAI();
const serviceAdapter = new OpenAIAdapter({ openai });
const runtime = new CopilotRuntime();
const copilotRuntime = copilotRuntimeNodeHttpEndpoint({
endpoint: "/copilotkit",
runtime,
serviceAdapter,
});
const app = express();
app.use("/copilotkit", copilotRuntime);
app.listen(4000, () => {
console.log("Listening at http://localhost:4000/copilotkit");
});