From bec00e7e64e2cd80ff61fa84942cd38f751aa422 Mon Sep 17 00:00:00 2001 From: Peter De-Ath Date: Fri, 14 Jun 2024 21:23:34 +0100 Subject: [PATCH] fix: change update_memory to correct naming convention fix: update update_memory to POST --- backend/apps/webui/models/memories.py | 2 +- backend/apps/webui/routers/memories.py | 6 +++--- src/lib/apis/memories/index.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/backend/apps/webui/models/memories.py b/backend/apps/webui/models/memories.py index 0266cc8b2..88131b451 100644 --- a/backend/apps/webui/models/memories.py +++ b/backend/apps/webui/models/memories.py @@ -65,7 +65,7 @@ class MemoriesTable: else: return None - def update_memory( + def update_memory_by_id( self, id: str, content: str, diff --git a/backend/apps/webui/routers/memories.py b/backend/apps/webui/routers/memories.py index 927c28b46..c58f706d4 100644 --- a/backend/apps/webui/routers/memories.py +++ b/backend/apps/webui/routers/memories.py @@ -64,11 +64,11 @@ async def add_memory( return memory -@router.patch("/{memory_id}", response_model=Optional[MemoryModel]) -async def update_memory( +@router.post("/{memory_id}", response_model=Optional[MemoryModel]) +async def update_memory_by_id( memory_id: str, request: Request, form_data: MemoryUpdateModel, user=Depends(get_verified_user) ): - memory = Memories.update_memory(memory_id, form_data.content) + memory = Memories.update_memory_by_id(memory_id, form_data.content) if memory is None: raise HTTPException(status_code=404, detail="Memory not found") diff --git a/src/lib/apis/memories/index.ts b/src/lib/apis/memories/index.ts index cc4abb176..391be06c0 100644 --- a/src/lib/apis/memories/index.ts +++ b/src/lib/apis/memories/index.ts @@ -63,7 +63,7 @@ export const updateMemoryById = async (token: string, id: string, content: strin let error = null; const res = await fetch(`${WEBUI_API_BASE_URL}/memories/${id}`, { - method: 'PATCH', + method: 'POST', headers: { Accept: 'application/json', 'Content-Type': 'application/json',