From a71d927a0c505f9d3a30bbb3e7ca56d666144245 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 2 Apr 2026 08:11:06 -0500 Subject: [PATCH] chore: format --- backend/open_webui/models/chats.py | 12 +++------ backend/open_webui/models/feedbacks.py | 4 +-- backend/open_webui/routers/evaluations.py | 5 +--- backend/open_webui/utils/oauth.py | 5 ++-- backend/open_webui/utils/validate.py | 4 +-- src/lib/apis/auths/index.ts | 2 +- src/lib/apis/evaluations/index.ts | 25 +++++++++++++------ .../admin/Evaluations/Feedbacks.svelte | 7 +++--- .../chat/Messages/ContentRenderer.svelte | 1 - .../chat/ModelSelector/Selector.svelte | 7 +++++- src/lib/i18n/locales/ar-BH/translation.json | 2 ++ src/lib/i18n/locales/ar/translation.json | 2 ++ src/lib/i18n/locales/az-AZ/translation.json | 2 ++ src/lib/i18n/locales/bg-BG/translation.json | 2 ++ src/lib/i18n/locales/bn-BD/translation.json | 2 ++ src/lib/i18n/locales/bo-TB/translation.json | 2 ++ src/lib/i18n/locales/bs-BA/translation.json | 2 ++ src/lib/i18n/locales/ca-ES/translation.json | 2 ++ src/lib/i18n/locales/ceb-PH/translation.json | 2 ++ src/lib/i18n/locales/cs-CZ/translation.json | 2 ++ src/lib/i18n/locales/da-DK/translation.json | 2 ++ src/lib/i18n/locales/de-DE/translation.json | 2 ++ src/lib/i18n/locales/dg-DG/translation.json | 2 ++ src/lib/i18n/locales/el-GR/translation.json | 2 ++ src/lib/i18n/locales/en-GB/translation.json | 2 ++ src/lib/i18n/locales/en-US/translation.json | 2 ++ src/lib/i18n/locales/es-ES/translation.json | 2 ++ src/lib/i18n/locales/et-EE/translation.json | 2 ++ src/lib/i18n/locales/eu-ES/translation.json | 2 ++ src/lib/i18n/locales/fa-IR/translation.json | 2 ++ src/lib/i18n/locales/fi-FI/translation.json | 2 ++ src/lib/i18n/locales/fr-CA/translation.json | 2 ++ src/lib/i18n/locales/fr-FR/translation.json | 2 ++ src/lib/i18n/locales/gl-ES/translation.json | 2 ++ src/lib/i18n/locales/he-IL/translation.json | 2 ++ src/lib/i18n/locales/hi-IN/translation.json | 2 ++ src/lib/i18n/locales/hr-HR/translation.json | 2 ++ src/lib/i18n/locales/hu-HU/translation.json | 2 ++ src/lib/i18n/locales/id-ID/translation.json | 2 ++ src/lib/i18n/locales/ie-GA/translation.json | 2 ++ src/lib/i18n/locales/it-IT/translation.json | 2 ++ src/lib/i18n/locales/ja-JP/translation.json | 2 ++ src/lib/i18n/locales/ka-GE/translation.json | 2 ++ src/lib/i18n/locales/kab-DZ/translation.json | 2 ++ src/lib/i18n/locales/ko-KR/translation.json | 2 ++ src/lib/i18n/locales/lt-LT/translation.json | 2 ++ src/lib/i18n/locales/lv-LV/translation.json | 2 ++ src/lib/i18n/locales/ms-MY/translation.json | 2 ++ src/lib/i18n/locales/nb-NO/translation.json | 2 ++ src/lib/i18n/locales/nl-NL/translation.json | 2 ++ src/lib/i18n/locales/pa-IN/translation.json | 2 ++ src/lib/i18n/locales/pl-PL/translation.json | 2 ++ src/lib/i18n/locales/pt-BR/translation.json | 2 ++ src/lib/i18n/locales/pt-PT/translation.json | 2 ++ src/lib/i18n/locales/ro-RO/translation.json | 2 ++ src/lib/i18n/locales/ru-RU/translation.json | 2 ++ src/lib/i18n/locales/sk-SK/translation.json | 2 ++ src/lib/i18n/locales/sr-RS/translation.json | 2 ++ src/lib/i18n/locales/sv-SE/translation.json | 2 ++ src/lib/i18n/locales/ta-IN/translation.json | 2 ++ src/lib/i18n/locales/th-TH/translation.json | 2 ++ src/lib/i18n/locales/tk-TM/translation.json | 2 ++ src/lib/i18n/locales/tr-TR/translation.json | 2 ++ src/lib/i18n/locales/ug-CN/translation.json | 2 ++ src/lib/i18n/locales/uk-UA/translation.json | 2 ++ src/lib/i18n/locales/ur-PK/translation.json | 2 ++ .../i18n/locales/uz-Cyrl-UZ/translation.json | 2 ++ .../i18n/locales/uz-Latn-Uz/translation.json | 2 ++ src/lib/i18n/locales/vi-VN/translation.json | 2 ++ 69 files changed, 153 insertions(+), 37 deletions(-) diff --git a/backend/open_webui/models/chats.py b/backend/open_webui/models/chats.py index dc2f63695..5f53e741e 100644 --- a/backend/open_webui/models/chats.py +++ b/backend/open_webui/models/chats.py @@ -827,9 +827,7 @@ class ChatTable: else: query = query.order_by(Chat.updated_at.desc(), Chat.id) - query = query.with_entities( - Chat.id, Chat.title, Chat.updated_at, Chat.created_at, Chat.last_read_at - ) + query = query.with_entities(Chat.id, Chat.title, Chat.updated_at, Chat.created_at, Chat.last_read_at) if skip: query = query.offset(skip) @@ -1263,9 +1261,7 @@ class ChatTable: query = query.order_by(Chat.updated_at.desc(), Chat.id) - query = query.with_entities( - Chat.id, Chat.title, Chat.updated_at, Chat.created_at, Chat.last_read_at - ) + query = query.with_entities(Chat.id, Chat.title, Chat.updated_at, Chat.created_at, Chat.last_read_at) if skip: query = query.offset(skip) @@ -1348,9 +1344,7 @@ class ChatTable: query = query.order_by(Chat.updated_at.desc(), Chat.id) - query = query.with_entities( - Chat.id, Chat.title, Chat.updated_at, Chat.created_at, Chat.last_read_at - ) + query = query.with_entities(Chat.id, Chat.title, Chat.updated_at, Chat.created_at, Chat.last_read_at) if skip: query = query.offset(skip) diff --git a/backend/open_webui/models/feedbacks.py b/backend/open_webui/models/feedbacks.py index f930739f6..9172e2ba8 100644 --- a/backend/open_webui/models/feedbacks.py +++ b/backend/open_webui/models/feedbacks.py @@ -218,9 +218,7 @@ class FeedbackTable: # Apply model_id filter (exact match) model_id = filter.get('model_id') if model_id: - query = query.filter( - Feedback.data['model_id'].as_string() == model_id - ) + query = query.filter(Feedback.data['model_id'].as_string() == model_id) order_by = filter.get('order_by') direction = filter.get('direction') diff --git a/backend/open_webui/routers/evaluations.py b/backend/open_webui/routers/evaluations.py index a743f8f9f..9805f2ece 100644 --- a/backend/open_webui/routers/evaluations.py +++ b/backend/open_webui/routers/evaluations.py @@ -321,10 +321,7 @@ async def export_all_feedbacks( ): feedbacks = Feedbacks.get_all_feedbacks(db=db) if model_id: - feedbacks = [ - f for f in feedbacks - if f.data and f.data.get('model_id') == model_id - ] + feedbacks = [f for f in feedbacks if f.data and f.data.get('model_id') == model_id] return feedbacks diff --git a/backend/open_webui/utils/oauth.py b/backend/open_webui/utils/oauth.py index 0cbe753b7..885b79afd 100644 --- a/backend/open_webui/utils/oauth.py +++ b/backend/open_webui/utils/oauth.py @@ -1357,9 +1357,8 @@ class OAuthManager: client = self.get_client(provider) if client is None: raise HTTPException(404) - redirect_uri = ( - (client.server_metadata or {}).get('redirect_uri') - or request.url_for('oauth_login_callback', provider=provider) + redirect_uri = (client.server_metadata or {}).get('redirect_uri') or request.url_for( + 'oauth_login_callback', provider=provider ) kwargs = {} diff --git a/backend/open_webui/utils/validate.py b/backend/open_webui/utils/validate.py index 5686f20ec..eec53317f 100644 --- a/backend/open_webui/utils/validate.py +++ b/backend/open_webui/utils/validate.py @@ -7,9 +7,7 @@ _ALLOWED_STATIC_PATHS = ( ) # External URL prefixes that are explicitly trusted for profile images -_ALLOWED_URL_PREFIXES = ( - 'https://www.gravatar.com/avatar/', -) +_ALLOWED_URL_PREFIXES = ('https://www.gravatar.com/avatar/',) def validate_profile_image_url(url: str) -> str: diff --git a/src/lib/apis/auths/index.ts b/src/lib/apis/auths/index.ts index f8e953f7c..c501a36ed 100644 --- a/src/lib/apis/auths/index.ts +++ b/src/lib/apis/auths/index.ts @@ -414,7 +414,7 @@ export const updateUserProfile = async (token: string, profile: object) => { console.error(err); error = err.detail; if (Array.isArray(error)) { - error = error.map((e: { msg?: string }) => e.msg).join("; "); + error = error.map((e: { msg?: string }) => e.msg).join('; '); } return null; }); diff --git a/src/lib/apis/evaluations/index.ts b/src/lib/apis/evaluations/index.ts index 925329511..bfb6955bc 100644 --- a/src/lib/apis/evaluations/index.ts +++ b/src/lib/apis/evaluations/index.ts @@ -189,7 +189,13 @@ export const getFeedbackModelIds = async (token: string = '') => { return res; }; -export const getFeedbackItems = async (token: string = '', orderBy, direction, page, modelId: string = '') => { +export const getFeedbackItems = async ( + token: string = '', + orderBy, + direction, + page, + modelId: string = '' +) => { let error = null; const searchParams = new URLSearchParams(); @@ -235,14 +241,17 @@ export const exportAllFeedbacks = async (token: string = '', modelId: string = ' const searchParams = new URLSearchParams(); if (modelId) searchParams.append('model_id', modelId); - const res = await fetch(`${WEBUI_API_BASE_URL}/evaluations/feedbacks/all/export?${searchParams.toString()}`, { - method: 'GET', - headers: { - Accept: 'application/json', - 'Content-Type': 'application/json', - authorization: `Bearer ${token}` + const res = await fetch( + `${WEBUI_API_BASE_URL}/evaluations/feedbacks/all/export?${searchParams.toString()}`, + { + method: 'GET', + headers: { + Accept: 'application/json', + 'Content-Type': 'application/json', + authorization: `Bearer ${token}` + } } - }) + ) .then(async (res) => { if (!res.ok) throw await res.json(); return res.json(); diff --git a/src/lib/components/admin/Evaluations/Feedbacks.svelte b/src/lib/components/admin/Evaluations/Feedbacks.svelte index 6e11291d5..da7c8b579 100644 --- a/src/lib/components/admin/Evaluations/Feedbacks.svelte +++ b/src/lib/components/admin/Evaluations/Feedbacks.svelte @@ -176,10 +176,9 @@ : s; }; - return [ - headers.join(','), - ...rows.map((r) => headers.map((h) => escape(r[h])).join(',')) - ].join('\n'); + return [headers.join(','), ...rows.map((r) => headers.map((h) => escape(r[h])).join(','))].join( + '\n' + ); }; const exportHandler = async (format: 'json' | 'csv' = 'json') => { diff --git a/src/lib/components/chat/Messages/ContentRenderer.svelte b/src/lib/components/chat/Messages/ContentRenderer.svelte index 1a5709d43..37246c6de 100644 --- a/src/lib/components/chat/Messages/ContentRenderer.svelte +++ b/src/lib/components/chat/Messages/ContentRenderer.svelte @@ -42,7 +42,6 @@ let contentContainerElement; let floatingButtonsElement; - let sourceIds = []; $: getSourceIds(sources); diff --git a/src/lib/components/chat/ModelSelector/Selector.svelte b/src/lib/components/chat/ModelSelector/Selector.svelte index 8cc04272b..300d59a2a 100644 --- a/src/lib/components/chat/ModelSelector/Selector.svelte +++ b/src/lib/components/chat/ModelSelector/Selector.svelte @@ -497,7 +497,12 @@ > {#snippet child({ wrapperProps, props, open })} {#if open} -
+