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