Download src/models/ChatMessage.ts from simhaa-hat/ai-learning-dashboard-api: direct link, hf CLI and curl.
- Browser
- Download file 654 Bytes
-
https://huggingface.co/spaces/simhaa-hat/ai-learning-dashboard-api/resolve/main/src/models/ChatMessage.ts
- Command line
-
hf download hf://spaces/simhaa-hat/ai-learning-dashboard-api/src/models/ChatMessage.ts
-
curl -L -o ChatMessage.ts https://huggingface.co/spaces/simhaa-hat/ai-learning-dashboard-api/resolve/main/src/models/ChatMessage.ts
654 Bytes
| import mongoose, { Schema } from 'mongoose'; | |
| import { IChatMessage } from '../types'; | |
| const chatMessageSchema = new Schema<IChatMessage>( | |
| { | |
| userId: { | |
| type: Schema.Types.ObjectId, | |
| ref: 'User', | |
| required: true, | |
| index: true, | |
| }, | |
| type: { | |
| type: String, | |
| enum: ['user', 'ai'], | |
| required: true, | |
| }, | |
| content: { | |
| type: String, | |
| required: true, | |
| }, | |
| }, | |
| { | |
| timestamps: true, | |
| } | |
| ); | |
| const ChatMessage = mongoose.model<IChatMessage>('ChatMessage', chatMessageSchema); | |
| export default ChatMessage; | |