Skip to content

Commit

Permalink
Merge pull request open-webui#7562 from open-webui/dev
Browse files Browse the repository at this point in the history
0.4.8
  • Loading branch information
tjbck authored Dec 7, 2024
2 parents c4ea313 + 976676a commit 29a2719
Show file tree
Hide file tree
Showing 35 changed files with 590 additions and 494 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.8] - 2024-12-07

### Added

- **🔓 Bypass Model Access Control**: Introduced the 'BYPASS_MODEL_ACCESS_CONTROL' environment variable. Easily bypass model access controls for user roles when access control isn't required, simplifying workflows for trusted environments.
- **📝 Markdown in Banners**: Now supports markdown for banners, enabling richer, more visually engaging announcements.
- **🌐 Internationalization Updates**: Enhanced translations across multiple languages, further improving accessibility and global user experience.
- **🎨 Styling Enhancements**: General UI style refinements for a cleaner and more polished interface.
- **📋 Rich Text Reliability**: Improved the reliability and stability of rich text input across chats for smoother interactions.

### Fixed

- **💡 Tailwind Build Issue**: Resolved a breaking bug caused by Tailwind, ensuring smoother builds and overall system reliability.
- **📚 Knowledge Collection Query Fix**: Addressed API endpoint issues with querying knowledge collections, ensuring accurate and reliable information retrieval.

## [0.4.7] - 2024-12-01

### Added
Expand Down
7 changes: 4 additions & 3 deletions backend/open_webui/apps/ollama/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from open_webui.env import (
AIOHTTP_CLIENT_TIMEOUT,
AIOHTTP_CLIENT_TIMEOUT_OPENAI_MODEL_LIST,
BYPASS_MODEL_ACCESS_CONTROL,
)


Expand Down Expand Up @@ -359,7 +360,7 @@ async def get_ollama_tags(
detail=error_detail,
)

if user.role == "user":
if user.role == "user" and not BYPASS_MODEL_ACCESS_CONTROL:
# Filter models based on user access control
filtered_models = []
for model in models.get("models", []):
Expand Down Expand Up @@ -1067,7 +1068,7 @@ async def generate_openai_chat_completion(
payload = apply_model_system_prompt_to_body(params, payload, user)

# Check if user has access to the model
if user.role == "user":
if user.role == "user" and not BYPASS_MODEL_ACCESS_CONTROL:
if not (
user.id == model_info.user_id
or has_access(
Expand Down Expand Up @@ -1156,7 +1157,7 @@ async def get_openai_models(
detail=error_detail,
)

if user.role == "user":
if user.role == "user" and not BYPASS_MODEL_ACCESS_CONTROL:
# Filter models based on user access control
filtered_models = []
for model in models:
Expand Down
3 changes: 2 additions & 1 deletion backend/open_webui/apps/openai/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
AIOHTTP_CLIENT_TIMEOUT,
AIOHTTP_CLIENT_TIMEOUT_OPENAI_MODEL_LIST,
ENABLE_FORWARD_USER_INFO_HEADERS,
BYPASS_MODEL_ACCESS_CONTROL,
)

from open_webui.constants import ERROR_MESSAGES
Expand Down Expand Up @@ -422,7 +423,7 @@ async def get_models(url_idx: Optional[int] = None, user=Depends(get_verified_us
error_detail = f"Unexpected error: {str(e)}"
raise HTTPException(status_code=500, detail=error_detail)

if user.role == "user":
if user.role == "user" and not BYPASS_MODEL_ACCESS_CONTROL:
# Filter models based on user access control
filtered_models = []
for model in models.get("data", []):
Expand Down
4 changes: 2 additions & 2 deletions backend/open_webui/apps/retrieval/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ def query_collection_handler(
if app.state.config.ENABLE_RAG_HYBRID_SEARCH:
return query_collection_with_hybrid_search(
collection_names=form_data.collection_names,
query=form_data.query,
queries=[form_data.query],
embedding_function=app.state.EMBEDDING_FUNCTION,
k=form_data.k if form_data.k else app.state.config.TOP_K,
reranking_function=app.state.sentence_transformer_rf,
Expand All @@ -1410,7 +1410,7 @@ def query_collection_handler(
else:
return query_collection(
collection_names=form_data.collection_names,
query=form_data.query,
queries=[form_data.query],
embedding_function=app.state.EMBEDDING_FUNCTION,
k=form_data.k if form_data.k else app.state.config.TOP_K,
)
Expand Down
2 changes: 1 addition & 1 deletion backend/open_webui/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ def load_oauth_providers():
os.environ.get("ENABLE_LOGIN_FORM", "True").lower() == "true",
)


DEFAULT_LOCALE = PersistentConfig(
"DEFAULT_LOCALE",
"ui.default_locale",
Expand Down Expand Up @@ -758,7 +759,6 @@ def load_oauth_providers():
os.getenv("DEFAULT_USER_ROLE", "pending"),
)


USER_PERMISSIONS_WORKSPACE_MODELS_ACCESS = (
os.environ.get("USER_PERMISSIONS_WORKSPACE_MODELS_ACCESS", "False").lower()
== "true"
Expand Down
3 changes: 3 additions & 0 deletions backend/open_webui/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ def parse_section(section):
)
WEBUI_AUTH_TRUSTED_NAME_HEADER = os.environ.get("WEBUI_AUTH_TRUSTED_NAME_HEADER", None)

BYPASS_MODEL_ACCESS_CONTROL = (
os.environ.get("BYPASS_MODEL_ACCESS_CONTROL", "False").lower() == "true"
)

####################################
# WEBUI_SECRET_KEY
Expand Down
5 changes: 3 additions & 2 deletions backend/open_webui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
WEBUI_SESSION_COOKIE_SAME_SITE,
WEBUI_SESSION_COOKIE_SECURE,
WEBUI_URL,
BYPASS_MODEL_ACCESS_CONTROL,
RESET_CONFIG_ON_START,
OFFLINE_MODE,
)
Expand Down Expand Up @@ -621,7 +622,7 @@ async def dispatch(self, request: Request, call_next):
)

model_info = Models.get_model_by_id(model["id"])
if user.role == "user":
if user.role == "user" and not BYPASS_MODEL_ACCESS_CONTROL:
if model.get("arena"):
if not has_access(
user.id,
Expand Down Expand Up @@ -1224,7 +1225,7 @@ async def get_models(user=Depends(get_verified_user)):
)

# Filter out models that the user does not have access to
if user.role == "user":
if user.role == "user" and not BYPASS_MODEL_ACCESS_CONTROL:
filtered_models = []
for model in models:
if model.get("arena"):
Expand Down
11 changes: 6 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "open-webui",
"version": "0.4.7",
"version": "0.4.8",
"private": true,
"scripts": {
"dev": "npm run pyodide:fetch && vite dev --host",
Expand Down
9 changes: 5 additions & 4 deletions src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ math {
}

.input-prose {
@apply prose dark:prose-invert prose-headings:font-semibold prose-p:my-0 prose-img:my-1 prose-headings:my-1 prose-pre:my-0 prose-table:my-0 prose-blockquote:my-0 prose-ul:-my-0 prose-ol:-my-0 prose-li:-my-0 whitespace-pre-line;
@apply prose dark:prose-invert prose-headings:font-semibold prose-hr:my-4 prose-hr:border-gray-100 prose-hr:dark:border-gray-800 prose-p:my-0 prose-img:my-1 prose-headings:my-1 prose-pre:my-0 prose-table:my-0 prose-blockquote:my-0 prose-ul:-my-0 prose-ol:-my-0 prose-li:-my-0 whitespace-pre-line;
}

.input-prose-sm {
@apply prose dark:prose-invert prose-headings:font-semibold prose-p:my-0 prose-img:my-1 prose-headings:my-1 prose-pre:my-0 prose-table:my-0 prose-blockquote:my-0 prose-ul:-my-0 prose-ol:-my-0 prose-li:-my-0 whitespace-pre-line text-sm;
@apply prose dark:prose-invert prose-headings:font-semibold prose-hr:my-4 prose-hr:border-gray-100 prose-hr:dark:border-gray-800 prose-p:my-0 prose-img:my-1 prose-headings:my-1 prose-pre:my-0 prose-table:my-0 prose-blockquote:my-0 prose-ul:-my-0 prose-ol:-my-0 prose-li:-my-0 whitespace-pre-line text-sm;
}

.markdown-prose {
@apply prose dark:prose-invert prose-headings:font-semibold prose-p:my-0 prose-img:my-1 prose-headings:my-1 prose-pre:my-0 prose-table:my-0 prose-blockquote:my-0 prose-ul:-my-0 prose-ol:-my-0 prose-li:-my-0 whitespace-pre-line;
@apply prose dark:prose-invert prose-headings:font-semibold prose-hr:my-4 prose-p:my-0 prose-img:my-1 prose-headings:my-1 prose-pre:my-0 prose-table:my-0 prose-blockquote:my-0 prose-ul:-my-0 prose-ol:-my-0 prose-li:-my-0 whitespace-pre-line;
}

.markdown a {
Expand Down Expand Up @@ -211,7 +211,8 @@ input[type='number'] {
float: left;
color: #adb5bd;
pointer-events: none;
height: 0;

@apply line-clamp-1 absolute;
}

.ai-autocompletion::after {
Expand Down
9 changes: 6 additions & 3 deletions src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<link rel="apple-touch-icon" href="%sveltekit.assets%/favicon.png" />
<link rel="manifest" href="%sveltekit.assets%/manifest.json" crossorigin="use-credentials" />
<link rel="icon" type="image/png" href="/favicon/favicon-96x96.png" sizes="96x96" />
<link rel="icon" type="image/svg+xml" href="/favicon/favicon.svg" />
<link rel="shortcut icon" href="/favicon/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/favicon/apple-touch-icon.png" />
<meta name="apple-mobile-web-app-title" content="Open WebUI" />
<link rel="manifest" href="/favicon/site.webmanifest" />
<meta
name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, viewport-fit=cover"
Expand Down
8 changes: 4 additions & 4 deletions src/lib/components/admin/Settings/Models.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@
filteredModels = models
.filter((m) => searchValue === '' || m.name.toLowerCase().includes(searchValue.toLowerCase()))
.sort((a, b) => {
// Check if either model is inactive and push them to the bottom
if ((a.is_active ?? true) !== (b.is_active ?? true)) {
return (b.is_active ?? true) - (a.is_active ?? true);
}
// // Check if either model is inactive and push them to the bottom
// if ((a.is_active ?? true) !== (b.is_active ?? true)) {
// return (b.is_active ?? true) - (a.is_active ?? true);
// }
// If both models' active states are the same, sort alphabetically
return a.name.localeCompare(b.name);
});
Expand Down
Loading

0 comments on commit 29a2719

Please sign in to comment.