Self-hosted, Docker-based agentic troubleshooting platform: FastAPI backend + LangGraph agent, Next.js UI, tiered LLM routing (local Ollama -> Gemini -> DeepSeek -> OpenRouter), MCP server manager, encrypted device credentials, RBAC, audit log, project-memory + Obsidian integrations, and editable troubleshooting decision rules tuned for the GeneseasX vessel stack. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
718 B
Python
31 lines
718 B
Python
"""Audit logging helper."""
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.models.audit import AuditLog
|
|
from app.models.user import User
|
|
|
|
|
|
async def record_audit(
|
|
db: AsyncSession,
|
|
actor: User | None,
|
|
action: str,
|
|
target_type: str | None = None,
|
|
target_id: int | None = None,
|
|
detail: dict[str, Any] | None = None,
|
|
) -> None:
|
|
db.add(
|
|
AuditLog(
|
|
actor_id=actor.id if actor else None,
|
|
actor_email=actor.email if actor else None,
|
|
action=action,
|
|
target_type=target_type,
|
|
target_id=target_id,
|
|
detail=detail,
|
|
)
|
|
)
|
|
await db.commit()
|