| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- from __future__ import annotations
- from datetime import datetime
- from sqlalchemy import BigInteger, Integer, String, Text, func
- from sqlalchemy.dialects.mysql import LONGTEXT
- from sqlalchemy.orm import Mapped, mapped_column
- from supply_infra.db.base import Base
- class AgentDocumentInjection(Base):
- """Web-managed document content appended to an Agent's base system prompt."""
- __tablename__ = "agent_document_injection"
- id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
- agent_name: Mapped[str] = mapped_column(
- String(128),
- nullable=False,
- unique=True,
- index=True,
- comment="Agent name",
- )
- content: Mapped[str] = mapped_column(
- Text().with_variant(LONGTEXT(), "mysql"),
- nullable=False,
- default="",
- comment="Document content injected after the base system prompt",
- )
- enabled: Mapped[int] = mapped_column(
- Integer,
- nullable=False,
- default=1,
- comment="Whether the document injection is active",
- )
- create_time: Mapped[datetime] = mapped_column(
- nullable=False,
- server_default=func.now(),
- )
- update_time: Mapped[datetime] = mapped_column(
- nullable=False,
- server_default=func.now(),
- onupdate=func.now(),
- )
|