Web chat message between user and agent.
| 44 | |
| 45 | |
| 46 | class ChatMessage(Base): |
| 47 | """Web chat message between user and agent.""" |
| 48 | |
| 49 | __tablename__ = "chat_messages" |
| 50 | |
| 51 | id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), primary_key=True, default=uuid.uuid4) |
| 52 | agent_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), ForeignKey("agents.id"), nullable=False, index=True) |
| 53 | user_id: Mapped[uuid.UUID] = mapped_column(UUID(as_uuid=True), ForeignKey("users.id"), nullable=False) |
| 54 | role: Mapped[str] = mapped_column( |
| 55 | Enum("user", "assistant", "system", "tool_call", name="chat_role_enum"), |
| 56 | nullable=False, |
| 57 | ) |
| 58 | content: Mapped[str] = mapped_column(Text, nullable=False) |
| 59 | conversation_id: Mapped[str] = mapped_column(String(200), default="web", nullable=False, index=True) |
| 60 | # Participant identity (unified User/Agent identity) |
| 61 | participant_id: Mapped[uuid.UUID | None] = mapped_column(UUID(as_uuid=True), ForeignKey("participants.id"), nullable=True) |
| 62 | # Model thinking process |
| 63 | thinking: Mapped[str | None] = mapped_column(Text, nullable=True) |
| 64 | created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now(), index=True) |
| 65 | |
| 66 | |
| 67 | class EnterpriseInfo(Base): |
no outgoing calls
no test coverage detected