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
22 lines
638 B
Python
22 lines
638 B
Python
"""Two routers, because templates have two audiences.
|
|
|
|
Everyone may READ the templates (the picker needs them); only an admin may
|
|
change what the instance offers. Expressing that as two constructors means a
|
|
new endpoint is gated by which router it is added to, not by remembering to
|
|
repeat a dependency.
|
|
"""
|
|
|
|
from fastapi import APIRouter, Depends
|
|
|
|
from app.auth.deps import require_admin
|
|
|
|
|
|
def reader_router() -> APIRouter:
|
|
return APIRouter(prefix="/templates", tags=["templates"])
|
|
|
|
|
|
def editor_router() -> APIRouter:
|
|
return APIRouter(
|
|
prefix="/templates", tags=["templates"], dependencies=[Depends(require_admin)]
|
|
)
|