forked from open-webui/open-webui
		
	Added the option to show the username in the chat in settings -> interface
This commit is contained in:
		
							parent
							
								
									46d0eff218
								
							
						
					
					
						commit
						e1d4c87ff0
					
				
					 2 changed files with 40 additions and 6 deletions
				
			
		|  | @ -4,7 +4,7 @@ | |||
| 	import { tick } from 'svelte'; | ||||
| 	import Name from './Name.svelte'; | ||||
| 	import ProfileImage from './ProfileImage.svelte'; | ||||
| 	import { modelfiles } from '$lib/stores'; | ||||
| 	import { modelfiles, settings, user as userStore } from '$lib/stores'; | ||||
| 
 | ||||
| 	export let user; | ||||
| 	export let message; | ||||
|  | @ -58,11 +58,19 @@ | |||
| 					{#if $modelfiles.map((modelfile) => modelfile.tagName).includes(message.user)} | ||||
| 						{$modelfiles.find((modelfile) => modelfile.tagName === message.user)?.title} | ||||
| 					{:else} | ||||
| 						You <span class=" text-gray-500 text-sm font-medium">{message?.user ?? ''}</span> | ||||
| 						{#if $settings.showUsername} | ||||
| 							{$userStore.name} | ||||
| 						{:else} | ||||
| 							You <span class=" text-gray-500 text-sm font-medium">{message?.user ?? ''}</span> | ||||
| 						{/if} | ||||
| 					{/if} | ||||
| 					{:else} | ||||
| 						{#if $settings.showUsername} | ||||
| 							{$userStore.name} | ||||
| 						{:else} | ||||
| 							You | ||||
| 						{/if} | ||||
| 					{/if} | ||||
| 				{:else} | ||||
| 					You | ||||
| 				{/if} | ||||
| 
 | ||||
| 				{#if message.timestamp} | ||||
| 					<span class=" invisible group-hover:visible text-gray-400 text-xs font-medium"> | ||||
|  |  | |||
|  | @ -16,6 +16,13 @@ | |||
| 
 | ||||
| 	// Interface | ||||
| 	let promptSuggestions = []; | ||||
| 	let showUsername = false; | ||||
| 
 | ||||
| 	const toggleShowUsername = async () => { | ||||
| 		showUsername = !showUsername; | ||||
| 		saveSettings({ showUsername: showUsername }); | ||||
| 	}; | ||||
| 
 | ||||
| 
 | ||||
| 	const toggleSpeechAutoSend = async () => { | ||||
| 		speechAutoSend = !speechAutoSend; | ||||
|  | @ -64,7 +71,7 @@ | |||
| 		titleAutoGenerate = settings.titleAutoGenerate ?? true; | ||||
| 		speechAutoSend = settings.speechAutoSend ?? false; | ||||
| 		responseAutoCopy = settings.responseAutoCopy ?? false; | ||||
| 
 | ||||
| 		showUsername = settings.showUsername ?? false; | ||||
| 		titleAutoGenerateModel = settings.titleAutoGenerateModel ?? ''; | ||||
| 	}); | ||||
| </script> | ||||
|  | @ -139,6 +146,25 @@ | |||
| 					</button> | ||||
| 				</div> | ||||
| 			</div> | ||||
| 			<div> | ||||
| 				<div class=" py-0.5 flex w-full justify-between"> | ||||
| 					<div class=" self-center text-xs font-medium">Display the username instead of "You" in the Chat</div> | ||||
| 
 | ||||
| 					<button | ||||
| 						class="p-1 px-3 text-xs flex rounded transition" | ||||
| 						on:click={() => { | ||||
| 							toggleShowUsername(); | ||||
| 						}} | ||||
| 						type="button" | ||||
| 					> | ||||
| 						{#if showUsername === true} | ||||
| 							<span class="ml-2 self-center">On</span> | ||||
| 						{:else} | ||||
| 							<span class="ml-2 self-center">Off</span> | ||||
| 						{/if} | ||||
| 					</button> | ||||
| 				</div> | ||||
| 			</div> | ||||
| 		</div> | ||||
| 
 | ||||
| 		<hr class=" dark:border-gray-700" /> | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue