Spaces:
Running
Running
axeronis
fix: correct foreign key table names in NovaMessage and update database initialization
82abf63 Download backend/app/models/nova.py from axeronis/microfunnel-api: direct link, hf CLI and curl.
- Browser
- Download file 827 Bytes
-
https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/backend/app/models/nova.py
- Command line
-
hf download hf://spaces/axeronis/microfunnel-api/backend/app/models/nova.py
-
curl -L -o nova.py https://huggingface.co/spaces/axeronis/microfunnel-api/resolve/main/backend/app/models/nova.py
827 Bytes
| """ | |
| Nova Help Chat - Database Model | |
| Stores chat history per tenant for the Nova AI helper | |
| """ | |
| from sqlmodel import SQLModel, Field | |
| from typing import Optional | |
| from datetime import datetime | |
| from uuid import UUID, uuid4 | |
| from enum import Enum | |
| class NovaMessageRole(str, Enum): | |
| USER = "user" | |
| NOVA = "nova" | |
| class NovaMessage(SQLModel, table=True): | |
| """Stores Nova help chat messages per tenant.""" | |
| __tablename__ = "nova_messages" | |
| id: UUID = Field(default_factory=uuid4, primary_key=True) | |
| tenant_id: UUID = Field(foreign_key="tenants.id", index=True) | |
| user_id: Optional[UUID] = Field(default=None, foreign_key="users.id") | |
| role: NovaMessageRole | |
| content: str | |
| current_page: Optional[str] = Field(default=None, max_length=255) | |
| created_at: datetime = Field(default_factory=datetime.utcnow) | |