forked from open-webui/open-webui
		
	feat: changelog modal auto popup
This commit is contained in:
		
							parent
							
								
									a84070c6d3
								
							
						
					
					
						commit
						05aea9edf9
					
				
					 5 changed files with 25 additions and 17 deletions
				
			
		|  | @ -1,10 +1,14 @@ | ||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
| 	import Modal from './common/Modal.svelte'; |  | ||||||
| 	import { Confetti } from 'svelte-confetti'; |  | ||||||
| 	import { WEBUI_NAME, WEB_UI_VERSION } from '$lib/constants'; |  | ||||||
| 	import { onMount } from 'svelte'; | 	import { onMount } from 'svelte'; | ||||||
|  | 	import { Confetti } from 'svelte-confetti'; | ||||||
|  | 
 | ||||||
|  | 	import { config } from '$lib/stores'; | ||||||
|  | 
 | ||||||
|  | 	import { WEBUI_NAME, WEB_UI_VERSION } from '$lib/constants'; | ||||||
| 	import { getChangelog } from '$lib/apis'; | 	import { getChangelog } from '$lib/apis'; | ||||||
| 
 | 
 | ||||||
|  | 	import Modal from './common/Modal.svelte'; | ||||||
|  | 
 | ||||||
| 	export let show = false; | 	export let show = false; | ||||||
| 
 | 
 | ||||||
| 	let changelog = null; | 	let changelog = null; | ||||||
|  | @ -79,11 +83,12 @@ | ||||||
| 		<div class="flex justify-end pt-3 text-sm font-medium"> | 		<div class="flex justify-end pt-3 text-sm font-medium"> | ||||||
| 			<button | 			<button | ||||||
| 				on:click={() => { | 				on:click={() => { | ||||||
|  | 					localStorage.version = $config.version; | ||||||
| 					show = false; | 					show = false; | ||||||
| 				}} | 				}} | ||||||
| 				class=" px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-gray-100 transition rounded" | 				class=" px-4 py-2 bg-emerald-600 hover:bg-emerald-700 text-gray-100 transition rounded" | ||||||
| 			> | 			> | ||||||
| 				<span class="relative">Ok, let's go!</span> | 				<span class="relative">Okay, Let's Go!</span> | ||||||
| 			</button> | 			</button> | ||||||
| 		</div> | 		</div> | ||||||
| 	</div> | 	</div> | ||||||
|  |  | ||||||
|  | @ -35,13 +35,13 @@ | ||||||
| 	<!-- svelte-ignore a11y-no-static-element-interactions --> | 	<!-- svelte-ignore a11y-no-static-element-interactions --> | ||||||
| 	<div | 	<div | ||||||
| 		class=" fixed top-0 right-0 left-0 bottom-0 bg-black/60 w-full min-h-screen h-screen flex justify-center z-50 overflow-hidden overscroll-contain" | 		class=" fixed top-0 right-0 left-0 bottom-0 bg-black/60 w-full min-h-screen h-screen flex justify-center z-50 overflow-hidden overscroll-contain" | ||||||
| 		transition:fade={{ duration: 50 }} | 		in:fade={{ duration: 10 }} | ||||||
| 	> | 	> | ||||||
| 		<div | 		<div | ||||||
| 			class=" modal-content m-auto rounded-xl max-w-full {sizeToWidth( | 			class=" modal-content m-auto rounded-xl max-w-full {sizeToWidth( | ||||||
| 				size | 				size | ||||||
| 			)} mx-2 bg-gray-50 dark:bg-gray-900 shadow-3xl" | 			)} mx-2 bg-gray-50 dark:bg-gray-900 shadow-3xl" | ||||||
| 			transition:fade={{ duration: 50 }} | 			in:fade={{ duration: 10 }} | ||||||
| 			on:click={(e) => { | 			on:click={(e) => { | ||||||
| 				e.stopPropagation(); | 				e.stopPropagation(); | ||||||
| 			}} | 			}} | ||||||
|  |  | ||||||
|  | @ -563,7 +563,7 @@ | ||||||
| 						<div | 						<div | ||||||
| 							id="dropdownDots" | 							id="dropdownDots" | ||||||
| 							class="absolute z-40 bottom-[70px] 4.5rem rounded-lg shadow w-[240px] bg-gray-900" | 							class="absolute z-40 bottom-[70px] 4.5rem rounded-lg shadow w-[240px] bg-gray-900" | ||||||
| 							transition:slide={{ duration: 300 }} | 							in:slide={{ duration: 150 }} | ||||||
| 						> | 						> | ||||||
| 							<div class="py-2 w-full"> | 							<div class="py-2 w-full"> | ||||||
| 								{#if $user.role === 'admin'} | 								{#if $user.role === 'admin'} | ||||||
|  |  | ||||||
|  | @ -32,3 +32,4 @@ export const documents = writable([ | ||||||
| 
 | 
 | ||||||
| export const settings = writable({}); | export const settings = writable({}); | ||||||
| export const showSettings = writable(false); | export const showSettings = writable(false); | ||||||
|  | export const showChangelog = writable(false); | ||||||
|  |  | ||||||
|  | @ -1,17 +1,18 @@ | ||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
| 	import toast from 'svelte-french-toast'; | 	import toast from 'svelte-french-toast'; | ||||||
| 	import { openDB, deleteDB } from 'idb'; | 	import { openDB, deleteDB } from 'idb'; | ||||||
| 	import { onMount, tick } from 'svelte'; |  | ||||||
| 	import { goto } from '$app/navigation'; |  | ||||||
| 
 |  | ||||||
| 	import fileSaver from 'file-saver'; | 	import fileSaver from 'file-saver'; | ||||||
| 	const { saveAs } = fileSaver; | 	const { saveAs } = fileSaver; | ||||||
| 
 | 
 | ||||||
|  | 	import { onMount, tick } from 'svelte'; | ||||||
|  | 	import { goto } from '$app/navigation'; | ||||||
|  | 
 | ||||||
| 	import { getOllamaModels, getOllamaVersion } from '$lib/apis/ollama'; | 	import { getOllamaModels, getOllamaVersion } from '$lib/apis/ollama'; | ||||||
| 	import { getModelfiles } from '$lib/apis/modelfiles'; | 	import { getModelfiles } from '$lib/apis/modelfiles'; | ||||||
| 	import { getPrompts } from '$lib/apis/prompts'; | 	import { getPrompts } from '$lib/apis/prompts'; | ||||||
| 
 |  | ||||||
| 	import { getOpenAIModels } from '$lib/apis/openai'; | 	import { getOpenAIModels } from '$lib/apis/openai'; | ||||||
|  | 	import { getDocs } from '$lib/apis/documents'; | ||||||
|  | 	import { getAllChatTags } from '$lib/apis/chats'; | ||||||
| 
 | 
 | ||||||
| 	import { | 	import { | ||||||
| 		user, | 		user, | ||||||
|  | @ -21,16 +22,16 @@ | ||||||
| 		modelfiles, | 		modelfiles, | ||||||
| 		prompts, | 		prompts, | ||||||
| 		documents, | 		documents, | ||||||
| 		tags | 		tags, | ||||||
|  | 		showChangelog, | ||||||
|  | 		config | ||||||
| 	} from '$lib/stores'; | 	} from '$lib/stores'; | ||||||
| 	import { REQUIRED_OLLAMA_VERSION, WEBUI_API_BASE_URL } from '$lib/constants'; | 	import { REQUIRED_OLLAMA_VERSION, WEBUI_API_BASE_URL } from '$lib/constants'; | ||||||
|  | 	import { checkVersion } from '$lib/utils'; | ||||||
| 
 | 
 | ||||||
| 	import SettingsModal from '$lib/components/chat/SettingsModal.svelte'; | 	import SettingsModal from '$lib/components/chat/SettingsModal.svelte'; | ||||||
| 	import Sidebar from '$lib/components/layout/Sidebar.svelte'; | 	import Sidebar from '$lib/components/layout/Sidebar.svelte'; | ||||||
| 	import { checkVersion } from '$lib/utils'; |  | ||||||
| 	import ShortcutsModal from '$lib/components/chat/ShortcutsModal.svelte'; | 	import ShortcutsModal from '$lib/components/chat/ShortcutsModal.svelte'; | ||||||
| 	import { getDocs } from '$lib/apis/documents'; |  | ||||||
| 	import { getAllChatTags } from '$lib/apis/chats'; |  | ||||||
| 	import ChangelogModal from '$lib/components/ChangelogModal.svelte'; | 	import ChangelogModal from '$lib/components/ChangelogModal.svelte'; | ||||||
| 
 | 
 | ||||||
| 	let ollamaVersion = ''; | 	let ollamaVersion = ''; | ||||||
|  | @ -183,6 +184,8 @@ | ||||||
| 				} | 				} | ||||||
| 			}); | 			}); | ||||||
| 
 | 
 | ||||||
|  | 			showChangelog.set(localStorage.version !== $config.version); | ||||||
|  | 
 | ||||||
| 			await tick(); | 			await tick(); | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
|  | @ -349,8 +352,6 @@ | ||||||
| 					</div> | 					</div> | ||||||
| 				</div> | 				</div> | ||||||
| 			</div> | 			</div> | ||||||
| 		{:else} |  | ||||||
| 			<ChangelogModal show={true} /> |  | ||||||
| 		{/if} | 		{/if} | ||||||
| 
 | 
 | ||||||
| 		<div | 		<div | ||||||
|  | @ -358,6 +359,7 @@ | ||||||
| 		> | 		> | ||||||
| 			<Sidebar /> | 			<Sidebar /> | ||||||
| 			<SettingsModal bind:show={$showSettings} /> | 			<SettingsModal bind:show={$showSettings} /> | ||||||
|  | 			<ChangelogModal bind:show={$showChangelog} /> | ||||||
| 			<slot /> | 			<slot /> | ||||||
| 		</div> | 		</div> | ||||||
| 	</div> | 	</div> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Timothy J. Baek
						Timothy J. Baek