feat: multiple pipelines server support

This commit is contained in:
Timothy J. Baek
2024-05-29 21:26:57 -07:00
parent 2981caa34b
commit c1cabf1415
3 changed files with 198 additions and 77 deletions
+36 -2
View File
@@ -49,10 +49,44 @@ export const getModels = async (token: string = '') => {
return models;
};
export const getPipelines = async (token: string = '') => {
export const getPipelinesList = async (token: string = '') => {
let error = null;
const res = await fetch(`${WEBUI_BASE_URL}/api/pipelines`, {
const res = await fetch(`${WEBUI_BASE_URL}/api/pipelines/list`, {
method: 'GET',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
...(token && { authorization: `Bearer ${token}` })
}
})
.then(async (res) => {
if (!res.ok) throw await res.json();
return res.json();
})
.catch((err) => {
console.log(err);
error = err;
return null;
});
if (error) {
throw error;
}
let pipelines = res?.data ?? [];
return pipelines;
};
export const getPipelines = async (token: string, urlIdx?: string) => {
let error = null;
const searchParams = new URLSearchParams();
if (urlIdx) {
searchParams.append('urlIdx', urlIdx);
}
const res = await fetch(`${WEBUI_BASE_URL}/api/pipelines?${searchParams.toString()}`, {
method: 'GET',
headers: {
Accept: 'application/json',