mirror of
https://github.com/CopilotKit/CopilotKit.git
synced 2026-09-14 16:26:20 +08:00
f1d8b81861
* feat(docs): generated code snippets * feat(docs): remove unnecessary files * feat(docs): generated docs * feat(docs): copy-qa-snippets-to-mintlify script * fix(docs): qa scripts * feat(docs): updated quickstart-runtime.mdx * fix: formatting * fix(docs): link to cloud --------- Co-authored-by: Atai Barkai <atai.barkai@gmail.com>
26 lines
591 B
TypeScript
26 lines
591 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");
|
|
});
|