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
88 lines
2.1 KiB
Python
88 lines
2.1 KiB
Python
from enum import StrEnum
|
|
|
|
|
|
class UserRole(StrEnum):
|
|
member = "member"
|
|
admin = "admin"
|
|
|
|
|
|
class ConversationMode(StrEnum):
|
|
query = "query"
|
|
insight = "insight" # EE insights mode registers itself
|
|
|
|
|
|
class ConversationStatus(StrEnum):
|
|
active = "active"
|
|
completed = "completed"
|
|
abandoned = "abandoned"
|
|
|
|
|
|
class MessageRole(StrEnum):
|
|
user = "user"
|
|
assistant = "assistant"
|
|
system = "system"
|
|
|
|
|
|
class DocumentStatus(StrEnum):
|
|
"""Where a document stands.
|
|
|
|
Three states, because publishing is the author's own decision: a draft is
|
|
private, a published document is visible and indexed, an archived one is
|
|
neither. Uncertainty about CONTENT is not a status — it is an open review
|
|
request (`ReviewRequest`), which can sit on a published document too.
|
|
"""
|
|
|
|
draft = "draft"
|
|
published = "published"
|
|
archived = "archived"
|
|
|
|
|
|
class DocumentVisibility(StrEnum):
|
|
public = "public"
|
|
department = "department"
|
|
restricted = "restricted"
|
|
|
|
|
|
class PermissionLevel(StrEnum):
|
|
read = "read"
|
|
|
|
|
|
class AccessReason(StrEnum):
|
|
"""Why a document is visible to the requesting user.
|
|
|
|
API-only (never stored): computed per request so the UI can explain
|
|
access instead of leaving visibility rules implicit.
|
|
"""
|
|
|
|
author = "author"
|
|
public = "public"
|
|
department = "department"
|
|
granted = "granted"
|
|
# Only reason: somebody asked this user to check the document. It ends
|
|
# with their answer, which is why it is worth naming separately.
|
|
review = "review"
|
|
|
|
|
|
class DocumentEventAction(StrEnum):
|
|
"""A recorded step in a document's audit history.
|
|
|
|
Content-bearing actions (created / edited) snapshot the Markdown source of
|
|
truth; the rest record only who did what and when.
|
|
"""
|
|
|
|
created = "created"
|
|
edited = "edited"
|
|
published = "published"
|
|
archived = "archived"
|
|
visibility_changed = "visibility_changed"
|
|
# Someone was asked to check the content, and someone answered.
|
|
review_requested = "review_requested"
|
|
review_resolved = "review_resolved"
|
|
|
|
|
|
class JobStatus(StrEnum):
|
|
pending = "pending"
|
|
running = "running"
|
|
done = "done"
|
|
failed = "failed"
|