diff --git a/src/lib/components/chat/ShareChatModal.svelte b/src/lib/components/chat/ShareChatModal.svelte new file mode 100644 index 000000000..f834c421d --- /dev/null +++ b/src/lib/components/chat/ShareChatModal.svelte @@ -0,0 +1,38 @@ + + + + + { + shareChat(); + show = false; + }} + > + Upload to OllamaHub + + + + or + + { + downloadChat(); + show = false; + }} + > + Download as a File + + + + diff --git a/src/lib/components/common/Modal.svelte b/src/lib/components/common/Modal.svelte index 0fb3f8bd1..b292b910f 100644 --- a/src/lib/components/common/Modal.svelte +++ b/src/lib/components/common/Modal.svelte @@ -8,7 +8,9 @@ let mounted = false; const sizeToWidth = (size) => { - if (size === 'sm') { + if (size === 'xs') { + return 'w-[16rem]'; + } else if (size === 'sm') { return 'w-[30rem]'; } else { return 'w-[40rem]'; diff --git a/src/lib/components/layout/Navbar.svelte b/src/lib/components/layout/Navbar.svelte index bd52bd9b5..e75dafd67 100644 --- a/src/lib/components/layout/Navbar.svelte +++ b/src/lib/components/layout/Navbar.svelte @@ -5,11 +5,14 @@ import { getChatById } from '$lib/apis/chats'; import { chatId, modelfiles } from '$lib/stores'; + import ShareChatModal from '../chat/ShareChatModal.svelte'; export let initNewChat: Function; export let title: string = 'Ollama Web UI'; export let shareEnabled: boolean = false; + let showShareChatModal = false; + const shareChat = async () => { const chat = (await getChatById(localStorage.token, $chatId)).chat; console.log('share', chat); @@ -53,16 +56,17 @@ }; + - - + + @@ -82,59 +86,59 @@ - - {title != '' ? title : 'Ollama Web UI'} + + + {title != '' ? title : 'Ollama Web UI'} + - {#if shareEnabled} - - { - downloadChat(); - }} + + + + Add Tags - - - - { - shareChat(); - }} - > - - - - - - - + - {/if} + + {#if shareEnabled} + { + showShareChatModal = !showShareChatModal; + + // console.log(showShareChatModal); + }} + > + + + + + + + {/if} +