Add AI chat feature
This commit is contained in:
parent
80056b3728
commit
6a5041be43
15 changed files with 1259 additions and 2 deletions
15
server/modules/chat/index.ts
Normal file
15
server/modules/chat/index.ts
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
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,
|
||||
},
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue