diff --git a/src/lib/apis/index.ts b/src/lib/apis/index.ts index e865e9ba0e..f37f525793 100644 --- a/src/lib/apis/index.ts +++ b/src/lib/apis/index.ts @@ -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();