Spaces:
Sleeping
Sleeping
Download app/models/chat_message.py from thabsheeeeeer/DocBrain-API: direct link, hf CLI and curl.
- Browser
- Download file 687 Bytes
-
https://huggingface.co/spaces/thabsheeeeeer/DocBrain-API/resolve/main/app/models/chat_message.py
- Command line
-
hf download hf://spaces/thabsheeeeeer/DocBrain-API/app/models/chat_message.py
-
curl -L -o chat_message.py https://huggingface.co/spaces/thabsheeeeeer/DocBrain-API/resolve/main/app/models/chat_message.py
687 Bytes
| from datetime import datetime | |
| from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, Text | |
| from app.db.database import Base | |
| class ChatMessage(Base): | |
| __tablename__ = "chat_messages" | |
| id = Column(Integer, primary_key=True, index=True) | |
| user_id = Column(Integer, ForeignKey("users.id", ondelete="CASCADE"), nullable=False, index=True) | |
| document_id = Column( | |
| Integer, ForeignKey("documents.id", ondelete="CASCADE"), nullable=False, index=True | |
| ) | |
| role = Column(String, nullable=False) | |
| content = Column(Text, nullable=False) | |
| sources = Column(Text, nullable=True) | |
| created_at = Column(DateTime, default=datetime.utcnow, nullable=False) | |