wip: admin models setting

This commit is contained in:
Timothy Jaeryang Baek
2024-11-15 18:53:50 -08:00
parent 9dae7d0572
commit 7f8c70b04a
7 changed files with 310 additions and 25 deletions
+34 -1
View File
@@ -1,7 +1,7 @@
import { WEBUI_API_BASE_URL } from '$lib/constants';
export const getWorkspaceModels = async (token: string = '') => {
export const getModels = async (token: string = '') => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/models`, {
@@ -34,6 +34,39 @@ export const getWorkspaceModels = async (token: string = '') => {
export const getBaseModels = async (token: string = '') => {
let error = null;
const res = await fetch(`${WEBUI_API_BASE_URL}/models/base`, {
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;
console.log(err);
return null;
});
if (error) {
throw error;
}
return res;
};
export const createNewModel = async (token: string, model: object) => {
let error = null;