mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 20:07:49 +01:00
Merge branch 'refs/heads/dev' into feat/sqlalchemy-instead-of-peewee
# Conflicts: # backend/requirements.txt
This commit is contained in:
@@ -104,6 +104,7 @@ from config import (
|
||||
UPLOAD_DIR,
|
||||
CACHE_DIR,
|
||||
STATIC_DIR,
|
||||
DEFAULT_LOCALE,
|
||||
ENABLE_OPENAI_API,
|
||||
ENABLE_OLLAMA_API,
|
||||
ENABLE_MODEL_FILTER,
|
||||
@@ -633,6 +634,8 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
|
||||
return StreamingResponse(
|
||||
self.ollama_stream_wrapper(response.body_iterator, data_items),
|
||||
)
|
||||
|
||||
return response
|
||||
else:
|
||||
return response
|
||||
|
||||
@@ -1748,18 +1751,11 @@ async def update_pipeline_valves(
|
||||
|
||||
@app.get("/api/config")
|
||||
async def get_app_config():
|
||||
# Checking and Handling the Absence of 'ui' in CONFIG_DATA
|
||||
|
||||
default_locale = "en-US"
|
||||
if "ui" in CONFIG_DATA:
|
||||
default_locale = CONFIG_DATA["ui"].get("default_locale", "en-US")
|
||||
|
||||
# The Rest of the Function Now Uses the Variables Defined Above
|
||||
return {
|
||||
"status": True,
|
||||
"name": WEBUI_NAME,
|
||||
"version": VERSION,
|
||||
"default_locale": default_locale,
|
||||
"default_locale": str(DEFAULT_LOCALE),
|
||||
"default_models": webui_app.state.config.DEFAULT_MODELS,
|
||||
"default_prompt_suggestions": webui_app.state.config.DEFAULT_PROMPT_SUGGESTIONS,
|
||||
"features": {
|
||||
@@ -1972,6 +1968,11 @@ 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(
|
||||
@@ -1979,7 +1980,7 @@ async def oauth_callback(provider: str, request: Request, response: Response):
|
||||
), # 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,
|
||||
)
|
||||
|
||||
@@ -2006,7 +2007,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
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user