|
@@ -62,6 +62,39 @@ export const getTools = async (token: string = '') => {
|
|
|
return res;
|
|
|
};
|
|
|
|
|
|
+
|
|
|
+export const getToolList = async (token: string = '') => {
|
|
|
+ let error = null;
|
|
|
+
|
|
|
+ const res = await fetch(`${WEBUI_API_BASE_URL}/tools/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.log(err);
|
|
|
+ return null;
|
|
|
+ });
|
|
|
+
|
|
|
+ if (error) {
|
|
|
+ throw error;
|
|
|
+ }
|
|
|
+
|
|
|
+ return res;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
export const exportTools = async (token: string = '') => {
|
|
|
let error = null;
|
|
|
|