File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1454,6 +1454,10 @@ def reachable(host: str, port: int) -> bool:
14541454 os .environ .get ("USER_PERMISSIONS_CHAT_FILE_UPLOAD" , "True" ).lower () == "true"
14551455)
14561456
1457+ USER_PERMISSIONS_CHAT_WEB_UPLOAD = (
1458+ os .environ .get ("USER_PERMISSIONS_CHAT_WEB_UPLOAD" , "True" ).lower () == "true"
1459+ )
1460+
14571461USER_PERMISSIONS_CHAT_DELETE = (
14581462 os .environ .get ("USER_PERMISSIONS_CHAT_DELETE" , "True" ).lower () == "true"
14591463)
@@ -1592,6 +1596,7 @@ def reachable(host: str, port: int) -> bool:
15921596 "system_prompt" : USER_PERMISSIONS_CHAT_SYSTEM_PROMPT ,
15931597 "params" : USER_PERMISSIONS_CHAT_PARAMS ,
15941598 "file_upload" : USER_PERMISSIONS_CHAT_FILE_UPLOAD ,
1599+ "web_upload" : USER_PERMISSIONS_CHAT_WEB_UPLOAD ,
15951600 "delete" : USER_PERMISSIONS_CHAT_DELETE ,
15961601 "delete_message" : USER_PERMISSIONS_CHAT_DELETE_MESSAGE ,
15971602 "continue_response" : USER_PERMISSIONS_CHAT_CONTINUE_RESPONSE ,
Original file line number Diff line number Diff line change @@ -202,6 +202,7 @@ class ChatPermissions(BaseModel):
202202 system_prompt : bool = True
203203 params : bool = True
204204 file_upload : bool = True
205+ web_upload : bool = True
205206 delete : bool = True
206207 delete_message : bool = True
207208 continue_response : bool = True
Original file line number Diff line number Diff line change 414414 {/if }
415415 </div >
416416
417+ <div class =" flex flex-col w-full" >
418+ <div class =" flex w-full justify-between my-1" >
419+ <div class =" self-center text-xs font-medium" >
420+ {$i18n .t (' Allow Web Upload' )}
421+ </div >
422+ <Switch bind:state ={permissions .chat .web_upload } />
423+ </div >
424+ {#if defaultPermissions ?.chat ?.web_upload && ! permissions .chat .web_upload }
425+ <div >
426+ <div class =" text-xs text-gray-500" >
427+ {$i18n .t (' This is a default user permission and will remain enabled.' )}
428+ </div >
429+ </div >
430+ {/if }
431+ </div >
432+
417433 <div class =" flex flex-col w-full" >
418434 <div class =" flex w-full justify-between my-1" >
419435 <div class =" self-center text-xs font-medium" >
Original file line number Diff line number Diff line change 5656 fileUploadCapableModels .length === selectedModels .length &&
5757 ($user ?.role === ' admin' || $user ?.permissions ?.chat ?.file_upload );
5858
59+ let webUploadEnabled = true ;
60+ $ : webUploadEnabled =
61+ $user ?.role === ' admin' || ($user ?.permissions ?.chat ?.web_upload ?? true );
62+
5963 $ : if (! fileUploadEnabled && files .length > 0 ) {
6064 files = [];
6165 }
185189 </Tooltip >
186190
187191 <Tooltip
188- content ={fileUploadCapableModels .length !== selectedModels .length
189- ? $i18n .t (' Model(s) do not support file upload' )
190- : ! fileUploadEnabled
191- ? $i18n .t (' You do not have permission to upload files.' )
192- : ' ' }
192+ content ={! webUploadEnabled
193+ ? $i18n .t (' You do not have permission to upload web content.' )
194+ : ' ' }
193195 className =" w-full"
194196 >
195197 <DropdownMenu .Item
196- class ="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl {! fileUploadEnabled
198+ class ="flex gap-2 items-center px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-xl {! webUploadEnabled
197199 ? ' opacity-50'
198200 : ' ' }"
199201 on:click ={() => {
200- if (fileUploadEnabled ) {
202+ if (webUploadEnabled ) {
201203 showAttachWebpageModal = true ;
202204 }
203205 }}
Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ export const DEFAULT_PERMISSIONS = {
3232 system_prompt : true ,
3333 params : true ,
3434 file_upload : true ,
35+ web_upload : true ,
3536 delete : true ,
3637 delete_message : true ,
3738 continue_response : true ,
You can’t perform that action at this time.
0 commit comments