Add AI chat feature
This commit is contained in:
parent
80056b3728
commit
6a5041be43
15 changed files with 1259 additions and 2 deletions
13
server/modules/chat/service.ts
Normal file
13
server/modules/chat/service.ts
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import { convertToModelMessages, streamText } from "ai";
|
||||
import type { ChatModel } from "./model";
|
||||
import { openai } from "@ai-sdk/openai";
|
||||
|
||||
export abstract class Chat {
|
||||
static async streamText(chat: ChatModel["chat"]) {
|
||||
return streamText({
|
||||
model: openai("gpt-5.5"),
|
||||
system: "You are Yae Miko from Genshin Impact",
|
||||
messages: await convertToModelMessages(chat.messages),
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue