refac: functions

This commit is contained in:
Timothy Jaeryang Baek
2025-10-07 14:20:07 -05:00
parent 299e0e2674
commit f5e1a42f51
5 changed files with 536 additions and 437 deletions
+31
View File
@@ -62,6 +62,37 @@ export const getFunctions = async (token: string = '') => {
return res;
};
export const getFunctionList = async (token: string = '') => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/functions/list`, {
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();
})
.then((json) => {
return json;
})
.catch((err) => {
error = err.detail;
console.error(err);
return null;
});
if (error) {
throw error;
}
return res;
};
export const loadFunctionByUrl = async (token: string = '', url: string) => {
let error = null;