Skip to content

Commit

Permalink
Merge pull request #3536 from open-webui/dev
Browse files Browse the repository at this point in the history
0.3.7
  • Loading branch information
tjbck committed Jun 30, 2024
2 parents 24b638f 58d8dd9 commit 4900ac5
Show file tree
Hide file tree
Showing 15 changed files with 969 additions and 253 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.disabled → .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 4,7 @@ updates:
directory: '/backend'
schedule:
interval: weekly
target-branch: 'dev'
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 5,24 @@ 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.3.7] - 2024-06-29

### Added

- **🌐 Enhanced Internationalization (i18n)**: Newly introduced Indonesian translation, and updated translations for Turkish, Chinese, and Catalan languages to improve user accessibility.

### Fixed

- **🕵️‍♂️ Browser Language Detection**: Corrected the issue where the application was not properly detecting and adapting to the browser's language settings.
- **🔐 OIDC Admin Role Assignment**: Fixed a bug where the admin role was not being assigned to the first user who signed up via OpenID Connect (OIDC).
- **💬 Chat/Completions Endpoint**: Resolved an issue where the chat/completions endpoint was non-functional when the stream option was set to False.
- **🚫 'WEBUI_AUTH' Configuration**: Addressed the problem where setting 'WEBUI_AUTH' to False was not being applied correctly.

### Changed

- **📦 Dependency Update**: Upgraded 'authlib' from version 1.3.0 to 1.3.1 to ensure better security and performance enhancements.

## [0.3.6] - 2024-06-27

### Added
Expand Down
11 changes: 9 additions & 2 deletions backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 617,8 @@ def get_priority(function_id):
return StreamingResponse(
self.ollama_stream_wrapper(response.body_iterator, data_items),
)

return response
else:
return response

Expand Down Expand Up @@ -1944,14 1946,19 @@ async def oauth_callback(provider: str, request: Request, response: Response):
picture_url = ""
if not picture_url:
picture_url = "/user.png"
role = (
"admin"
if Users.get_num_users() == 0
else webui_app.state.config.DEFAULT_USER_ROLE
)
user = Auths.insert_new_auth(
email=email,
password=get_password_hash(
str(uuid.uuid4())
), # Random password, not used
name=user_data.get("name", "User"),
profile_image_url=picture_url,
role=webui_app.state.config.DEFAULT_USER_ROLE,
role=role,
oauth_sub=provider_sub,
)

Expand All @@ -1978,7 1985,7 @@ async def oauth_callback(provider: str, request: Request, response: Response):
# Set the cookie token
response.set_cookie(
key="token",
value=token,
value=jwt_token,
httponly=True, # Ensures the cookie is not accessible via JavaScript
)

Expand Down
2 changes: 1 addition & 1 deletion backend/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 58,7 @@ rank-bm25==0.2.2
faster-whisper==1.0.2

PyJWT[crypto]==2.8.0
authlib==1.3.0
authlib==1.3.1

black==24.4.2
langfuse==2.33.0
Expand Down
4 changes: 2 additions & 2 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.3.6",
"version": "0.3.7",
"private": true,
"scripts": {
"dev": "npm run pyodide:fetch && vite dev --host",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 59,7 @@ dependencies = [
"faster-whisper==1.0.2",

"PyJWT[crypto]==2.8.0",
"authlib==1.3.0",
"authlib==1.3.1",

"black==24.4.2",
"langfuse==2.33.0",
Expand Down
54 changes: 33 additions & 21 deletions src/lib/components/workspace/Functions/FunctionEditor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,61 27,73 @@
}
let codeEditor;
let boilerplate = `from pydantic import BaseModel
let boilerplate = `"""
title: Example Filter
author: open-webui
author_url: https://github.com/open-webui
funding_url: https://github.com/open-webui
version: 0.1
"""
from pydantic import BaseModel, Field
from typing import Optional
class Filter:
class Valves(BaseModel):
max_turns: int = 4
priority: int = Field(
default=0, description="Priority level for the filter operations."
)
max_turns: int = Field(
default=8, description="Maximum allowable conversation turns for a user."
)
pass
class UserValves(BaseModel):
max_turns: int = Field(
default=4, description="Maximum allowable conversation turns for a user."
)
pass
def __init__(self):
# Indicates custom file handling logic. This flag helps disengage default routines in favor of custom
# implementations, informing the WebUI to defer file-related operations to designated methods within this class.
# Alternatively, you can remove the files directly from the body in from the inlet hook
self.file_handler = True
# self.file_handler = True
# Initialize 'valves' with specific configurations. Using 'Valves' instance helps encapsulate settings,
# which ensures settings are managed cohesively and not confused with operational flags like 'file_handler'.
self.valves = self.Valves(**{"max_turns": 2})
self.valves = self.Valves()
pass
def inlet(self, body: dict, user: Optional[dict] = None) -> dict:
def inlet(self, body: dict, __user__: Optional[dict] = None) -> dict:
# Modify the request body or validate it before processing by the chat completion API.
# This function is the pre-processor for the API where various checks on the input can be performed.
# It can also modify the request before sending it to the API.
print(f"inlet:{__name__}")
print(f"inlet:body:{body}")
print(f"inlet:user:{user}")
print(f"inlet:user:{__user__}")
if user.get("role", "admin") in ["user", "admin"]:
if __user__.get("role", "admin") in ["user", "admin"]:
messages = body.get("messages", [])
if len(messages) > self.valves.max_turns:
max_turns = min(__user__["valves"].max_turns, self.valves.max_turns)
if len(messages) > max_turns:
raise Exception(
f"Conversation turn limit exceeded. Max turns: {self.valves.max_turns}"
f"Conversation turn limit exceeded. Max turns: {max_turns}"
)
return body
def outlet(self, body: dict, user: Optional[dict] = None) -> dict:
def outlet(self, body: dict, __user__: Optional[dict] = None) -> dict:
# Modify or analyze the response body after processing by the API.
# This function is the post-processor for the API, which can be used to modify the response
# or perform additional checks and analytics.
print(f"outlet:{__name__}")
print(f"outlet:body:{body}")
print(f"outlet:user:{user}")
messages = [
{
**message,
"content": f"{message['content']} - @@Modified from Filter Outlet",
}
for message in body.get("messages", [])
]
return {"messages": messages}
print(f"outlet:user:{__user__}")
return body
`;
const _boilerplate = `from pydantic import BaseModel
Expand Down
Loading

0 comments on commit 4900ac5

Please sign in to comment.