Update .gitignore to exclude Python-related files and directories. Enhance AGENTS.md and README.md with clarifications on documentation structure and product identity. Add technical architecture references and local setup instructions. Revise privacy guardrails and product identity documents for consistency. Remove obsolete memory and context documentation. Expand reflection spaces documentation to define context boundaries and lifecycle. Ensure all changes align with the ongoing development of the Kanshō project.
This commit is contained in:
1 parent
3a367b7bcc
commit
d62673e48b
89 files changed
+13463
-241
No files matched your search
@@ -0,0 +1,56 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
|
||||
from auth import require_admin_dep
|
||||
from db import get_db
|
||||
from dialogue_store import StoreError, get_conversation, inventory, list_conversations, list_derived_for_conversation, list_messages
|
||||
from version import APP_VERSION, BUILD_DATE, MODULE_VERSIONS
|
||||
|
||||
router = APIRouter(prefix="/api/admin", tags=["admin"])
|
||||
|
||||
|
||||
@router.get("/health")
|
||||
def admin_health(session: dict = Depends(require_admin_dep)):
|
||||
with get_db() as conn:
|
||||
users = conn.execute("SELECT COUNT(*) AS n FROM profiles").fetchone()["n"]
|
||||
prompts = conn.execute("SELECT COUNT(*) AS n FROM ai_prompts").fetchone()["n"]
|
||||
features = conn.execute("SELECT COUNT(*) AS n FROM features").fetchone()["n"]
|
||||
dialogue = inventory()
|
||||
return {
|
||||
"ok": True,
|
||||
"service": "kansho",
|
||||
"version": APP_VERSION,
|
||||
"build_date": BUILD_DATE,
|
||||
"modules": MODULE_VERSIONS,
|
||||
"inventory": {
|
||||
"users": users,
|
||||
"prompts": prompts,
|
||||
"features": features,
|
||||
"dialogue": dialogue,
|
||||
},
|
||||
"session": {
|
||||
"profile_id": session["profile_id"],
|
||||
"role": session["role"],
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@router.get("/dialogue")
|
||||
def admin_dialogue(session: dict = Depends(require_admin_dep)):
|
||||
return {
|
||||
"instance": inventory(),
|
||||
"own_conversations": list_conversations(session["profile_id"]),
|
||||
"note": "Fremde Lived Experience ist kein Alltagspfad. Detailansicht nur für das eigene Profil.",
|
||||
}
|
||||
|
||||
|
||||
@router.get("/dialogue/conversations/{conversation_id}")
|
||||
def admin_conversation(conversation_id: str, session: dict = Depends(require_admin_dep)):
|
||||
try:
|
||||
conv = get_conversation(session["profile_id"], conversation_id)
|
||||
return {
|
||||
"conversation": conv,
|
||||
"original_messages": list_messages(session["profile_id"], conversation_id),
|
||||
"derived_records": list_derived_for_conversation(session["profile_id"], conversation_id),
|
||||
}
|
||||
except StoreError as exc:
|
||||
raise HTTPException(status_code=exc.status_code, detail={"code": exc.code, "message": exc.message}) from exc
|
||||
Reference in new issue
Block a user