hackathon-template/server/modules/chat/index.ts
2026-05-08 20:24:34 +12:00

15 lines
333 B
TypeScript

import { Elysia } from "elysia";
import { ChatModel } from "./model";
import { Chat } from "./service";
export const chat = new Elysia({ prefix: "/chat" }).post(
"/",
async ({ body }) => {
const stream = await Chat.streamText(body);
return stream.toUIMessageStreamResponse();
},
{
body: ChatModel.chat,
},
);