Files
loom/backend/app/api/v1/lobster_config.py
T
2026-04-24 17:46:03 +08:00

22 lines
813 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""龙虾 Agent 运行时配置 API(UI 可编辑)。"""
from __future__ import annotations
from fastapi import APIRouter, Depends
from app.core.deps import DbDep, require_perm
from app.core.exceptions import ok
from app.schemas.lobster_config import LobsterConfigUpdate
from app.services import lobster_config_service
router = APIRouter(prefix="/lobster-config", tags=["lobster-config"])
@router.get("", dependencies=[Depends(require_perm("system:executor:view"))])
async def get_config(db: DbDep) -> dict:
return ok((await lobster_config_service.read(db)).model_dump())
@router.put("", dependencies=[Depends(require_perm("system:executor:update"))])
async def update_config(data: LobsterConfigUpdate, db: DbDep) -> dict:
return ok((await lobster_config_service.update(db, data)).model_dump())