from sqlalchemy import String, Text from sqlalchemy.orm import Mapped, mapped_column from app.models.base import Base, TimestampMixin, UUIDPrimaryKeyMixin class PromptSetting(UUIDPrimaryKeyMixin, TimestampMixin, Base): """An admin override for a shipped system prompt. Every prompt has a CODE default (`app/prompts/defaults.py`); a row here exists only when an admin has changed one. `content` is the full replacement text. Applied without a restart via a module-level cache (`app/prompts/overrides.py`), refreshed on every write — like the LLM settings, and single-process by design (`--workers 1`). Resetting a prompt deletes its row, so the code default takes over again. Unlike LLM settings there is no `.env` layer: prompts have no environment representation, so the reset target is the code default rather than the environment. """ __tablename__ = "prompt_settings" key: Mapped[str] = mapped_column(String(64), unique=True) content: Mapped[str] = mapped_column(Text)