diff --git a/backend/open_webui/models/channels.py b/backend/open_webui/models/channels.py index 1779e1566..bc36146cf 100644 --- a/backend/open_webui/models/channels.py +++ b/backend/open_webui/models/channels.py @@ -70,6 +70,7 @@ class ChannelTable: channel = ChannelModel( **{ **form_data.model_dump(), + "name": form_data.name.lower(), "id": str(uuid.uuid4()), "user_id": user_id, "created_at": int(time.time_ns()), diff --git a/src/lib/components/channel/Channel.svelte b/src/lib/components/channel/Channel.svelte index dba69a9e0..0b9f5d205 100644 --- a/src/lib/components/channel/Channel.svelte +++ b/src/lib/components/channel/Channel.svelte @@ -2,12 +2,13 @@ import { toast } from 'svelte-sonner'; import { onDestroy, onMount, tick } from 'svelte'; - import { socket } from '$lib/stores'; + import { showSidebar, socket } from '$lib/stores'; import { getChannelById, getChannelMessages, sendMessage } from '$lib/apis/channels'; import Messages from './Messages.svelte'; import MessageInput from './MessageInput.svelte'; import { goto } from '$app/navigation'; + import Navbar from './Navbar.svelte'; export let id = ''; @@ -95,35 +96,42 @@ }); -
-
{ - scrollEnd = Math.abs(messagesContainerElement.scrollTop) <= 50; - }} - > - {#key id} - { - page += 1; +
+ {#if channel} + +
{ + scrollEnd = Math.abs(messagesContainerElement.scrollTop) <= 50; + }} + > + {#key id} + { + page += 1; - const newMessages = await getChannelMessages(localStorage.token, id, page); + const newMessages = await getChannelMessages(localStorage.token, id, page); - if (newMessages.length === 0) { - top = true; - return; - } + if (newMessages.length === 0) { + top = true; + return; + } - messages = [...messages, ...newMessages]; - }} - /> - {/key} -
+ messages = [...messages, ...newMessages]; + }} + /> + {/key} +
+ {/if}
diff --git a/src/lib/components/channel/Navbar.svelte b/src/lib/components/channel/Navbar.svelte new file mode 100644 index 000000000..e55aeacf3 --- /dev/null +++ b/src/lib/components/channel/Navbar.svelte @@ -0,0 +1,84 @@ + + +
+
+ +
+
+
+ +
+ +
+
+ {channel.name} +
+
+ +
+ {#if $user !== undefined} + { + if (e.detail === 'archived-chat') { + showArchivedChats.set(true); + } + }} + > + + + {/if} +
+
+
+
diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 92691e6d9..d6120d0ee 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -70,15 +70,15 @@ generateMoACompletion, stopTask } from '$lib/apis'; + import { getTools } from '$lib/apis/tools'; import Banner from '../common/Banner.svelte'; import MessageInput from '$lib/components/chat/MessageInput.svelte'; import Messages from '$lib/components/chat/Messages.svelte'; - import Navbar from '$lib/components/layout/Navbar.svelte'; + import Navbar from '$lib/components/chat/Navbar.svelte'; import ChatControls from './ChatControls.svelte'; import EventConfirmDialog from '../common/ConfirmDialog.svelte'; import Placeholder from './Placeholder.svelte'; - import { getTools } from '$lib/apis/tools'; import NotificationToast from '../NotificationToast.svelte'; export let chatIdProp = ''; diff --git a/src/lib/components/chat/Navbar.svelte b/src/lib/components/chat/Navbar.svelte new file mode 100644 index 000000000..ef0e1233f --- /dev/null +++ b/src/lib/components/chat/Navbar.svelte @@ -0,0 +1,194 @@ + + + + +
+
+ +
+
+
+ +
+ +
+ {#if showModelSelector} + + {/if} +
+ +
+ + {#if shareEnabled && chat && (chat.id || $temporaryChatEnabled)} + { + showShareChatModal = !showShareChatModal; + }} + downloadHandler={() => { + showDownloadChatModal = !showDownloadChatModal; + }} + > + + + {:else if $mobile} + + + + {/if} + + {#if !$mobile} + + + + {/if} + + + + + + {#if $user !== undefined} + { + if (e.detail === 'archived-chat') { + showArchivedChats.set(true); + } + }} + > + + + {/if} +
+
+
+
diff --git a/src/lib/components/layout/Sidebar/CreateChannelModal.svelte b/src/lib/components/layout/Sidebar/CreateChannelModal.svelte index ca629efa7..7834e7442 100644 --- a/src/lib/components/layout/Sidebar/CreateChannelModal.svelte +++ b/src/lib/components/layout/Sidebar/CreateChannelModal.svelte @@ -17,7 +17,7 @@ let loading = false; $: if (name) { - name = name.replace(/\s/g, '-'); + name = name.replace(/\s/g, '-').toLocaleLowerCase(); } const submitHandler = async () => {