forked from open-webui/open-webui
		
	feat: enable title generation prompt edit
This commit is contained in:
		
							parent
							
								
									a2088989ca
								
							
						
					
					
						commit
						05ea6cf6fd
					
				
					 4 changed files with 41 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -13,6 +13,7 @@
 | 
			
		|||
	let responseAutoCopy = false;
 | 
			
		||||
	let titleAutoGenerateModel = '';
 | 
			
		||||
	let fullScreenMode = false;
 | 
			
		||||
	let titleGenerationPrompt = '';
 | 
			
		||||
 | 
			
		||||
	// Interface
 | 
			
		||||
	let promptSuggestions = [];
 | 
			
		||||
| 
						 | 
				
			
			@ -56,8 +57,14 @@
 | 
			
		|||
	};
 | 
			
		||||
 | 
			
		||||
	const updateInterfaceHandler = async () => {
 | 
			
		||||
		promptSuggestions = await setDefaultPromptSuggestions(localStorage.token, promptSuggestions);
 | 
			
		||||
		await config.set(await getBackendConfig());
 | 
			
		||||
		if ($user.role === 'admin') {
 | 
			
		||||
			promptSuggestions = await setDefaultPromptSuggestions(localStorage.token, promptSuggestions);
 | 
			
		||||
			await config.set(await getBackendConfig());
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		saveSettings({
 | 
			
		||||
			titleGenerationPrompt: titleGenerationPrompt ? titleGenerationPrompt : undefined
 | 
			
		||||
		});
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
	onMount(async () => {
 | 
			
		||||
| 
						 | 
				
			
			@ -72,6 +79,9 @@
 | 
			
		|||
		showUsername = settings.showUsername ?? false;
 | 
			
		||||
		fullScreenMode = settings.fullScreenMode ?? false;
 | 
			
		||||
		titleAutoGenerateModel = settings.titleAutoGenerateModel ?? '';
 | 
			
		||||
		titleGenerationPrompt =
 | 
			
		||||
			settings.titleGenerationPrompt ??
 | 
			
		||||
			`Create a concise, 3-5 word phrase as a header for the following query, strictly adhering to the 3-5 word limit and avoiding the use of the word 'title': {{prompt}}`;
 | 
			
		||||
	});
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -212,6 +222,14 @@
 | 
			
		|||
					</svg>
 | 
			
		||||
				</button>
 | 
			
		||||
			</div>
 | 
			
		||||
			<div class="mt-3">
 | 
			
		||||
				<div class=" mb-2.5 text-sm font-medium">Title Generation Prompt</div>
 | 
			
		||||
				<textarea
 | 
			
		||||
					bind:value={titleGenerationPrompt}
 | 
			
		||||
					class="w-full rounded p-4 text-sm dark:text-gray-300 dark:bg-gray-800 outline-none resize-none"
 | 
			
		||||
					rows="3"
 | 
			
		||||
				/>
 | 
			
		||||
			</div>
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
		{#if $user.role === 'admin'}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue