mirror of
https://github.com/open-webui/open-webui
synced 2025-05-18 04:15:07 +00:00
feat: direct tools user permissions
This commit is contained in:
parent
94bf49440d
commit
7eea95a48c
@ -1034,6 +1034,11 @@ USER_PERMISSIONS_CHAT_TEMPORARY_ENFORCED = (
|
|||||||
== "true"
|
== "true"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
USER_PERMISSIONS_FEATURES_DIRECT_TOOL_SERVERS = (
|
||||||
|
os.environ.get("USER_PERMISSIONS_FEATURES_DIRECT_TOOL_SERVERS", "False").lower()
|
||||||
|
== "true"
|
||||||
|
)
|
||||||
|
|
||||||
USER_PERMISSIONS_FEATURES_WEB_SEARCH = (
|
USER_PERMISSIONS_FEATURES_WEB_SEARCH = (
|
||||||
os.environ.get("USER_PERMISSIONS_FEATURES_WEB_SEARCH", "True").lower() == "true"
|
os.environ.get("USER_PERMISSIONS_FEATURES_WEB_SEARCH", "True").lower() == "true"
|
||||||
)
|
)
|
||||||
@ -1071,6 +1076,7 @@ DEFAULT_USER_PERMISSIONS = {
|
|||||||
"temporary_enforced": USER_PERMISSIONS_CHAT_TEMPORARY_ENFORCED,
|
"temporary_enforced": USER_PERMISSIONS_CHAT_TEMPORARY_ENFORCED,
|
||||||
},
|
},
|
||||||
"features": {
|
"features": {
|
||||||
|
"direct_tool_servers": USER_PERMISSIONS_FEATURES_DIRECT_TOOL_SERVERS,
|
||||||
"web_search": USER_PERMISSIONS_FEATURES_WEB_SEARCH,
|
"web_search": USER_PERMISSIONS_FEATURES_WEB_SEARCH,
|
||||||
"image_generation": USER_PERMISSIONS_FEATURES_IMAGE_GENERATION,
|
"image_generation": USER_PERMISSIONS_FEATURES_IMAGE_GENERATION,
|
||||||
"code_interpreter": USER_PERMISSIONS_FEATURES_CODE_INTERPRETER,
|
"code_interpreter": USER_PERMISSIONS_FEATURES_CODE_INTERPRETER,
|
||||||
|
@ -93,6 +93,7 @@ class ChatPermissions(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class FeaturesPermissions(BaseModel):
|
class FeaturesPermissions(BaseModel):
|
||||||
|
direct_tool_servers: bool = False
|
||||||
web_search: bool = True
|
web_search: bool = True
|
||||||
image_generation: bool = True
|
image_generation: bool = True
|
||||||
code_interpreter: bool = True
|
code_interpreter: bool = True
|
||||||
|
@ -67,6 +67,7 @@
|
|||||||
temporary_enforced: false
|
temporary_enforced: false
|
||||||
},
|
},
|
||||||
features: {
|
features: {
|
||||||
|
direct_tool_servers: false,
|
||||||
web_search: true,
|
web_search: true,
|
||||||
image_generation: true,
|
image_generation: true,
|
||||||
code_interpreter: true
|
code_interpreter: true
|
||||||
|
@ -38,6 +38,12 @@
|
|||||||
prompts: false,
|
prompts: false,
|
||||||
tools: false
|
tools: false
|
||||||
},
|
},
|
||||||
|
sharing: {
|
||||||
|
public_models: false,
|
||||||
|
public_knowledge: false,
|
||||||
|
public_prompts: false,
|
||||||
|
public_tools: false
|
||||||
|
},
|
||||||
chat: {
|
chat: {
|
||||||
controls: true,
|
controls: true,
|
||||||
file_upload: true,
|
file_upload: true,
|
||||||
@ -46,6 +52,7 @@
|
|||||||
temporary: true
|
temporary: true
|
||||||
},
|
},
|
||||||
features: {
|
features: {
|
||||||
|
direct_tool_servers: false,
|
||||||
web_search: true,
|
web_search: true,
|
||||||
image_generation: true,
|
image_generation: true,
|
||||||
code_interpreter: true
|
code_interpreter: true
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
temporary_enforced: false
|
temporary_enforced: false
|
||||||
},
|
},
|
||||||
features: {
|
features: {
|
||||||
|
direct_tool_servers: false,
|
||||||
web_search: true,
|
web_search: true,
|
||||||
image_generation: true,
|
image_generation: true,
|
||||||
code_interpreter: true
|
code_interpreter: true
|
||||||
@ -295,6 +296,14 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class=" mb-2 text-sm font-medium">{$i18n.t('Features Permissions')}</div>
|
<div class=" mb-2 text-sm font-medium">{$i18n.t('Features Permissions')}</div>
|
||||||
|
|
||||||
|
<div class=" flex w-full justify-between my-2 pr-2">
|
||||||
|
<div class=" self-center text-xs font-medium">
|
||||||
|
{$i18n.t('Direct Tool Servers')}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Switch bind:state={permissions.features.direct_tool_servers} />
|
||||||
|
</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('Web Search')}
|
{$i18n.t('Web Search')}
|
||||||
|
@ -488,7 +488,7 @@
|
|||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
{:else if tabId === 'tools'}
|
{:else if tabId === 'tools'}
|
||||||
{#if $user?.role === 'admin' || ($user?.role === 'user' && $config?.features?.enable_direct_tools)}
|
{#if $user?.role === 'admin' || ($user?.role === 'user' && $user?.permissions?.features?.direct_tool_servers)}
|
||||||
<button
|
<button
|
||||||
class="px-0.5 py-1 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition {selectedTab ===
|
class="px-0.5 py-1 min-w-fit rounded-lg flex-1 md:flex-none flex text-left transition {selectedTab ===
|
||||||
'tools'
|
'tools'
|
||||||
|
Loading…
Reference in New Issue
Block a user