Added permission to enable/disable image capture

This commit is contained in:
Jesper Kristensen 2025-06-16 15:53:05 +02:00
parent e05560a49d
commit e24758f54b
No known key found for this signature in database
GPG Key ID: D21D8D9A823A2F42
6 changed files with 46 additions and 27 deletions

View File

@ -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,

View File

@ -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

View File

@ -66,6 +66,7 @@
chat: {
controls: true,
system_prompt: true,
image_capture: true,
file_upload: true,
delete: true,
edit: true,

View File

@ -46,6 +46,7 @@
},
chat: {
controls: true,
image_capture: true,
file_upload: true,
delete: true,
edit: true,

View File

@ -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')}

View File

@ -173,6 +173,7 @@
<hr class="border-black/5 dark:border-white/5 my-1" />
{/if}
{#if $user?.role === 'admin' || $user?.permissions.chat?.image_capture}
<Tooltip
content={fileUploadCapableModels.length !== selectedModels.length
? $i18n.t('Model(s) do not support file upload')
@ -203,6 +204,7 @@
<div class=" line-clamp-1">{$i18n.t('Capture')}</div>
</DropdownMenu.Item>
</Tooltip>
{/if}
<Tooltip
content={fileUploadCapableModels.length !== selectedModels.length