mirror of
https://github.com/open-webui/open-webui
synced 2025-04-02 12:09:06 +00:00
feat: enforced temporary chat
This commit is contained in:
parent
580965df17
commit
5f792d2771
@ -1029,6 +1029,10 @@ USER_PERMISSIONS_CHAT_TEMPORARY = (
|
||||
os.environ.get("USER_PERMISSIONS_CHAT_TEMPORARY", "True").lower() == "true"
|
||||
)
|
||||
|
||||
USER_PERMISSIONS_CHAT_TEMPORARY_ENFORCED = (
|
||||
os.environ.get("USER_PERMISSIONS_CHAT_TEMPORARY_ENFORCED", "False").lower()
|
||||
== "true"
|
||||
)
|
||||
|
||||
USER_PERMISSIONS_FEATURES_WEB_SEARCH = (
|
||||
os.environ.get("USER_PERMISSIONS_FEATURES_WEB_SEARCH", "True").lower() == "true"
|
||||
@ -1064,6 +1068,7 @@ DEFAULT_USER_PERMISSIONS = {
|
||||
"delete": USER_PERMISSIONS_CHAT_DELETE,
|
||||
"edit": USER_PERMISSIONS_CHAT_EDIT,
|
||||
"temporary": USER_PERMISSIONS_CHAT_TEMPORARY,
|
||||
"temporary_enforced": USER_PERMISSIONS_CHAT_TEMPORARY_ENFORCED,
|
||||
},
|
||||
"features": {
|
||||
"web_search": USER_PERMISSIONS_FEATURES_WEB_SEARCH,
|
||||
|
@ -89,6 +89,7 @@ class ChatPermissions(BaseModel):
|
||||
delete: bool = True
|
||||
edit: bool = True
|
||||
temporary: bool = True
|
||||
temporary_enforced: bool = False
|
||||
|
||||
|
||||
class FeaturesPermissions(BaseModel):
|
||||
|
@ -52,12 +52,19 @@
|
||||
prompts: false,
|
||||
tools: false
|
||||
},
|
||||
sharing: {
|
||||
public_models: false,
|
||||
public_knowledge: false,
|
||||
public_prompts: false,
|
||||
public_tools: false
|
||||
},
|
||||
chat: {
|
||||
controls: true,
|
||||
file_upload: true,
|
||||
delete: true,
|
||||
edit: true,
|
||||
temporary: true
|
||||
temporary: true,
|
||||
temporary_enforced: true
|
||||
},
|
||||
features: {
|
||||
web_search: true,
|
||||
|
@ -23,8 +23,9 @@
|
||||
controls: true,
|
||||
delete: true,
|
||||
edit: true,
|
||||
file_upload: true,
|
||||
temporary: true,
|
||||
file_upload: true
|
||||
temporary_enforced: true
|
||||
},
|
||||
features: {
|
||||
web_search: true,
|
||||
@ -277,6 +278,16 @@
|
||||
|
||||
<Switch bind:state={permissions.chat.temporary} />
|
||||
</div>
|
||||
|
||||
{#if permissions.chat.temporary}
|
||||
<div class=" flex w-full justify-between my-2 pr-2">
|
||||
<div class=" self-center text-xs font-medium">
|
||||
{$i18n.t('Enforce Temporary Chat')}
|
||||
</div>
|
||||
|
||||
<Switch bind:state={permissions.chat.temporary_enforced} />
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<hr class=" border-gray-100 dark:border-gray-850 my-2" />
|
||||
|
@ -46,7 +46,8 @@
|
||||
model: model
|
||||
}))}
|
||||
showTemporaryChatControl={$user.role === 'user'
|
||||
? ($user?.permissions?.chat?.temporary ?? true)
|
||||
? ($user?.permissions?.chat?.temporary ?? true) &&
|
||||
!($user?.permissions?.chat?.temporary_enforced ?? false)
|
||||
: true}
|
||||
bind:value={selectedModel}
|
||||
/>
|
||||
|
@ -199,6 +199,12 @@
|
||||
temporaryChatEnabled.set(true);
|
||||
}
|
||||
|
||||
console.log($user.permissions);
|
||||
|
||||
if ($user?.permissions?.chat?.temporary_enforced) {
|
||||
temporaryChatEnabled.set(true);
|
||||
}
|
||||
|
||||
// Check for version updates
|
||||
if ($user.role === 'admin') {
|
||||
// Check if the user has dismissed the update toast in the last 24 hours
|
||||
|
Loading…
Reference in New Issue
Block a user