enh: ENABLE_ADMIN_ANALYTICS
This commit is contained in:
@@ -1678,6 +1678,10 @@ ENABLE_ADMIN_CHAT_ACCESS = (
|
|||||||
os.environ.get("ENABLE_ADMIN_CHAT_ACCESS", "True").lower() == "true"
|
os.environ.get("ENABLE_ADMIN_CHAT_ACCESS", "True").lower() == "true"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ENABLE_ADMIN_ANALYTICS = (
|
||||||
|
os.environ.get("ENABLE_ADMIN_ANALYTICS", "True").lower() == "true"
|
||||||
|
)
|
||||||
|
|
||||||
ENABLE_COMMUNITY_SHARING = PersistentConfig(
|
ENABLE_COMMUNITY_SHARING = PersistentConfig(
|
||||||
"ENABLE_COMMUNITY_SHARING",
|
"ENABLE_COMMUNITY_SHARING",
|
||||||
"ui.enable_community_sharing",
|
"ui.enable_community_sharing",
|
||||||
|
|||||||
@@ -434,6 +434,7 @@ from open_webui.config import (
|
|||||||
RESPONSE_WATERMARK,
|
RESPONSE_WATERMARK,
|
||||||
# Admin
|
# Admin
|
||||||
ENABLE_ADMIN_CHAT_ACCESS,
|
ENABLE_ADMIN_CHAT_ACCESS,
|
||||||
|
ENABLE_ADMIN_ANALYTICS,
|
||||||
BYPASS_ADMIN_ACCESS_CONTROL,
|
BYPASS_ADMIN_ACCESS_CONTROL,
|
||||||
ENABLE_ADMIN_EXPORT,
|
ENABLE_ADMIN_EXPORT,
|
||||||
# Tasks
|
# Tasks
|
||||||
@@ -1530,7 +1531,8 @@ app.include_router(functions.router, prefix="/api/v1/functions", tags=["function
|
|||||||
app.include_router(
|
app.include_router(
|
||||||
evaluations.router, prefix="/api/v1/evaluations", tags=["evaluations"]
|
evaluations.router, prefix="/api/v1/evaluations", tags=["evaluations"]
|
||||||
)
|
)
|
||||||
app.include_router(analytics.router, prefix="/api/v1/analytics", tags=["analytics"])
|
if ENABLE_ADMIN_ANALYTICS:
|
||||||
|
app.include_router(analytics.router, prefix="/api/v1/analytics", tags=["analytics"])
|
||||||
app.include_router(utils.router, prefix="/api/v1/utils", tags=["utils"])
|
app.include_router(utils.router, prefix="/api/v1/utils", tags=["utils"])
|
||||||
|
|
||||||
# SCIM 2.0 API for identity management
|
# SCIM 2.0 API for identity management
|
||||||
@@ -2120,6 +2122,7 @@ async def get_app_config(request: Request):
|
|||||||
"enable_user_status": app.state.config.ENABLE_USER_STATUS,
|
"enable_user_status": app.state.config.ENABLE_USER_STATUS,
|
||||||
"enable_admin_export": ENABLE_ADMIN_EXPORT,
|
"enable_admin_export": ENABLE_ADMIN_EXPORT,
|
||||||
"enable_admin_chat_access": ENABLE_ADMIN_CHAT_ACCESS,
|
"enable_admin_chat_access": ENABLE_ADMIN_CHAT_ACCESS,
|
||||||
|
"enable_admin_analytics": ENABLE_ADMIN_ANALYTICS,
|
||||||
"enable_google_drive_integration": app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION,
|
"enable_google_drive_integration": app.state.config.ENABLE_GOOGLE_DRIVE_INTEGRATION,
|
||||||
"enable_onedrive_integration": app.state.config.ENABLE_ONEDRIVE_INTEGRATION,
|
"enable_onedrive_integration": app.state.config.ENABLE_ONEDRIVE_INTEGRATION,
|
||||||
"enable_memories": app.state.config.ENABLE_MEMORIES,
|
"enable_memories": app.state.config.ENABLE_MEMORIES,
|
||||||
|
|||||||
@@ -275,6 +275,7 @@ type Config = {
|
|||||||
enable_image_generation: boolean;
|
enable_image_generation: boolean;
|
||||||
enable_admin_export: boolean;
|
enable_admin_export: boolean;
|
||||||
enable_admin_chat_access: boolean;
|
enable_admin_chat_access: boolean;
|
||||||
|
enable_admin_analytics: boolean;
|
||||||
enable_community_sharing: boolean;
|
enable_community_sharing: boolean;
|
||||||
enable_memories: boolean;
|
enable_memories: boolean;
|
||||||
enable_autocomplete_generation: boolean;
|
enable_autocomplete_generation: boolean;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import { onMount, getContext } from 'svelte';
|
import { onMount, getContext } from 'svelte';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
|
||||||
import { WEBUI_NAME, mobile, showSidebar, user } from '$lib/stores';
|
import { WEBUI_NAME, config, mobile, showSidebar, user } from '$lib/stores';
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||||
|
|
||||||
@@ -66,12 +66,14 @@
|
|||||||
href="/admin">{$i18n.t('Users')}</a
|
href="/admin">{$i18n.t('Users')}</a
|
||||||
>
|
>
|
||||||
|
|
||||||
|
{#if $config?.features.enable_admin_analytics ?? true}
|
||||||
<a
|
<a
|
||||||
class="min-w-fit p-1.5 {$page.url.pathname.includes('/admin/analytics')
|
class="min-w-fit p-1.5 {$page.url.pathname.includes('/admin/analytics')
|
||||||
? ''
|
? ''
|
||||||
: 'text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white'} transition"
|
: 'text-gray-300 dark:text-gray-600 hover:text-gray-700 dark:hover:text-white'} transition"
|
||||||
href="/admin/analytics">{$i18n.t('Analytics')}</a
|
href="/admin/analytics">{$i18n.t('Analytics')}</a
|
||||||
>
|
>
|
||||||
|
{/if}
|
||||||
|
|
||||||
<a
|
<a
|
||||||
class="min-w-fit p-1.5 {$page.url.pathname.includes('/admin/evaluations')
|
class="min-w-fit p-1.5 {$page.url.pathname.includes('/admin/evaluations')
|
||||||
|
|||||||
@@ -1,5 +1,16 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
import { config } from '$lib/stores';
|
||||||
import Analytics from '$lib/components/admin/Analytics.svelte';
|
import Analytics from '$lib/components/admin/Analytics.svelte';
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
if (!($config?.features.enable_admin_analytics ?? true)) {
|
||||||
|
goto('/admin');
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Analytics />
|
{#if $config?.features.enable_admin_analytics ?? true}
|
||||||
|
<Analytics />
|
||||||
|
{/if}
|
||||||
|
|||||||
@@ -1,5 +1,16 @@
|
|||||||
<script>
|
<script>
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import { goto } from '$app/navigation';
|
||||||
|
import { config } from '$lib/stores';
|
||||||
import Analytics from '$lib/components/admin/Analytics.svelte';
|
import Analytics from '$lib/components/admin/Analytics.svelte';
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
if (!($config?.features.enable_admin_analytics ?? true)) {
|
||||||
|
goto('/admin');
|
||||||
|
}
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Analytics />
|
{#if $config?.features.enable_admin_analytics ?? true}
|
||||||
|
<Analytics />
|
||||||
|
{/if}
|
||||||
|
|||||||
Reference in New Issue
Block a user