Spaces:
Sleeping
Sleeping
Download src/models/message.py from abdullah9873/backend-rag-chatbot-v2: direct link, hf CLI and curl.
- Browser
- Download file 573 Bytes
-
https://huggingface.co/spaces/abdullah9873/backend-rag-chatbot-v2/resolve/main/src/models/message.py
- Command line
-
hf download hf://spaces/abdullah9873/backend-rag-chatbot-v2/src/models/message.py
-
curl -L -o message.py https://huggingface.co/spaces/abdullah9873/backend-rag-chatbot-v2/resolve/main/src/models/message.py
573 Bytes
| from sqlmodel import SQLModel, Field, JSON | |
| from datetime import datetime | |
| from typing import Optional, Any | |
| class Message(SQLModel, table=True): | |
| id: Optional[int] = Field(default=None, primary_key=True) | |
| conversation_id: int = Field(foreign_key="conversation.id", index=True) | |
| role: str = Field(index=True) # user, assistant, system, tool | |
| content: Optional[str] = None | |
| tool_calls: Optional[Any] = Field(default=None, sa_type=JSON) | |
| tool_call_id: Optional[str] = None # For tool messages | |
| created_at: datetime = Field(default_factory=datetime.utcnow) | |