mirror of
https://github.com/open-webui/open-webui.git
synced 2026-02-24 12:11:56 +01:00
feat: Dynamically load yaml to speed up page loading (#20204)
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
|
||||
import { WEBUI_BASE_URL } from '$lib/constants';
|
||||
import { convertOpenApiToToolPayload } from '$lib/utils';
|
||||
import { getOpenAIModelsDirect } from './openai';
|
||||
|
||||
import { parse } from 'yaml';
|
||||
import { toast } from 'svelte-sonner';
|
||||
|
||||
export const getModels = async (
|
||||
token: string = '',
|
||||
connections: object | null = null,
|
||||
@@ -316,7 +313,7 @@ export const getToolServerData = async (token: string, url: string) => {
|
||||
// Check if URL ends with .yaml or .yml to determine format
|
||||
if (url.toLowerCase().endsWith('.yaml') || url.toLowerCase().endsWith('.yml')) {
|
||||
if (!res.ok) throw await res.text();
|
||||
const text = await res.text();
|
||||
const [text, { parse }] = await Promise.all([res.text(), import('yaml')]);
|
||||
return parse(text);
|
||||
} else {
|
||||
if (!res.ok) throw await res.json();
|
||||
|
||||
Reference in New Issue
Block a user