This commit is contained in:
Timothy Jaeryang Baek committed 2026-05-14 01:43:33 +09:00
1 parent ab0ee858b7
commit 3127f1b462
6 files changed
+157 -9

No files matched your search

+29
View File
@@ -306,6 +306,35 @@ export const getFileContentById = async (id: string) => {
return res;
};
export const renameFileById = async (token: string, id: string, filename: string) => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/files/${id}/rename`, {
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
authorization: `Bearer ${token}`
},
body: JSON.stringify({ filename })
})
.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 deleteFileById = async (token: string, id: string) => {
let error = null;