mirror of
https://github.com/open-webui/open-webui
synced 2024-12-29 15:25:29 +00:00
chore: format
This commit is contained in:
parent
08398e511e
commit
1902d4238b
@ -6,6 +6,7 @@ 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).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- **🌐 Enhanced Translations**: Added Slovak language, improved Czech language.
|
- **🌐 Enhanced Translations**: Added Slovak language, improved Czech language.
|
||||||
|
|
||||||
## [0.4.8] - 2024-12-07
|
## [0.4.8] - 2024-12-07
|
||||||
|
@ -21,7 +21,7 @@ from open_webui.env import (
|
|||||||
WEBUI_NAME,
|
WEBUI_NAME,
|
||||||
log,
|
log,
|
||||||
DATABASE_URL,
|
DATABASE_URL,
|
||||||
OFFLINE_MODE
|
OFFLINE_MODE,
|
||||||
)
|
)
|
||||||
from pydantic import BaseModel
|
from pydantic import BaseModel
|
||||||
from sqlalchemy import JSON, Column, DateTime, Integer, func
|
from sqlalchemy import JSON, Column, DateTime, Integer, func
|
||||||
@ -1265,7 +1265,8 @@ RAG_EMBEDDING_MODEL = PersistentConfig(
|
|||||||
log.info(f"Embedding model set: {RAG_EMBEDDING_MODEL.value}")
|
log.info(f"Embedding model set: {RAG_EMBEDDING_MODEL.value}")
|
||||||
|
|
||||||
RAG_EMBEDDING_MODEL_AUTO_UPDATE = (
|
RAG_EMBEDDING_MODEL_AUTO_UPDATE = (
|
||||||
not OFFLINE_MODE and os.environ.get("RAG_EMBEDDING_MODEL_AUTO_UPDATE", "True").lower() == "true"
|
not OFFLINE_MODE
|
||||||
|
and os.environ.get("RAG_EMBEDDING_MODEL_AUTO_UPDATE", "True").lower() == "true"
|
||||||
)
|
)
|
||||||
|
|
||||||
RAG_EMBEDDING_MODEL_TRUST_REMOTE_CODE = (
|
RAG_EMBEDDING_MODEL_TRUST_REMOTE_CODE = (
|
||||||
@ -1290,7 +1291,8 @@ if RAG_RERANKING_MODEL.value != "":
|
|||||||
log.info(f"Reranking model set: {RAG_RERANKING_MODEL.value}")
|
log.info(f"Reranking model set: {RAG_RERANKING_MODEL.value}")
|
||||||
|
|
||||||
RAG_RERANKING_MODEL_AUTO_UPDATE = (
|
RAG_RERANKING_MODEL_AUTO_UPDATE = (
|
||||||
not OFFLINE_MODE and os.environ.get("RAG_RERANKING_MODEL_AUTO_UPDATE", "True").lower() == "true"
|
not OFFLINE_MODE
|
||||||
|
and os.environ.get("RAG_RERANKING_MODEL_AUTO_UPDATE", "True").lower() == "true"
|
||||||
)
|
)
|
||||||
|
|
||||||
RAG_RERANKING_MODEL_TRUST_REMOTE_CODE = (
|
RAG_RERANKING_MODEL_TRUST_REMOTE_CODE = (
|
||||||
@ -1766,7 +1768,8 @@ WHISPER_MODEL = PersistentConfig(
|
|||||||
|
|
||||||
WHISPER_MODEL_DIR = os.getenv("WHISPER_MODEL_DIR", f"{CACHE_DIR}/whisper/models")
|
WHISPER_MODEL_DIR = os.getenv("WHISPER_MODEL_DIR", f"{CACHE_DIR}/whisper/models")
|
||||||
WHISPER_MODEL_AUTO_UPDATE = (
|
WHISPER_MODEL_AUTO_UPDATE = (
|
||||||
not OFFLINE_MODE and os.environ.get("WHISPER_MODEL_AUTO_UPDATE", "").lower() == "true"
|
not OFFLINE_MODE
|
||||||
|
and os.environ.get("WHISPER_MODEL_AUTO_UPDATE", "").lower() == "true"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ from fastapi import (
|
|||||||
Request,
|
Request,
|
||||||
UploadFile,
|
UploadFile,
|
||||||
status,
|
status,
|
||||||
applications
|
applications,
|
||||||
)
|
)
|
||||||
from fastapi.middleware.cors import CORSMiddleware
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
from fastapi.openapi.docs import get_swagger_ui_html
|
from fastapi.openapi.docs import get_swagger_ui_html
|
||||||
@ -1107,14 +1107,18 @@ async def healthcheck_with_db():
|
|||||||
|
|
||||||
app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")
|
app.mount("/static", StaticFiles(directory=STATIC_DIR), name="static")
|
||||||
app.mount("/cache", StaticFiles(directory=CACHE_DIR), name="cache")
|
app.mount("/cache", StaticFiles(directory=CACHE_DIR), name="cache")
|
||||||
|
|
||||||
|
|
||||||
def swagger_monkey_patch(*args, **kwargs):
|
def swagger_monkey_patch(*args, **kwargs):
|
||||||
return get_swagger_ui_html(
|
return get_swagger_ui_html(
|
||||||
*args,
|
*args,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
swagger_js_url="/static/swagger-ui/swagger-ui-bundle.js",
|
swagger_js_url="/static/swagger-ui/swagger-ui-bundle.js",
|
||||||
swagger_css_url="/static/swagger-ui/swagger-ui.css",
|
swagger_css_url="/static/swagger-ui/swagger-ui.css",
|
||||||
swagger_favicon_url="/static/swagger-ui/favicon.png"
|
swagger_favicon_url="/static/swagger-ui/favicon.png",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
applications.get_swagger_ui_html = swagger_monkey_patch
|
applications.get_swagger_ui_html = swagger_monkey_patch
|
||||||
|
|
||||||
if os.path.exists(FRONTEND_BUILD_DIR):
|
if os.path.exists(FRONTEND_BUILD_DIR):
|
||||||
|
@ -301,8 +301,13 @@ def get_models(request: Request, user=Depends(get_verified_user)):
|
|||||||
]
|
]
|
||||||
elif request.app.state.config.IMAGE_GENERATION_ENGINE == "comfyui":
|
elif request.app.state.config.IMAGE_GENERATION_ENGINE == "comfyui":
|
||||||
# TODO - get models from comfyui
|
# TODO - get models from comfyui
|
||||||
headers = {"Authorization": f"Bearer {request.app.state.config.COMFYUI_API_KEY}"}
|
headers = {
|
||||||
r = requests.get(url=f"{request.app.state.config.COMFYUI_BASE_URL}/object_info", headers=headers)
|
"Authorization": f"Bearer {request.app.state.config.COMFYUI_API_KEY}"
|
||||||
|
}
|
||||||
|
r = requests.get(
|
||||||
|
url=f"{request.app.state.config.COMFYUI_BASE_URL}/object_info",
|
||||||
|
headers=headers,
|
||||||
|
)
|
||||||
info = r.json()
|
info = r.json()
|
||||||
|
|
||||||
workflow = json.loads(request.app.state.config.COMFYUI_WORKFLOW)
|
workflow = json.loads(request.app.state.config.COMFYUI_WORKFLOW)
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
|
|
||||||
html {
|
html {
|
||||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'NotoSans', 'NotoSansJP', 'NotoSansKR',
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'NotoSans', 'NotoSansJP', 'NotoSansKR',
|
||||||
'NotoSansSC', 'Twemoji', 'STSong-Light', 'MSung-Light', 'HeiseiMin-W3', 'HYSMyeongJo-Medium', Roboto,
|
'NotoSansSC', 'Twemoji', 'STSong-Light', 'MSung-Light', 'HeiseiMin-W3', 'HYSMyeongJo-Medium',
|
||||||
'Helvetica Neue', Arial, sans-serif;
|
Roboto, 'Helvetica Neue', Arial, sans-serif;
|
||||||
font-size: 14px; /* Default font size */
|
font-size: 14px; /* Default font size */
|
||||||
line-height: 1.5;
|
line-height: 1.5;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -16,14 +16,16 @@ log.setLevel(SRC_LOG_LEVELS["COMFYUI"])
|
|||||||
default_headers = {"User-Agent": "Mozilla/5.0"}
|
default_headers = {"User-Agent": "Mozilla/5.0"}
|
||||||
|
|
||||||
|
|
||||||
def queue_prompt(prompt, client_id, base_url,api_key):
|
def queue_prompt(prompt, client_id, base_url, api_key):
|
||||||
log.info("queue_prompt")
|
log.info("queue_prompt")
|
||||||
p = {"prompt": prompt, "client_id": client_id}
|
p = {"prompt": prompt, "client_id": client_id}
|
||||||
data = json.dumps(p).encode("utf-8")
|
data = json.dumps(p).encode("utf-8")
|
||||||
log.debug(f"queue_prompt data: {data}")
|
log.debug(f"queue_prompt data: {data}")
|
||||||
try:
|
try:
|
||||||
req = urllib.request.Request(
|
req = urllib.request.Request(
|
||||||
f"{base_url}/prompt", data=data, headers={**default_headers, "Authorization": f"Bearer {api_key}"}
|
f"{base_url}/prompt",
|
||||||
|
data=data,
|
||||||
|
headers={**default_headers, "Authorization": f"Bearer {api_key}"},
|
||||||
)
|
)
|
||||||
response = urllib.request.urlopen(req).read()
|
response = urllib.request.urlopen(req).read()
|
||||||
return json.loads(response)
|
return json.loads(response)
|
||||||
@ -37,7 +39,8 @@ def get_image(filename, subfolder, folder_type, base_url, api_key):
|
|||||||
data = {"filename": filename, "subfolder": subfolder, "type": folder_type}
|
data = {"filename": filename, "subfolder": subfolder, "type": folder_type}
|
||||||
url_values = urllib.parse.urlencode(data)
|
url_values = urllib.parse.urlencode(data)
|
||||||
req = urllib.request.Request(
|
req = urllib.request.Request(
|
||||||
f"{base_url}/view?{url_values}", headers={**default_headers, "Authorization": f"Bearer {api_key}"}
|
f"{base_url}/view?{url_values}",
|
||||||
|
headers={**default_headers, "Authorization": f"Bearer {api_key}"},
|
||||||
)
|
)
|
||||||
with urllib.request.urlopen(req) as response:
|
with urllib.request.urlopen(req) as response:
|
||||||
return response.read()
|
return response.read()
|
||||||
@ -54,7 +57,8 @@ def get_history(prompt_id, base_url, api_key):
|
|||||||
log.info("get_history")
|
log.info("get_history")
|
||||||
|
|
||||||
req = urllib.request.Request(
|
req = urllib.request.Request(
|
||||||
f"{base_url}/history/{prompt_id}", headers={**default_headers, "Authorization": f"Bearer {api_key}"}
|
f"{base_url}/history/{prompt_id}",
|
||||||
|
headers={**default_headers, "Authorization": f"Bearer {api_key}"},
|
||||||
)
|
)
|
||||||
with urllib.request.urlopen(req) as response:
|
with urllib.request.urlopen(req) as response:
|
||||||
return json.loads(response.read())
|
return json.loads(response.read())
|
||||||
@ -177,7 +181,9 @@ async def comfyui_generate_image(
|
|||||||
try:
|
try:
|
||||||
log.info("Sending workflow to WebSocket server.")
|
log.info("Sending workflow to WebSocket server.")
|
||||||
log.info(f"Workflow: {workflow}")
|
log.info(f"Workflow: {workflow}")
|
||||||
images = await asyncio.to_thread(get_images, ws, workflow, client_id, base_url, api_key)
|
images = await asyncio.to_thread(
|
||||||
|
get_images, ws, workflow, client_id, base_url, api_key
|
||||||
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception(f"Error while receiving images: {e}")
|
log.exception(f"Error while receiving images: {e}")
|
||||||
images = None
|
images = None
|
||||||
|
@ -144,15 +144,21 @@ class OAuthManager:
|
|||||||
if not group_permissions:
|
if not group_permissions:
|
||||||
group_permissions = default_permissions
|
group_permissions = default_permissions
|
||||||
|
|
||||||
update_form = GroupUpdateForm(name=group_model.name, description=group_model.description,
|
update_form = GroupUpdateForm(
|
||||||
permissions=group_permissions,
|
name=group_model.name,
|
||||||
user_ids=user_ids)
|
description=group_model.description,
|
||||||
Groups.update_group_by_id(id=group_model.id, form_data=update_form, overwrite=False)
|
permissions=group_permissions,
|
||||||
|
user_ids=user_ids,
|
||||||
|
)
|
||||||
|
Groups.update_group_by_id(
|
||||||
|
id=group_model.id, form_data=update_form, overwrite=False
|
||||||
|
)
|
||||||
|
|
||||||
# Add user to new groups
|
# Add user to new groups
|
||||||
for group_model in all_available_groups:
|
for group_model in all_available_groups:
|
||||||
if group_model.name in user_oauth_groups and not any(gm.name == group_model.name for gm in user_current_groups):
|
if group_model.name in user_oauth_groups and not any(
|
||||||
|
gm.name == group_model.name for gm in user_current_groups
|
||||||
|
):
|
||||||
# Add user to group
|
# Add user to group
|
||||||
|
|
||||||
user_ids = group_model.user_ids
|
user_ids = group_model.user_ids
|
||||||
@ -163,10 +169,15 @@ class OAuthManager:
|
|||||||
if not group_permissions:
|
if not group_permissions:
|
||||||
group_permissions = default_permissions
|
group_permissions = default_permissions
|
||||||
|
|
||||||
update_form = GroupUpdateForm(name=group_model.name, description=group_model.description,
|
update_form = GroupUpdateForm(
|
||||||
permissions=group_permissions,
|
name=group_model.name,
|
||||||
user_ids=user_ids)
|
description=group_model.description,
|
||||||
Groups.update_group_by_id(id=group_model.id, form_data=update_form, overwrite=False)
|
permissions=group_permissions,
|
||||||
|
user_ids=user_ids,
|
||||||
|
)
|
||||||
|
Groups.update_group_by_id(
|
||||||
|
id=group_model.id, form_data=update_form, overwrite=False
|
||||||
|
)
|
||||||
|
|
||||||
async def handle_login(self, provider, request):
|
async def handle_login(self, provider, request):
|
||||||
if provider not in OAUTH_PROVIDERS:
|
if provider not in OAUTH_PROVIDERS:
|
||||||
@ -304,8 +315,11 @@ class OAuthManager:
|
|||||||
)
|
)
|
||||||
|
|
||||||
if auth_manager_config.ENABLE_OAUTH_GROUP_MANAGEMENT:
|
if auth_manager_config.ENABLE_OAUTH_GROUP_MANAGEMENT:
|
||||||
self.update_user_groups(user=user, user_data=user_data,
|
self.update_user_groups(
|
||||||
default_permissions=request.app.state.config.USER_PERMISSIONS)
|
user=user,
|
||||||
|
user_data=user_data,
|
||||||
|
default_permissions=request.app.state.config.USER_PERMISSIONS,
|
||||||
|
)
|
||||||
|
|
||||||
# Set the cookie token
|
# Set the cookie token
|
||||||
response.set_cookie(
|
response.set_cookie(
|
||||||
|
@ -84,7 +84,7 @@ async function* openAIStreamToIterator(
|
|||||||
|
|
||||||
yield {
|
yield {
|
||||||
done: false,
|
done: false,
|
||||||
value: parsedData.choices?.[0]?.delta?.content ?? '',
|
value: parsedData.choices?.[0]?.delta?.content ?? ''
|
||||||
};
|
};
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error('Error extracting delta from SSE event:', e);
|
console.error('Error extracting delta from SSE event:', e);
|
||||||
@ -120,8 +120,6 @@ async function* streamLargeDeltasAsRandomChunks(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
let content = textStreamUpdate.value;
|
let content = textStreamUpdate.value;
|
||||||
if (content.length < 5) {
|
if (content.length < 5) {
|
||||||
yield { done: false, value: content };
|
yield { done: false, value: content };
|
||||||
|
@ -478,7 +478,6 @@
|
|||||||
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
|
class="w-full rounded-lg py-2 px-4 text-sm bg-gray-50 dark:text-gray-300 dark:bg-gray-850 outline-none"
|
||||||
placeholder={$i18n.t('sk-1234')}
|
placeholder={$i18n.t('sk-1234')}
|
||||||
bind:value={config.comfyui.COMFYUI_API_KEY}
|
bind:value={config.comfyui.COMFYUI_API_KEY}
|
||||||
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user