-
Notifications
You must be signed in to change notification settings - Fork 518
/
Copy pathchat.js
34 lines (32 loc) · 837 Bytes
/
chat.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import mongoose from "mongoose";
const chatSchema = new mongoose.Schema(
{
userId: {
type: String,
required: true,
},
history: [
{
role: {
type: String,
enum: ["user", "model"],
required: true,
},
parts: [
{
text: {
type: String,
required: true,
},
},
],
img: {
type: String,
required: false,
},
},
],
},
{ timestamps: true }
);
export default mongoose.models.chat || mongoose.model("chat", chatSchema);