Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
12357149
"...git@developer.sourcefind.cn:chenpangpang/open-webui.git" did not exist on "437d7ff6f5df4b42ee25dd7136bea4da91739615"
Commit
12357149
authored
May 26, 2024
by
Jun Siang Cheah
Browse files
feat: add ENABLE_COMMUNITY_SHARING
parent
6c5f5fe3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
28 additions
and
16 deletions
+28
-16
backend/apps/webui/main.py
backend/apps/webui/main.py
+2
-0
backend/config.py
backend/config.py
+6
-0
backend/main.py
backend/main.py
+1
-0
src/lib/components/chat/ShareChatModal.svelte
src/lib/components/chat/ShareChatModal.svelte
+13
-11
src/lib/stores/index.ts
src/lib/stores/index.ts
+6
-5
No files found.
backend/apps/webui/main.py
View file @
12357149
...
@@ -24,6 +24,7 @@ from config import (
...
@@ -24,6 +24,7 @@ from config import (
WEBUI_AUTH_TRUSTED_EMAIL_HEADER
,
WEBUI_AUTH_TRUSTED_EMAIL_HEADER
,
JWT_EXPIRES_IN
,
JWT_EXPIRES_IN
,
AppConfig
,
AppConfig
,
ENABLE_COMMUNITY_SHARING
,
)
)
app
=
FastAPI
()
app
=
FastAPI
()
...
@@ -41,6 +42,7 @@ app.state.config.DEFAULT_USER_ROLE = DEFAULT_USER_ROLE
...
@@ -41,6 +42,7 @@ app.state.config.DEFAULT_USER_ROLE = DEFAULT_USER_ROLE
app
.
state
.
config
.
USER_PERMISSIONS
=
USER_PERMISSIONS
app
.
state
.
config
.
USER_PERMISSIONS
=
USER_PERMISSIONS
app
.
state
.
config
.
WEBHOOK_URL
=
WEBHOOK_URL
app
.
state
.
config
.
WEBHOOK_URL
=
WEBHOOK_URL
app
.
state
.
config
.
ENABLE_COMMUNITY_SHARING
=
ENABLE_COMMUNITY_SHARING
app
.
state
.
MODELS
=
{}
app
.
state
.
MODELS
=
{}
app
.
state
.
AUTH_TRUSTED_EMAIL_HEADER
=
WEBUI_AUTH_TRUSTED_EMAIL_HEADER
app
.
state
.
AUTH_TRUSTED_EMAIL_HEADER
=
WEBUI_AUTH_TRUSTED_EMAIL_HEADER
...
...
backend/config.py
View file @
12357149
...
@@ -566,6 +566,12 @@ WEBHOOK_URL = PersistentConfig(
...
@@ -566,6 +566,12 @@ WEBHOOK_URL = PersistentConfig(
ENABLE_ADMIN_EXPORT
=
os
.
environ
.
get
(
"ENABLE_ADMIN_EXPORT"
,
"True"
).
lower
()
==
"true"
ENABLE_ADMIN_EXPORT
=
os
.
environ
.
get
(
"ENABLE_ADMIN_EXPORT"
,
"True"
).
lower
()
==
"true"
ENABLE_COMMUNITY_SHARING
=
PersistentConfig
(
"ENABLE_COMMUNITY_SHARING"
,
"ui.enable_community_sharing"
,
os
.
environ
.
get
(
"ENABLE_COMMUNITY_SHARING"
,
"True"
).
lower
()
==
"true"
,
)
####################################
####################################
# WEBUI_SECRET_KEY
# WEBUI_SECRET_KEY
####################################
####################################
...
...
backend/main.py
View file @
12357149
...
@@ -365,6 +365,7 @@ async def get_app_config():
...
@@ -365,6 +365,7 @@ async def get_app_config():
"auth_trusted_header"
:
bool
(
webui_app
.
state
.
AUTH_TRUSTED_EMAIL_HEADER
),
"auth_trusted_header"
:
bool
(
webui_app
.
state
.
AUTH_TRUSTED_EMAIL_HEADER
),
"enable_image_generation"
:
images_app
.
state
.
config
.
ENABLED
,
"enable_image_generation"
:
images_app
.
state
.
config
.
ENABLED
,
"enable_admin_export"
:
ENABLE_ADMIN_EXPORT
,
"enable_admin_export"
:
ENABLE_ADMIN_EXPORT
,
"enable_community_sharing"
:
webui_app
.
state
.
config
.
ENABLE_COMMUNITY_SHARING
,
},
},
}
}
...
...
src/lib/components/chat/ShareChatModal.svelte
View file @
12357149
<script lang="ts">
<script lang="ts">
import { getContext, onMount } from 'svelte';
import { getContext, onMount } from 'svelte';
import { models } from '$lib/stores';
import { models
, config
} from '$lib/stores';
import { toast } from 'svelte-sonner';
import { toast } from 'svelte-sonner';
import { deleteSharedChatById, getChatById, shareChatById } from '$lib/apis/chats';
import { deleteSharedChatById, getChatById, shareChatById } from '$lib/apis/chats';
...
@@ -134,16 +134,18 @@
...
@@ -134,16 +134,18 @@
<div class="flex justify-end">
<div class="flex justify-end">
<div class="flex flex-col items-end space-x-1 mt-1.5">
<div class="flex flex-col items-end space-x-1 mt-1.5">
<div class="flex gap-1">
<div class="flex gap-1">
<button
{#if $config?.feature_flags.enable_community_sharing}
class=" self-center px-3.5 py-2 rounded-xl text-sm font-medium bg-gray-100 hover:bg-gray-200 text-gray-800 dark:bg-gray-850 dark:hover:bg-gray-800 dark:text-white"
<button
type="button"
class=" self-center px-3.5 py-2 rounded-xl text-sm font-medium bg-gray-100 hover:bg-gray-200 text-gray-800 dark:bg-gray-850 dark:hover:bg-gray-800 dark:text-white"
on:click={() => {
type="button"
shareChat();
on:click={() => {
show = false;
shareChat();
}}
show = false;
>
}}
{$i18n.t('Share to OpenWebUI Community')}
>
</button>
{$i18n.t('Share to OpenWebUI Community')}
</button>
{/if}
<button
<button
class=" self-center flex items-center gap-1 px-3.5 py-2 rounded-xl text-sm font-medium bg-emerald-600 hover:bg-emerald-500 text-white"
class=" self-center flex items-center gap-1 px-3.5 py-2 rounded-xl text-sm font-medium bg-emerald-600 hover:bg-emerald-500 text-white"
...
...
src/lib/stores/index.ts
View file @
12357149
...
@@ -133,11 +133,12 @@ type Config = {
...
@@ -133,11 +133,12 @@ type Config = {
default_models
:
string
[];
default_models
:
string
[];
default_prompt_suggestions
:
PromptSuggestion
[];
default_prompt_suggestions
:
PromptSuggestion
[];
feature_flags
:
{
feature_flags
:
{
auth
?:
boolean
;
auth
:
boolean
;
enable_signup
?:
boolean
;
enable_signup
:
boolean
;
auth_trusted_header
?:
boolean
;
auth_trusted_header
:
boolean
;
enable_image_generation
?:
boolean
;
enable_image_generation
:
boolean
;
enable_admin_export
?:
boolean
;
enable_admin_export
:
boolean
;
enable_community_sharing
:
boolean
;
};
};
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment