Spaces:
Paused
Paused
Download models/nexus_thread.py from 3SCError404/nexus: direct link, hf CLI and curl.
- Browser
- Download file 1.42 kB
-
https://huggingface.co/spaces/3SCError404/nexus/resolve/main/models/nexus_thread.py
- Command line
-
hf download hf://spaces/3SCError404/nexus/models/nexus_thread.py
-
curl -L -o nexus_thread.py https://huggingface.co/spaces/3SCError404/nexus/resolve/main/models/nexus_thread.py
1.42 kB
| from sqlalchemy import Column, String, ForeignKey, Text | |
| from sqlalchemy.dialects.postgresql import UUID, JSONB | |
| from core.database import Base | |
| from models.base import PrimaryKeyMixin, TimestampMixin | |
| from sqlalchemy.orm import relationship | |
| class NexusThread(Base, PrimaryKeyMixin, TimestampMixin): | |
| """ | |
| Manages conversational session metadata for the Nexus Master Agent. | |
| Allows for thread naming and personal history tracking. | |
| """ | |
| __tablename__ = "nexus_threads" | |
| workspace_id = Column(UUID(as_uuid=True), ForeignKey("workspaces.id"), nullable=False, index=True) | |
| user_id = Column(UUID(as_uuid=True), ForeignKey("users.id"), nullable=False, index=True) | |
| # User-defined or auto-generated title for the thread | |
| title = Column(String(255), nullable=False, default="New Conversation") | |
| # Optional connection to a ticket | |
| ticket_id = Column(UUID(as_uuid=True), ForeignKey("tickets.id"), nullable=True, index=True) | |
| # Long-term summary or high-level context specific to this thread | |
| gist = Column(Text, nullable=True) | |
| metadata_json = Column(JSONB, nullable=True, default={}) | |
| # Relationships | |
| user = relationship("User") | |
| workspace = relationship("Workspace") | |
| ticket = relationship("Ticket") | |
| interactions = relationship("NexusInteraction", backref="thread", primaryjoin="NexusThread.id == NexusInteraction.thread_id", overlaps="interactions") | |