mirror of
https://github.com/open-webui/open-webui
synced 2025-05-18 04:15:07 +00:00
fix: sidebar model selector issue
This commit is contained in:
parent
ad67339426
commit
de75679ffb
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
import { cancelOllamaRequest, deleteModel, getOllamaVersion, pullModel } from '$lib/apis/ollama';
|
import { cancelOllamaRequest, deleteModel, getOllamaVersion, pullModel } from '$lib/apis/ollama';
|
||||||
|
|
||||||
import { user, MODEL_DOWNLOAD_POOL, models } from '$lib/stores';
|
import { user, MODEL_DOWNLOAD_POOL, models, mobile } from '$lib/stores';
|
||||||
import { toast } from 'svelte-sonner';
|
import { toast } from 'svelte-sonner';
|
||||||
import { capitalizeFirstLetter, getModels, splitStream } from '$lib/utils';
|
import { capitalizeFirstLetter, getModels, splitStream } from '$lib/utils';
|
||||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||||
@ -201,10 +201,11 @@
|
|||||||
<ChevronDown className=" self-center ml-2 size-3" strokeWidth="2.5" />
|
<ChevronDown className=" self-center ml-2 size-3" strokeWidth="2.5" />
|
||||||
</div>
|
</div>
|
||||||
</DropdownMenu.Trigger>
|
</DropdownMenu.Trigger>
|
||||||
|
|
||||||
<DropdownMenu.Content
|
<DropdownMenu.Content
|
||||||
class=" z-40 {className} max-w-[calc(100vw-1rem)] justify-start rounded-lg bg-white dark:bg-gray-900 dark:text-white shadow-lg border border-gray-300/30 dark:border-gray-700/50 outline-none "
|
class=" z-40 {className} max-w-[calc(100vw-1rem)] justify-start rounded-lg bg-white dark:bg-gray-900 dark:text-white shadow-lg border border-gray-300/30 dark:border-gray-700/50 outline-none "
|
||||||
transition={flyAndScale}
|
transition={flyAndScale}
|
||||||
side={'bottom'}
|
side={$mobile ? 'bottom' : 'bottom-start'}
|
||||||
sideOffset={4}
|
sideOffset={4}
|
||||||
>
|
>
|
||||||
<slot>
|
<slot>
|
||||||
|
@ -234,7 +234,7 @@
|
|||||||
</button>
|
</button>
|
||||||
<a
|
<a
|
||||||
id="sidebar-new-chat-button"
|
id="sidebar-new-chat-button"
|
||||||
class="flex justify-between rounded-xl px-2 py-2 hover:bg-gray-100 dark:hover:bg-gray-900 transition"
|
class="flex justify-between rounded-xl px-2 py-2 hover:bg-gray-100 dark:hover:bg-gray-850 transition"
|
||||||
href="/"
|
href="/"
|
||||||
on:click={async () => {
|
on:click={async () => {
|
||||||
selectedChatId = null;
|
selectedChatId = null;
|
||||||
|
@ -9,6 +9,8 @@ export const user: Writable<SessionUser | undefined> = writable(undefined);
|
|||||||
// Frontend
|
// Frontend
|
||||||
export const MODEL_DOWNLOAD_POOL = writable({});
|
export const MODEL_DOWNLOAD_POOL = writable({});
|
||||||
|
|
||||||
|
export const mobile = writable(false);
|
||||||
|
|
||||||
export const theme = writable('system');
|
export const theme = writable('system');
|
||||||
export const chatId = writable('');
|
export const chatId = writable('');
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script>
|
<script>
|
||||||
import { onMount, tick, setContext } from 'svelte';
|
import { onMount, tick, setContext } from 'svelte';
|
||||||
import { config, user, theme, WEBUI_NAME } from '$lib/stores';
|
import { config, user, theme, WEBUI_NAME, mobile } from '$lib/stores';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
import { Toaster, toast } from 'svelte-sonner';
|
import { Toaster, toast } from 'svelte-sonner';
|
||||||
|
|
||||||
@ -18,9 +18,22 @@
|
|||||||
setContext('i18n', i18n);
|
setContext('i18n', i18n);
|
||||||
|
|
||||||
let loaded = false;
|
let loaded = false;
|
||||||
|
const BREAKPOINT = 1024;
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
theme.set(localStorage.theme);
|
theme.set(localStorage.theme);
|
||||||
|
|
||||||
|
mobile.set(window.innerWidth < BREAKPOINT);
|
||||||
|
const onResize = () => {
|
||||||
|
if (window.innerWidth < BREAKPOINT) {
|
||||||
|
mobile.set(true);
|
||||||
|
} else {
|
||||||
|
mobile.set(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
window.addEventListener('resize', onResize);
|
||||||
|
|
||||||
let backendConfig = null;
|
let backendConfig = null;
|
||||||
try {
|
try {
|
||||||
backendConfig = await getBackendConfig();
|
backendConfig = await getBackendConfig();
|
||||||
@ -67,6 +80,10 @@
|
|||||||
|
|
||||||
document.getElementById('splash-screen')?.remove();
|
document.getElementById('splash-screen')?.remove();
|
||||||
loaded = true;
|
loaded = true;
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
window.removeEventListener('resize', onResize);
|
||||||
|
};
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user