This commit is contained in:
Timothy Jaeryang Baek
2026-06-15 23:42:29 +02:00
parent c783fd30f2
commit 45fcf272ef
11 changed files with 474 additions and 66 deletions
+86
View File
@@ -234,3 +234,89 @@ export const deleteFolderById = async (token: string, id: string, deleteContents
return res;
};
export const updateFolderAccessById = async (
token: string,
id: string,
accessGrants: any[]
) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/folders/${id}/access/update`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
},
body: JSON.stringify({ access_grants: accessGrants })
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.catch((err) => {
error = err.detail;
return null;
});
if (error) {
throw error;
}
return res;
};
export const getSharedFolders = async (token: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/folders/shared`, {
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.catch((err) => {
error = err.detail;
return [];
});
if (error) {
throw error;
}
return res;
};
export const getSharedFolderChats = async (token: string, folderId: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/folders/${folderId}/shared/chats`, {
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.catch((err) => {
error = err.detail;
return null;
});
if (error) {
throw error;
}
return res;
};