Spaces:
Paused
Paused
Download models/ai_interaction.py from 3SCError404/miracle: direct link, hf CLI and curl.
- Browser
- Download file 1.3 kB
-
https://huggingface.co/spaces/3SCError404/miracle/resolve/main/models/ai_interaction.py
- Command line
-
hf download hf://spaces/3SCError404/miracle/models/ai_interaction.py
-
curl -L -o ai_interaction.py https://huggingface.co/spaces/3SCError404/miracle/resolve/main/models/ai_interaction.py
1.3 kB
| from sqlalchemy import Column, String, ForeignKey, Boolean | |
| from sqlalchemy.dialects.postgresql import UUID, JSONB | |
| from core.database import Base | |
| from models.base import PrimaryKeyMixin, TimestampMixin | |
| class AIInteraction(Base, PrimaryKeyMixin, TimestampMixin): | |
| __tablename__ = "ai_interactions" | |
| workspace_id = Column(UUID(as_uuid=True), ForeignKey("workspaces.id"), nullable=False, index=True) | |
| ticket_id = Column(UUID(as_uuid=True), ForeignKey("tickets.id"), nullable=True, index=True) | |
| agent_name = Column(String(100), nullable=False) # e.g., "triage_node" | |
| model_info = Column(String(255), nullable=True) | |
| # Thread ID to group all nodes of a single LangGraph execution | |
| thread_id = Column(UUID(as_uuid=True), nullable=True, index=True) | |
| input_data = Column(JSONB, nullable=False) | |
| output_data = Column(JSONB, nullable=False) | |
| # Operational Metrics | |
| status = Column(String(50), nullable=True, default="success") # success, error, skipped | |
| duration_ms = Column(JSONB, nullable=True) # Will store {total: 450, llm: 300} | |
| # Track tokens (prompt, completion) | |
| usage_metadata = Column(JSONB, nullable=True, default={}) | |
| is_automatic = Column(Boolean, default=True) | |
| metadata_json = Column(JSONB, nullable=True, default={}) | |