Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions backend/open_webui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1196,6 +1196,10 @@ def oidc_oauth_register(client: OAuth):
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_PARAMS = (
os.environ.get("USER_PERMISSIONS_CHAT_PARAMS", "True").lower() == "true"
)
Expand Down Expand Up @@ -1304,6 +1308,7 @@ def oidc_oauth_register(client: OAuth):
"controls": USER_PERMISSIONS_CHAT_CONTROLS,
"valves": USER_PERMISSIONS_CHAT_VALVES,
"system_prompt": USER_PERMISSIONS_CHAT_SYSTEM_PROMPT,
"image_capture": USER_PERMISSIONS_CHAT_IMAGE_CAPTURE,
"params": USER_PERMISSIONS_CHAT_PARAMS,
"file_upload": USER_PERMISSIONS_CHAT_FILE_UPLOAD,
"delete": USER_PERMISSIONS_CHAT_DELETE,
Expand Down
1 change: 1 addition & 0 deletions backend/open_webui/routers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ class ChatPermissions(BaseModel):
controls: bool = True
valves: bool = True
system_prompt: bool = True
image_capture: bool = True
params: bool = True
file_upload: bool = True
delete: bool = True
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/admin/Users/Groups.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
controls: true,
valves: true,
system_prompt: true,
image_capture: true,
params: true,
file_upload: true,
delete: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
controls: true,
valves: true,
system_prompt: true,
image_capture: true,
params: true,
file_upload: true,
delete: true,
Expand Down
9 changes: 9 additions & 0 deletions src/lib/components/admin/Users/Groups/Permissions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
valves: true,
system_prompt: true,
params: true,
image_capture: true,
file_upload: true,
delete: true,
delete_message: true,
Expand Down Expand Up @@ -304,6 +305,14 @@
<Switch bind:state={permissions.chat.edit} />
</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')}
Expand Down
56 changes: 29 additions & 27 deletions src/lib/components/chat/MessageInput/InputMenu.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -182,36 +182,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
Expand Down