Spaces:
Runtime error
Runtime error
from django.db import models | |
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager | |
import uuid | |
# ChatHistory Model | |
class Room(models.Model): | |
RoomID = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) | |
UserName = models.CharField(max_length=50) | |
Name = models.CharField(max_length=50,null=True) | |
def __str__(self): | |
return f'Chat {self.RoomID} by {self.UserName}' | |
# ChatDetails Model | |
class ChatDetails(models.Model): | |
RoomID = models.ForeignKey(Room, on_delete=models.CASCADE) | |
order = models.AutoField(primary_key=True) | |
UserPrompt = models.TextField() | |
BotResponse = models.TextField(null=True) | |
class Meta: | |
ordering = ['order'] | |
def __str__(self): | |
return f'Message {self.order} in Chat {self.RoomID}' | |