diff --git a/src/lib/apis/memories/index.ts b/src/lib/apis/memories/index.ts index d8fdc638fa..0c32233e96 100644 --- a/src/lib/apis/memories/index.ts +++ b/src/lib/apis/memories/index.ts @@ -28,7 +28,7 @@ export const getMemories = async (token: string) => { return res; }; -export const addNewMemory = async (token: string, content: string) => { +export const addNewMemory = async (token: string, content: string, type = 'user') => { let error = null; const res = await fetch(`${WEBUI_API_BASE_URL}/memories/add`, { @@ -39,7 +39,8 @@ export const addNewMemory = async (token: string, content: string) => { authorization: `Bearer ${token}` }, body: JSON.stringify({ - content: content + content: content, + type }) }) .then(async (res) => { @@ -59,8 +60,14 @@ export const addNewMemory = async (token: string, content: string) => { return res; }; -export const updateMemoryById = async (token: string, id: string, content: string) => { +export const updateMemoryById = async ( + token: string, + id: string, + content: string, + type?: string +) => { let error = null; + const body = type ? { content, type } : { content }; const res = await fetch(`${WEBUI_API_BASE_URL}/memories/${id}/update`, { method: 'POST', @@ -69,9 +76,7 @@ export const updateMemoryById = async (token: string, id: string, content: strin 'Content-Type': 'application/json', authorization: `Bearer ${token}` }, - body: JSON.stringify({ - content: content - }) + body: JSON.stringify(body) }) .then(async (res) => { if (!res.ok) throw await res.json();