Files
letta-server/memgpt/server/rest_api/agents/memory.py
Robin Goetz b573e8cab1 feat: next iteration of chatui (#642)
* feat: add dark mode & make minor UI improvements

added dark mode toggle & picked a color scheme that is closer to the memgpt icons
cleaned up the home page a little bit.

* feat: add thinking indicator & make minor UI improvements

we now show a thinking while the current message is loading.
removed status indicator as we do not work with websockets anymore.
also adjusted some of the chat styles to better fit the new theme.

* feat: add memory viewer and allow memory edit

* chore: build frontend
2024-01-11 14:47:51 +01:00

30 lines
925 B
Python

from fastapi import APIRouter
from pydantic import BaseModel
from memgpt.server.rest_api.interface import QueuingInterface
from memgpt.server.server import SyncServer
router = APIRouter()
class CoreMemory(BaseModel):
user_id: str
agent_id: str
human: str | None = None
persona: str | None = None
def setup_agents_memory_router(server: SyncServer, interface: QueuingInterface):
@router.get("/agents/memory")
def get_agent_memory(user_id: str, agent_id: str):
interface.clear()
return server.get_agent_memory(user_id=user_id, agent_id=agent_id)
@router.post("/agents/memory")
def get_agent_memory(body: CoreMemory):
interface.clear()
new_memory_contents = {"persona": body.persona, "human": body.human}
return server.update_agent_core_memory(user_id=body.user_id, agent_id=body.agent_id, new_memory_contents=new_memory_contents)
return router