feat: 重构 Agent 目录为 api/agent/infrastructure 分层并更新启动入口

This commit is contained in:
2026-09-20 11:15:10 +08:00
parent 02e7c4b881
commit 177036cf3d
32 changed files with 95 additions and 44 deletions
+33
View File
@@ -0,0 +1,33 @@
"""用户记忆 API。"""
from __future__ import annotations
from fastapi import APIRouter, Depends, HTTPException, status
from api.deps import current_actor, memory_service
from api.response import ok
from application.memory_service import MemoryService
from domain.models import Actor
router = APIRouter(prefix="/memories", tags=["memories"])
@router.get("")
async def list_memories(
actor: Actor = Depends(current_actor),
svc: MemoryService = Depends(memory_service),
):
items = await svc.list_public(actor)
return ok({"items": items})
@router.delete("/{memory_id}")
async def delete_memory(
memory_id: str,
actor: Actor = Depends(current_actor),
svc: MemoryService = Depends(memory_service),
):
deleted = await svc.delete(actor, memory_id)
if not deleted:
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="记忆不存在")
return ok({"ok": True})