mirror of
https://github.com/open-webui/open-webui
synced 2024-11-08 09:39:55 +00:00
25 lines
510 B
TypeScript
25 lines
510 B
TypeScript
|
import { ENDPOINT } from '$lib/contants';
|
||
|
import type { PageServerLoad } from './$types';
|
||
|
|
||
|
export const load: PageServerLoad = async ({ url, fetch }) => {
|
||
|
const models = await fetch(`${ENDPOINT}/api/tags`, {
|
||
|
method: 'GET',
|
||
|
headers: {
|
||
|
Accept: 'application/json',
|
||
|
'Content-Type': 'application/json'
|
||
|
}
|
||
|
})
|
||
|
.then(async (res) => {
|
||
|
if (!res.ok) throw await res.json();
|
||
|
return res.json();
|
||
|
})
|
||
|
.catch((error) => {
|
||
|
console.log(error);
|
||
|
return null;
|
||
|
});
|
||
|
|
||
|
return {
|
||
|
models: models
|
||
|
};
|
||
|
};
|