mirror of
https://github.com/open-webui/open-webui
synced 2025-02-26 07:09:07 +00:00
enh: channels enable/disable option
This commit is contained in:
parent
0d29f31846
commit
cb3e01de8a
@ -847,6 +847,12 @@ USER_PERMISSIONS = PersistentConfig(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ENABLE_CHANNELS = PersistentConfig(
|
||||||
|
"ENABLE_CHANNELS",
|
||||||
|
"channels.enable",
|
||||||
|
os.environ.get("ENABLE_CHANNELS", "False").lower() == "true",
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
ENABLE_EVALUATION_ARENA_MODELS = PersistentConfig(
|
ENABLE_EVALUATION_ARENA_MODELS = PersistentConfig(
|
||||||
"ENABLE_EVALUATION_ARENA_MODELS",
|
"ENABLE_EVALUATION_ARENA_MODELS",
|
||||||
|
@ -199,6 +199,7 @@ from open_webui.config import (
|
|||||||
ENABLE_SIGNUP,
|
ENABLE_SIGNUP,
|
||||||
ENABLE_LOGIN_FORM,
|
ENABLE_LOGIN_FORM,
|
||||||
ENABLE_API_KEY,
|
ENABLE_API_KEY,
|
||||||
|
ENABLE_CHANNELS,
|
||||||
ENABLE_COMMUNITY_SHARING,
|
ENABLE_COMMUNITY_SHARING,
|
||||||
ENABLE_MESSAGE_RATING,
|
ENABLE_MESSAGE_RATING,
|
||||||
ENABLE_EVALUATION_ARENA_MODELS,
|
ENABLE_EVALUATION_ARENA_MODELS,
|
||||||
@ -407,6 +408,8 @@ app.state.config.WEBHOOK_URL = WEBHOOK_URL
|
|||||||
app.state.config.BANNERS = WEBUI_BANNERS
|
app.state.config.BANNERS = WEBUI_BANNERS
|
||||||
app.state.config.MODEL_ORDER_LIST = MODEL_ORDER_LIST
|
app.state.config.MODEL_ORDER_LIST = MODEL_ORDER_LIST
|
||||||
|
|
||||||
|
|
||||||
|
app.state.config.ENABLE_CHANNELS = ENABLE_CHANNELS
|
||||||
app.state.config.ENABLE_COMMUNITY_SHARING = ENABLE_COMMUNITY_SHARING
|
app.state.config.ENABLE_COMMUNITY_SHARING = ENABLE_COMMUNITY_SHARING
|
||||||
app.state.config.ENABLE_MESSAGE_RATING = ENABLE_MESSAGE_RATING
|
app.state.config.ENABLE_MESSAGE_RATING = ENABLE_MESSAGE_RATING
|
||||||
|
|
||||||
@ -972,6 +975,7 @@ async def get_app_config(request: Request):
|
|||||||
"enable_websocket": ENABLE_WEBSOCKET_SUPPORT,
|
"enable_websocket": ENABLE_WEBSOCKET_SUPPORT,
|
||||||
**(
|
**(
|
||||||
{
|
{
|
||||||
|
"enable_channels": app.state.config.ENABLE_CHANNELS,
|
||||||
"enable_web_search": app.state.config.ENABLE_RAG_WEB_SEARCH,
|
"enable_web_search": app.state.config.ENABLE_RAG_WEB_SEARCH,
|
||||||
"enable_google_drive_integration": app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION,
|
"enable_google_drive_integration": app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION,
|
||||||
"enable_image_generation": app.state.config.ENABLE_IMAGE_GENERATION,
|
"enable_image_generation": app.state.config.ENABLE_IMAGE_GENERATION,
|
||||||
|
@ -616,6 +616,7 @@ async def get_admin_config(request: Request, user=Depends(get_admin_user)):
|
|||||||
"SHOW_ADMIN_DETAILS": request.app.state.config.SHOW_ADMIN_DETAILS,
|
"SHOW_ADMIN_DETAILS": request.app.state.config.SHOW_ADMIN_DETAILS,
|
||||||
"ENABLE_SIGNUP": request.app.state.config.ENABLE_SIGNUP,
|
"ENABLE_SIGNUP": request.app.state.config.ENABLE_SIGNUP,
|
||||||
"ENABLE_API_KEY": request.app.state.config.ENABLE_API_KEY,
|
"ENABLE_API_KEY": request.app.state.config.ENABLE_API_KEY,
|
||||||
|
"ENABLE_CHANNELS": request.app.state.config.ENABLE_CHANNELS,
|
||||||
"DEFAULT_USER_ROLE": request.app.state.config.DEFAULT_USER_ROLE,
|
"DEFAULT_USER_ROLE": request.app.state.config.DEFAULT_USER_ROLE,
|
||||||
"JWT_EXPIRES_IN": request.app.state.config.JWT_EXPIRES_IN,
|
"JWT_EXPIRES_IN": request.app.state.config.JWT_EXPIRES_IN,
|
||||||
"ENABLE_COMMUNITY_SHARING": request.app.state.config.ENABLE_COMMUNITY_SHARING,
|
"ENABLE_COMMUNITY_SHARING": request.app.state.config.ENABLE_COMMUNITY_SHARING,
|
||||||
@ -627,6 +628,7 @@ class AdminConfig(BaseModel):
|
|||||||
SHOW_ADMIN_DETAILS: bool
|
SHOW_ADMIN_DETAILS: bool
|
||||||
ENABLE_SIGNUP: bool
|
ENABLE_SIGNUP: bool
|
||||||
ENABLE_API_KEY: bool
|
ENABLE_API_KEY: bool
|
||||||
|
ENABLE_CHANNELS: bool
|
||||||
DEFAULT_USER_ROLE: str
|
DEFAULT_USER_ROLE: str
|
||||||
JWT_EXPIRES_IN: str
|
JWT_EXPIRES_IN: str
|
||||||
ENABLE_COMMUNITY_SHARING: bool
|
ENABLE_COMMUNITY_SHARING: bool
|
||||||
@ -640,6 +642,7 @@ async def update_admin_config(
|
|||||||
request.app.state.config.SHOW_ADMIN_DETAILS = form_data.SHOW_ADMIN_DETAILS
|
request.app.state.config.SHOW_ADMIN_DETAILS = form_data.SHOW_ADMIN_DETAILS
|
||||||
request.app.state.config.ENABLE_SIGNUP = form_data.ENABLE_SIGNUP
|
request.app.state.config.ENABLE_SIGNUP = form_data.ENABLE_SIGNUP
|
||||||
request.app.state.config.ENABLE_API_KEY = form_data.ENABLE_API_KEY
|
request.app.state.config.ENABLE_API_KEY = form_data.ENABLE_API_KEY
|
||||||
|
request.app.state.config.ENABLE_CHANNELS = form_data.ENABLE_CHANNELS
|
||||||
|
|
||||||
if form_data.DEFAULT_USER_ROLE in ["pending", "user", "admin"]:
|
if form_data.DEFAULT_USER_ROLE in ["pending", "user", "admin"]:
|
||||||
request.app.state.config.DEFAULT_USER_ROLE = form_data.DEFAULT_USER_ROLE
|
request.app.state.config.DEFAULT_USER_ROLE = form_data.DEFAULT_USER_ROLE
|
||||||
|
@ -112,7 +112,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class=" flex w-full justify-between pr-2">
|
<div class=" flex w-full justify-between pr-2">
|
||||||
<div class=" self-center text-xs font-medium">{$i18n.t('Enable API Key Auth')}</div>
|
<div class=" self-center text-xs font-medium">{$i18n.t('Enable API Key Auth')}</div>
|
||||||
|
|
||||||
<Switch bind:state={adminConfig.ENABLE_API_KEY} />
|
<Switch bind:state={adminConfig.ENABLE_API_KEY} />
|
||||||
@ -180,6 +180,16 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<hr class=" border-gray-50 dark:border-gray-850 my-2" />
|
||||||
|
|
||||||
|
<div class="pt-1 flex w-full justify-between pr-2">
|
||||||
|
<div class=" self-center text-sm font-medium">
|
||||||
|
{$i18n.t('Channels')} ({$i18n.t('Beta')})
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<Switch bind:state={adminConfig.ENABLE_CHANNELS} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
currentChatPage,
|
currentChatPage,
|
||||||
temporaryChatEnabled,
|
temporaryChatEnabled,
|
||||||
channels,
|
channels,
|
||||||
socket
|
socket,
|
||||||
|
config
|
||||||
} from '$lib/stores';
|
} from '$lib/stores';
|
||||||
import { onMount, getContext, tick, onDestroy } from 'svelte';
|
import { onMount, getContext, tick, onDestroy } from 'svelte';
|
||||||
|
|
||||||
@ -628,7 +629,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if ($user.role === 'admin' || $channels.length > 0) && !search}
|
{#if $config?.features?.enable_channels && ($user.role === 'admin' || $channels.length > 0) && !search}
|
||||||
<Folder
|
<Folder
|
||||||
className="px-2 mt-0.5"
|
className="px-2 mt-0.5"
|
||||||
name={$i18n.t('Channels')}
|
name={$i18n.t('Channels')}
|
||||||
|
Loading…
Reference in New Issue
Block a user