This commit is contained in:
Timothy Jaeryang Baek
2026-02-10 15:47:21 -06:00
parent e3a8257690
commit 4aedfdc547
7 changed files with 184 additions and 18 deletions
+33
View File
@@ -289,6 +289,39 @@ export const updateKnowledgeById = async (token: string, id: string, form: Knowl
return res;
};
export const updateKnowledgeAccessGrants = async (
token: string,
id: string,
accessGrants: any[]
) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/knowledge/${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;
console.error(err);
return null;
});
if (error) {
throw error;
}
return res;
};
export const addFileToKnowledgeById = async (token: string, id: string, fileId: string) => {
let error = null;