15 lines
333 B
TypeScript
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,
|
|
},
|
|
);
|