File tree Expand file tree Collapse file tree 5 files changed +52
-0
lines changed Expand file tree Collapse file tree 5 files changed +52
-0
lines changed Original file line number Diff line number Diff line change @@ -1261,6 +1261,14 @@ def feishu_oauth_register(oauth: OAuth):
12611261 os .environ .get ("USER_PERMISSIONS_CHAT_SYSTEM_PROMPT" , "True" ).lower () == "true"
12621262)
12631263
1264+ USER_PERMISSIONS_CHAT_IMAGE_CAPTURE = (
1265+ os .environ .get ("USER_PERMISSIONS_CHAT_IMAGE_CAPTURE" , "True" ).lower () == "true"
1266+ )
1267+
1268+ USER_PERMISSIONS_CHAT_ATTACH_KONWLEDGE = (
1269+ os .environ .get ("USER_PERMISSIONS_CHAT_ATTACH_KONWLEDGE" , "True" ).lower () == "true"
1270+ )
1271+
12641272USER_PERMISSIONS_CHAT_PARAMS = (
12651273 os .environ .get ("USER_PERMISSIONS_CHAT_PARAMS" , "True" ).lower () == "true"
12661274)
@@ -1370,6 +1378,8 @@ def feishu_oauth_register(oauth: OAuth):
13701378 "controls" : USER_PERMISSIONS_CHAT_CONTROLS ,
13711379 "valves" : USER_PERMISSIONS_CHAT_VALVES ,
13721380 "system_prompt" : USER_PERMISSIONS_CHAT_SYSTEM_PROMPT ,
1381+ "image_capture" : USER_PERMISSIONS_CHAT_IMAGE_CAPTURE ,
1382+ "attach_knowledge" : USER_PERMISSIONS_CHAT_ATTACH_KONWLEDGE ,
13731383 "params" : USER_PERMISSIONS_CHAT_PARAMS ,
13741384 "file_upload" : USER_PERMISSIONS_CHAT_FILE_UPLOAD ,
13751385 "delete" : USER_PERMISSIONS_CHAT_DELETE ,
Original file line number Diff line number Diff line change @@ -164,6 +164,8 @@ class ChatPermissions(BaseModel):
164164 controls : bool = True
165165 valves : bool = True
166166 system_prompt : bool = True
167+ image_capture : bool = True
168+ attach_knowledge : bool = True
167169 params : bool = True
168170 file_upload : bool = True
169171 delete : bool = True
Original file line number Diff line number Diff line change 5151 controls: true ,
5252 valves: true ,
5353 system_prompt: true ,
54+ image_capture: true ,
55+ attach_knowledge: true ,
5456 params: true ,
5557 file_upload: true ,
5658 delete: true ,
Original file line number Diff line number Diff line change 2525 valves: true ,
2626 system_prompt: true ,
2727 params: true ,
28+ image_capture: true ,
29+ attach_knowledge: true ,
2830 file_upload: true ,
2931 delete: true ,
3032 delete_message: true ,
343345 {/if }
344346 </div >
345347
348+ <div class =" flex flex-col w-full" >
349+ <div class =" flex w-full justify-between my-1" >
350+ <div class =" self-center text-xs font-medium" >
351+ {$i18n .t (' Allow Image capture' )}
352+ </div >
353+ <Switch bind:state ={permissions .chat .image_capture } />
354+ </div >
355+ {#if defaultPermissions ?.chat ?.image_capture && ! permissions .chat .image_capture }
356+ <div >
357+ <div class =" text-xs text-gray-500" >
358+ {$i18n .t (' This is a default user permission and will remain enabled.' )}
359+ </div >
360+ </div >
361+ {/if }
362+ </div >
363+
364+ <div class =" flex flex-col w-full" >
365+ <div class =" flex w-full justify-between my-1" >
366+ <div class =" self-center text-xs font-medium" >
367+ {$i18n .t (' Allow Attach Knowledge' )}
368+ </div >
369+ <Switch bind:state ={permissions .chat .attach_knowledge } />
370+ </div >
371+ {#if defaultPermissions ?.chat ?.attach_knowledge && ! permissions .chat .attach_knowledge }
372+ <div >
373+ <div class =" text-xs text-gray-500" >
374+ {$i18n .t (' This is a default user permission and will remain enabled.' )}
375+ </div >
376+ </div >
377+ {/if }
378+ </div >
379+
346380 <div class =" flex flex-col w-full" >
347381 <div class =" flex w-full justify-between my-1" >
348382 <div class =" self-center text-xs font-medium" >
Original file line number Diff line number Diff line change 159159 </DropdownMenu .Item >
160160 </Tooltip >
161161
162+ {#if $user ?.role === ' admin' || $user ?.permissions .chat ?.image_capture }
162163 <Tooltip
163164 content ={fileUploadCapableModels .length !== selectedModels .length
164165 ? $i18n .t (' Model(s) do not support file upload' )
189190 <div class =" line-clamp-1" >{$i18n .t (' Capture' )}</div >
190191 </DropdownMenu .Item >
191192 </Tooltip >
193+ {/if }
192194
193195 <Tooltip
194196 content ={fileUploadCapableModels .length !== selectedModels .length
244246 {/if }
245247
246248 {#if ($knowledge ?? []).length > 0 }
249+ {#if $user ?.role === ' admin' || $user ?.permissions .chat ?.attach_knowledge }
247250 <Tooltip
248251 content ={fileUploadCapableModels .length !== selectedModels .length
249252 ? $i18n .t (' Model(s) do not support file upload' )
273276 </div >
274277 </button >
275278 </Tooltip >
279+ {/if }
276280 {/if }
277281
278282 {#if ($chats ?? []).length > 0 }
You can’t perform that action at this time.
0 commit comments