This commit is contained in:
Timothy Jaeryang Baek 2026-06-29 01:32:09 -05:00
parent 00924fbf79
commit 8c57cfa645

View file

@ -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();