From 5d5e351937d796b6af6e4434b809aec2535969b1 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 1 May 2025 16:39:36 +0400 Subject: [PATCH] feat: notes scaffolding --- backend/open_webui/config.py | 5 ++ backend/open_webui/main.py | 5 +- backend/open_webui/routers/auths.py | 6 ++- .../components/admin/Settings/General.svelte | 8 +++ src/lib/components/layout/Sidebar.svelte | 42 ++++++++++++++++ src/routes/(app)/admin/+layout.svelte | 2 +- src/routes/(app)/home/+layout.svelte | 2 +- src/routes/(app)/notes/+layout.svelte | 50 +++++++++++++++++++ src/routes/(app)/notes/+page.svelte | 0 src/routes/(app)/playground/+layout.svelte | 2 +- src/routes/(app)/workspace/+layout.svelte | 2 +- src/routes/+layout.svelte | 4 +- src/routes/s/[id]/+page.svelte | 2 +- 13 files changed, 121 insertions(+), 9 deletions(-) create mode 100644 src/routes/(app)/notes/+layout.svelte create mode 100644 src/routes/(app)/notes/+page.svelte diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index 7dc4be9f0..6b1f27d46 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -1178,6 +1178,11 @@ ENABLE_CHANNELS = PersistentConfig( os.environ.get("ENABLE_CHANNELS", "False").lower() == "true", ) +ENABLE_NOTES = PersistentConfig( + "ENABLE_NOTES", + "notes.enable", + os.environ.get("ENABLE_NOTES", "True").lower() == "true", +) ENABLE_EVALUATION_ARENA_MODELS = PersistentConfig( "ENABLE_EVALUATION_ARENA_MODELS", diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index 862f554f4..2ffdd01d3 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -156,7 +156,7 @@ from open_webui.config import ( AUDIO_STT_AZURE_REGION, AUDIO_STT_AZURE_LOCALES, AUDIO_STT_AZURE_BASE_URL, - AUDIO_STT_AZURE_MAX_SPEAKERS, + AUDIO_STT_AZURE_MAX_SPEAKERS, AUDIO_TTS_API_KEY, AUDIO_TTS_ENGINE, AUDIO_TTS_MODEL, @@ -274,6 +274,7 @@ from open_webui.config import ( ENABLE_API_KEY_ENDPOINT_RESTRICTIONS, API_KEY_ALLOWED_ENDPOINTS, ENABLE_CHANNELS, + ENABLE_NOTES, ENABLE_COMMUNITY_SHARING, ENABLE_MESSAGE_RATING, ENABLE_USER_WEBHOOKS, @@ -570,6 +571,7 @@ app.state.config.MODEL_ORDER_LIST = MODEL_ORDER_LIST app.state.config.ENABLE_CHANNELS = ENABLE_CHANNELS +app.state.config.ENABLE_NOTES = ENABLE_NOTES app.state.config.ENABLE_COMMUNITY_SHARING = ENABLE_COMMUNITY_SHARING app.state.config.ENABLE_MESSAGE_RATING = ENABLE_MESSAGE_RATING app.state.config.ENABLE_USER_WEBHOOKS = ENABLE_USER_WEBHOOKS @@ -1321,6 +1323,7 @@ async def get_app_config(request: Request): { "enable_direct_connections": app.state.config.ENABLE_DIRECT_CONNECTIONS, "enable_channels": app.state.config.ENABLE_CHANNELS, + "enable_notes": app.state.config.ENABLE_NOTES, "enable_web_search": app.state.config.ENABLE_WEB_SEARCH, "enable_code_execution": app.state.config.ENABLE_CODE_EXECUTION, "enable_code_interpreter": app.state.config.ENABLE_CODE_INTERPRETER, diff --git a/backend/open_webui/routers/auths.py b/backend/open_webui/routers/auths.py index a820527dd..91057b90d 100644 --- a/backend/open_webui/routers/auths.py +++ b/backend/open_webui/routers/auths.py @@ -689,6 +689,7 @@ async def get_admin_config(request: Request, user=Depends(get_admin_user)): "ENABLE_COMMUNITY_SHARING": request.app.state.config.ENABLE_COMMUNITY_SHARING, "ENABLE_MESSAGE_RATING": request.app.state.config.ENABLE_MESSAGE_RATING, "ENABLE_CHANNELS": request.app.state.config.ENABLE_CHANNELS, + "ENABLE_NOTES": request.app.state.config.ENABLE_NOTES, "ENABLE_USER_WEBHOOKS": request.app.state.config.ENABLE_USER_WEBHOOKS, } @@ -705,6 +706,7 @@ class AdminConfig(BaseModel): ENABLE_COMMUNITY_SHARING: bool ENABLE_MESSAGE_RATING: bool ENABLE_CHANNELS: bool + ENABLE_NOTES: bool ENABLE_USER_WEBHOOKS: bool @@ -725,6 +727,7 @@ async def update_admin_config( ) request.app.state.config.ENABLE_CHANNELS = form_data.ENABLE_CHANNELS + request.app.state.config.ENABLE_NOTES = form_data.ENABLE_NOTES if form_data.DEFAULT_USER_ROLE in ["pending", "user", "admin"]: request.app.state.config.DEFAULT_USER_ROLE = form_data.DEFAULT_USER_ROLE @@ -749,11 +752,12 @@ async def update_admin_config( "ENABLE_API_KEY": request.app.state.config.ENABLE_API_KEY, "ENABLE_API_KEY_ENDPOINT_RESTRICTIONS": request.app.state.config.ENABLE_API_KEY_ENDPOINT_RESTRICTIONS, "API_KEY_ALLOWED_ENDPOINTS": request.app.state.config.API_KEY_ALLOWED_ENDPOINTS, - "ENABLE_CHANNELS": request.app.state.config.ENABLE_CHANNELS, "DEFAULT_USER_ROLE": request.app.state.config.DEFAULT_USER_ROLE, "JWT_EXPIRES_IN": request.app.state.config.JWT_EXPIRES_IN, "ENABLE_COMMUNITY_SHARING": request.app.state.config.ENABLE_COMMUNITY_SHARING, "ENABLE_MESSAGE_RATING": request.app.state.config.ENABLE_MESSAGE_RATING, + "ENABLE_CHANNELS": request.app.state.config.ENABLE_CHANNELS, + "ENABLE_NOTES": request.app.state.config.ENABLE_NOTES, "ENABLE_USER_WEBHOOKS": request.app.state.config.ENABLE_USER_WEBHOOKS, } diff --git a/src/lib/components/admin/Settings/General.svelte b/src/lib/components/admin/Settings/General.svelte index c44f9caa2..3741168f8 100644 --- a/src/lib/components/admin/Settings/General.svelte +++ b/src/lib/components/admin/Settings/General.svelte @@ -601,6 +601,14 @@ +
+
+ {$i18n.t('Notes')} ({$i18n.t('Beta')}) +
+ + +
+
{$i18n.t('Channels')} ({$i18n.t('Beta')}) diff --git a/src/lib/components/layout/Sidebar.svelte b/src/lib/components/layout/Sidebar.svelte index 2de4c8e85..d8c018b42 100644 --- a/src/lib/components/layout/Sidebar.svelte +++ b/src/lib/components/layout/Sidebar.svelte @@ -609,6 +609,48 @@
{/if} + {#if $config?.features?.enable_notes ?? false} + + {/if} +
{#if $temporaryChatEnabled}
diff --git a/src/routes/(app)/admin/+layout.svelte b/src/routes/(app)/admin/+layout.svelte index bc3caa338..6f0462f76 100644 --- a/src/routes/(app)/admin/+layout.svelte +++ b/src/routes/(app)/admin/+layout.svelte @@ -20,7 +20,7 @@ - {$i18n.t('Admin Panel')} | {$WEBUI_NAME} + {$i18n.t('Admin Panel')} • {$WEBUI_NAME} diff --git a/src/routes/(app)/home/+layout.svelte b/src/routes/(app)/home/+layout.svelte index 63abe4169..c41e70c53 100644 --- a/src/routes/(app)/home/+layout.svelte +++ b/src/routes/(app)/home/+layout.svelte @@ -11,7 +11,7 @@ - {$i18n.t('Home')} | {$WEBUI_NAME} + {$i18n.t('Home')} • {$WEBUI_NAME} diff --git a/src/routes/(app)/notes/+layout.svelte b/src/routes/(app)/notes/+layout.svelte new file mode 100644 index 000000000..3f6830240 --- /dev/null +++ b/src/routes/(app)/notes/+layout.svelte @@ -0,0 +1,50 @@ + + + + + {$i18n.t('Notes')} • {$WEBUI_NAME} + + + +
+ + +
+ +
+
diff --git a/src/routes/(app)/notes/+page.svelte b/src/routes/(app)/notes/+page.svelte new file mode 100644 index 000000000..e69de29bb diff --git a/src/routes/(app)/playground/+layout.svelte b/src/routes/(app)/playground/+layout.svelte index 8da329b2f..4a2ebb3aa 100644 --- a/src/routes/(app)/playground/+layout.svelte +++ b/src/routes/(app)/playground/+layout.svelte @@ -11,7 +11,7 @@ - {$i18n.t('Playground')} | {$WEBUI_NAME} + {$i18n.t('Playground')} • {$WEBUI_NAME} diff --git a/src/routes/(app)/workspace/+layout.svelte b/src/routes/(app)/workspace/+layout.svelte index 0240e693c..fc7d434fd 100644 --- a/src/routes/(app)/workspace/+layout.svelte +++ b/src/routes/(app)/workspace/+layout.svelte @@ -45,7 +45,7 @@ - {$i18n.t('Workspace')} | {$WEBUI_NAME} + {$i18n.t('Workspace')} • {$WEBUI_NAME} diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 218e92e43..04debfac5 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -227,7 +227,7 @@ if ($isLastActiveTab) { if ($settings?.notificationEnabled ?? false) { - new Notification(`${title} | Open WebUI`, { + new Notification(`${title} • Open WebUI`, { body: content, icon: `${WEBUI_BASE_URL}/static/favicon.png` }); @@ -376,7 +376,7 @@ if (type === 'message') { if ($isLastActiveTab) { if ($settings?.notificationEnabled ?? false) { - new Notification(`${data?.user?.name} (#${event?.channel?.name}) | Open WebUI`, { + new Notification(`${data?.user?.name} (#${event?.channel?.name}) • Open WebUI`, { body: data?.content, icon: data?.user?.profile_image_url ?? `${WEBUI_BASE_URL}/static/favicon.png` }); diff --git a/src/routes/s/[id]/+page.svelte b/src/routes/s/[id]/+page.svelte index d8f3f42ea..c5849178a 100644 --- a/src/routes/s/[id]/+page.svelte +++ b/src/routes/s/[id]/+page.svelte @@ -145,7 +145,7 @@ {title - ? `${title.length > 30 ? `${title.slice(0, 30)}...` : title} | ${$WEBUI_NAME}` + ? `${title.length > 30 ? `${title.slice(0, 30)}...` : title} • ${$WEBUI_NAME}` : `${$WEBUI_NAME}`}