mirror of
				https://github.com/open-webui/open-webui
				synced 2025-06-26 18:26:48 +00:00 
			
		
		
		
	Merge e24758f54b into a21519f8f2
				
					
				
			This commit is contained in:
		
						commit
						b661ea34b5
					
				@ -1081,6 +1081,10 @@ USER_PERMISSIONS_CHAT_SYSTEM_PROMPT = (
 | 
			
		||||
    os.environ.get("USER_PERMISSIONS_CHAT_SYSTEM_PROMPT", "True").lower() == "true"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
USER_PERMISSIONS_CHAT_IMAGE_CAPTURE = (
 | 
			
		||||
    os.environ.get("USER_PERMISSIONS_CHAT_IMAGE_CAPTURE", "True").lower() == "true"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
USER_PERMISSIONS_CHAT_FILE_UPLOAD = (
 | 
			
		||||
    os.environ.get("USER_PERMISSIONS_CHAT_FILE_UPLOAD", "True").lower() == "true"
 | 
			
		||||
)
 | 
			
		||||
@ -1167,6 +1171,7 @@ DEFAULT_USER_PERMISSIONS = {
 | 
			
		||||
    "chat": {
 | 
			
		||||
        "controls": USER_PERMISSIONS_CHAT_CONTROLS,
 | 
			
		||||
        "system_prompt": USER_PERMISSIONS_CHAT_SYSTEM_PROMPT,
 | 
			
		||||
        "image_capture": USER_PERMISSIONS_CHAT_IMAGE_CAPTURE,
 | 
			
		||||
        "file_upload": USER_PERMISSIONS_CHAT_FILE_UPLOAD,
 | 
			
		||||
        "delete": USER_PERMISSIONS_CHAT_DELETE,
 | 
			
		||||
        "edit": USER_PERMISSIONS_CHAT_EDIT,
 | 
			
		||||
 | 
			
		||||
@ -134,6 +134,7 @@ class SharingPermissions(BaseModel):
 | 
			
		||||
class ChatPermissions(BaseModel):
 | 
			
		||||
    controls: bool = True
 | 
			
		||||
    system_prompt: bool = True
 | 
			
		||||
    image_capture: bool = True
 | 
			
		||||
    file_upload: bool = True
 | 
			
		||||
    delete: bool = True
 | 
			
		||||
    edit: bool = True
 | 
			
		||||
 | 
			
		||||
@ -66,6 +66,7 @@
 | 
			
		||||
		chat: {
 | 
			
		||||
			controls: true,
 | 
			
		||||
			system_prompt: true,
 | 
			
		||||
			image_capture: true,
 | 
			
		||||
			file_upload: true,
 | 
			
		||||
			delete: true,
 | 
			
		||||
			edit: true,
 | 
			
		||||
 | 
			
		||||
@ -46,6 +46,7 @@
 | 
			
		||||
		},
 | 
			
		||||
		chat: {
 | 
			
		||||
			controls: true,
 | 
			
		||||
			image_capture: true,
 | 
			
		||||
			file_upload: true,
 | 
			
		||||
			delete: true,
 | 
			
		||||
			edit: true,
 | 
			
		||||
 | 
			
		||||
@ -21,6 +21,7 @@
 | 
			
		||||
		},
 | 
			
		||||
		chat: {
 | 
			
		||||
			controls: true,
 | 
			
		||||
			image_capture: true,
 | 
			
		||||
			file_upload: true,
 | 
			
		||||
			delete: true,
 | 
			
		||||
			edit: true,
 | 
			
		||||
@ -271,6 +272,14 @@
 | 
			
		||||
			<Switch bind:state={permissions.chat.system_prompt} />
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
		<div class="  flex w-full justify-between my-2 pr-2">
 | 
			
		||||
			<div class=" self-center text-xs font-medium">
 | 
			
		||||
				{$i18n.t('Allow Image capture')}
 | 
			
		||||
			</div>
 | 
			
		||||
 | 
			
		||||
			<Switch bind:state={permissions.chat.image_capture} />
 | 
			
		||||
		</div>
 | 
			
		||||
 | 
			
		||||
		<div class="  flex w-full justify-between my-2 pr-2">
 | 
			
		||||
			<div class=" self-center text-xs font-medium">
 | 
			
		||||
				{$i18n.t('Allow Chat Delete')}
 | 
			
		||||
 | 
			
		||||
@ -173,36 +173,38 @@
 | 
			
		||||
				<hr class="border-black/5 dark:border-white/5 my-1" />
 | 
			
		||||
			{/if}
 | 
			
		||||
 | 
			
		||||
			<Tooltip
 | 
			
		||||
				content={fileUploadCapableModels.length !== selectedModels.length
 | 
			
		||||
					? $i18n.t('Model(s) do not support file upload')
 | 
			
		||||
					: !fileUploadEnabled
 | 
			
		||||
						? $i18n.t('You do not have permission to upload files.')
 | 
			
		||||
						: ''}
 | 
			
		||||
				className="w-full"
 | 
			
		||||
			>
 | 
			
		||||
				<DropdownMenu.Item
 | 
			
		||||
					class="flex gap-2 items-center px-3 py-2 text-sm  font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800  rounded-xl {!fileUploadEnabled
 | 
			
		||||
						? 'opacity-50'
 | 
			
		||||
						: ''}"
 | 
			
		||||
					on:click={() => {
 | 
			
		||||
						if (fileUploadEnabled) {
 | 
			
		||||
							if (!detectMobile()) {
 | 
			
		||||
								screenCaptureHandler();
 | 
			
		||||
							} else {
 | 
			
		||||
								const cameraInputElement = document.getElementById('camera-input');
 | 
			
		||||
			{#if $user?.role === 'admin' || $user?.permissions.chat?.image_capture}
 | 
			
		||||
				<Tooltip
 | 
			
		||||
					content={fileUploadCapableModels.length !== selectedModels.length
 | 
			
		||||
						? $i18n.t('Model(s) do not support file upload')
 | 
			
		||||
						: !fileUploadEnabled
 | 
			
		||||
							? $i18n.t('You do not have permission to upload files.')
 | 
			
		||||
							: ''}
 | 
			
		||||
					className="w-full"
 | 
			
		||||
				>
 | 
			
		||||
					<DropdownMenu.Item
 | 
			
		||||
						class="flex gap-2 items-center px-3 py-2 text-sm  font-medium cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800  rounded-xl {!fileUploadEnabled
 | 
			
		||||
							? 'opacity-50'
 | 
			
		||||
							: ''}"
 | 
			
		||||
						on:click={() => {
 | 
			
		||||
							if (fileUploadEnabled) {
 | 
			
		||||
								if (!detectMobile()) {
 | 
			
		||||
									screenCaptureHandler();
 | 
			
		||||
								} else {
 | 
			
		||||
									const cameraInputElement = document.getElementById('camera-input');
 | 
			
		||||
 | 
			
		||||
								if (cameraInputElement) {
 | 
			
		||||
									cameraInputElement.click();
 | 
			
		||||
									if (cameraInputElement) {
 | 
			
		||||
										cameraInputElement.click();
 | 
			
		||||
									}
 | 
			
		||||
								}
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}}
 | 
			
		||||
				>
 | 
			
		||||
					<CameraSolid />
 | 
			
		||||
					<div class=" line-clamp-1">{$i18n.t('Capture')}</div>
 | 
			
		||||
				</DropdownMenu.Item>
 | 
			
		||||
			</Tooltip>
 | 
			
		||||
						}}
 | 
			
		||||
					>
 | 
			
		||||
						<CameraSolid />
 | 
			
		||||
						<div class=" line-clamp-1">{$i18n.t('Capture')}</div>
 | 
			
		||||
					</DropdownMenu.Item>
 | 
			
		||||
				</Tooltip>
 | 
			
		||||
			{/if}
 | 
			
		||||
 | 
			
		||||
			<Tooltip
 | 
			
		||||
				content={fileUploadCapableModels.length !== selectedModels.length
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user