Self-hosted knowledge management for SMEs: a split-screen Markdown editor whose sections an LLM refines while you write, and RAG question answering over the documents that result. FastAPI + Postgres/pgvector on the back, SvelteKit on the front, everything OpenAI-compatible and self-hostable. Squashed into a single commit; the development history stays local. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CA43ZJda8Rbp2hKXNy8f6b
24 lines
1.0 KiB
Python
24 lines
1.0 KiB
Python
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)
|