mirror of
https://github.com/open-webui/open-webui
synced 2025-06-04 03:37:35 +00:00
fix: spinner
This commit is contained in:
parent
9fb6160010
commit
b7fc37d992
@ -20,6 +20,7 @@
|
|||||||
} from '$lib/apis/openai';
|
} from '$lib/apis/openai';
|
||||||
import { toast } from 'svelte-sonner';
|
import { toast } from 'svelte-sonner';
|
||||||
import Switch from '$lib/components/common/Switch.svelte';
|
import Switch from '$lib/components/common/Switch.svelte';
|
||||||
|
import Spinner from '$lib/components/common/Spinner.svelte';
|
||||||
|
|
||||||
const i18n = getContext('i18n');
|
const i18n = getContext('i18n');
|
||||||
|
|
||||||
@ -31,8 +32,8 @@
|
|||||||
let OPENAI_API_KEYS = [''];
|
let OPENAI_API_KEYS = [''];
|
||||||
let OPENAI_API_BASE_URLS = [''];
|
let OPENAI_API_BASE_URLS = [''];
|
||||||
|
|
||||||
let ENABLE_OPENAI_API = false;
|
let ENABLE_OPENAI_API = null;
|
||||||
let ENABLE_OLLAMA_API = false;
|
let ENABLE_OLLAMA_API = null;
|
||||||
|
|
||||||
const updateOpenAIHandler = async () => {
|
const updateOpenAIHandler = async () => {
|
||||||
OPENAI_API_BASE_URLS = await updateOpenAIUrls(localStorage.token, OPENAI_API_BASE_URLS);
|
OPENAI_API_BASE_URLS = await updateOpenAIUrls(localStorage.token, OPENAI_API_BASE_URLS);
|
||||||
@ -57,16 +58,23 @@
|
|||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
if ($user.role === 'admin') {
|
if ($user.role === 'admin') {
|
||||||
|
await Promise.all([
|
||||||
|
(async () => {
|
||||||
|
OLLAMA_BASE_URLS = await getOllamaUrls(localStorage.token);
|
||||||
|
})(),
|
||||||
|
(async () => {
|
||||||
|
OPENAI_API_BASE_URLS = await getOpenAIUrls(localStorage.token);
|
||||||
|
})(),
|
||||||
|
(async () => {
|
||||||
|
OPENAI_API_KEYS = await getOpenAIKeys(localStorage.token);
|
||||||
|
})()
|
||||||
|
]);
|
||||||
|
|
||||||
const ollamaConfig = await getOllamaConfig(localStorage.token);
|
const ollamaConfig = await getOllamaConfig(localStorage.token);
|
||||||
const openaiConfig = await getOpenAIConfig(localStorage.token);
|
const openaiConfig = await getOpenAIConfig(localStorage.token);
|
||||||
|
|
||||||
ENABLE_OPENAI_API = openaiConfig.ENABLE_OPENAI_API;
|
ENABLE_OPENAI_API = openaiConfig.ENABLE_OPENAI_API;
|
||||||
ENABLE_OLLAMA_API = ollamaConfig.ENABLE_OLLAMA_API;
|
ENABLE_OLLAMA_API = ollamaConfig.ENABLE_OLLAMA_API;
|
||||||
|
|
||||||
OLLAMA_BASE_URLS = await getOllamaUrls(localStorage.token);
|
|
||||||
|
|
||||||
OPENAI_API_BASE_URLS = await getOpenAIUrls(localStorage.token);
|
|
||||||
OPENAI_API_KEYS = await getOpenAIKeys(localStorage.token);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@ -79,6 +87,7 @@
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div class=" pr-1.5 overflow-y-scroll max-h-[25rem] space-y-3">
|
<div class=" pr-1.5 overflow-y-scroll max-h-[25rem] space-y-3">
|
||||||
|
{#if ENABLE_OPENAI_API !== null && ENABLE_OLLAMA_API !== null}
|
||||||
<div class=" space-y-3">
|
<div class=" space-y-3">
|
||||||
<div class="mt-2 space-y-2 pr-1.5">
|
<div class="mt-2 space-y-2 pr-1.5">
|
||||||
<div class="flex justify-between items-center text-sm">
|
<div class="flex justify-between items-center text-sm">
|
||||||
@ -219,7 +228,9 @@
|
|||||||
<button
|
<button
|
||||||
class="px-1"
|
class="px-1"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
OLLAMA_BASE_URLS = OLLAMA_BASE_URLS.filter((url, urlIdx) => idx !== urlIdx);
|
OLLAMA_BASE_URLS = OLLAMA_BASE_URLS.filter(
|
||||||
|
(url, urlIdx) => idx !== urlIdx
|
||||||
|
);
|
||||||
}}
|
}}
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
@ -274,6 +285,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
{:else}
|
||||||
|
<div class="flex h-full justify-center">
|
||||||
|
<div class="my-auto">
|
||||||
|
<Spinner className="size-6" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex justify-end pt-3 text-sm font-medium">
|
<div class="flex justify-end pt-3 text-sm font-medium">
|
||||||
|
Loading…
Reference in New Issue
Block a user