diff --git a/backend/apps/webui/routers/auths.py b/backend/apps/webui/routers/auths.py index 6c4941475..16e395737 100644 --- a/backend/apps/webui/routers/auths.py +++ b/backend/apps/webui/routers/auths.py @@ -33,7 +33,11 @@ from utils.utils import ( from utils.misc import parse_duration, validate_email_format from utils.webhook import post_webhook from constants import ERROR_MESSAGES, WEBHOOK_MESSAGES -from config import WEBUI_AUTH, WEBUI_AUTH_TRUSTED_EMAIL_HEADER, WEBUI_AUTH_TRUSTED_NAME_HEADER +from config import ( + WEBUI_AUTH, + WEBUI_AUTH_TRUSTED_EMAIL_HEADER, + WEBUI_AUTH_TRUSTED_NAME_HEADER, +) router = APIRouter() @@ -112,7 +116,9 @@ async def signin(request: Request, form_data: SigninForm): trusted_email = request.headers[WEBUI_AUTH_TRUSTED_EMAIL_HEADER].lower() trusted_name = trusted_email if WEBUI_AUTH_TRUSTED_NAME_HEADER: - trusted_name = request.headers.get(WEBUI_AUTH_TRUSTED_NAME_HEADER, trusted_email) + trusted_name = request.headers.get( + WEBUI_AUTH_TRUSTED_NAME_HEADER, trusted_email + ) if not Users.get_user_by_email(trusted_email.lower()): await signup( request, diff --git a/backend/config.py b/backend/config.py index f3f85202c..1a38a450d 100644 --- a/backend/config.py +++ b/backend/config.py @@ -294,9 +294,7 @@ WEBUI_AUTH = os.environ.get("WEBUI_AUTH", "True").lower() == "true" WEBUI_AUTH_TRUSTED_EMAIL_HEADER = os.environ.get( "WEBUI_AUTH_TRUSTED_EMAIL_HEADER", None ) -WEBUI_AUTH_TRUSTED_NAME_HEADER = os.environ.get( - "WEBUI_AUTH_TRUSTED_NAME_HEADER", None -) +WEBUI_AUTH_TRUSTED_NAME_HEADER = os.environ.get("WEBUI_AUTH_TRUSTED_NAME_HEADER", None) JWT_EXPIRES_IN = PersistentConfig( "JWT_EXPIRES_IN", "auth.jwt_expiry", os.environ.get("JWT_EXPIRES_IN", "-1") ) diff --git a/src/lib/components/admin/UserChatsModal.svelte b/src/lib/components/admin/UserChatsModal.svelte index e1590f268..535dee074 100644 --- a/src/lib/components/admin/UserChatsModal.svelte +++ b/src/lib/components/admin/UserChatsModal.svelte @@ -80,7 +80,11 @@ class="text-xs text-gray-700 uppercase bg-transparent dark:text-gray-200 border-b-2 dark:border-gray-800" > - setSortKey('title')}> + setSortKey('title')} + > {$i18n.t('Title')} {#if sortKey === 'title'} {sortOrder === 'asc' ? '▲' : '▼'} @@ -88,7 +92,11 @@ {/if} - setSortKey('created_at')}> + setSortKey('created_at')} + > {$i18n.t('Created at')} {#if sortKey === 'created_at'} {sortOrder === 'asc' ? '▲' : '▼'} @@ -96,7 +104,11 @@ {/if} - setSortKey('updated_at')}> + setSortKey('updated_at')} + > {$i18n.t('Updated at')} {#if sortKey === 'updated_at'} {sortOrder === 'asc' ? '▲' : '▼'} @@ -108,12 +120,11 @@ - {#each chats - .sort((a, b) => { - if (a[sortKey] < b[sortKey]) return sortOrder === 'asc' ? -1 : 1; - if (a[sortKey] > b[sortKey]) return sortOrder === 'asc' ? 1 : -1; - return 0; - }) as chat, idx} + {#each chats.sort((a, b) => { + if (a[sortKey] < b[sortKey]) return sortOrder === 'asc' ? -1 : 1; + if (a[sortKey] > b[sortKey]) return sortOrder === 'asc' ? 1 : -1; + return 0; + }) as chat, idx} - setSortKey('role')}> - {$i18n.t('Role')} - {#if sortKey === 'role'} - {sortOrder === 'asc' ? '▲' : '▼'} - {:else} - - {/if} + setSortKey('role')} + > + {$i18n.t('Role')} + {#if sortKey === 'role'} + {sortOrder === 'asc' ? '▲' : '▼'} + {:else} + + {/if} - setSortKey('name')}> - {$i18n.t('Name')} - {#if sortKey === 'name'} - {sortOrder === 'asc' ? '▲' : '▼'} - {:else} - - {/if} + setSortKey('name')} + > + {$i18n.t('Name')} + {#if sortKey === 'name'} + {sortOrder === 'asc' ? '▲' : '▼'} + {:else} + + {/if} - setSortKey('email')}> - {$i18n.t('Email')} - {#if sortKey === 'email'} - {sortOrder === 'asc' ? '▲' : '▼'} - {:else} - - {/if} + setSortKey('email')} + > + {$i18n.t('Email')} + {#if sortKey === 'email'} + {sortOrder === 'asc' ? '▲' : '▼'} + {:else} + + {/if} - setSortKey('last_active_at')}> - {$i18n.t('Last Active')} - {#if sortKey === 'last_active_at'} - {sortOrder === 'asc' ? '▲' : '▼'} - {:else} - - {/if} + setSortKey('last_active_at')} + > + {$i18n.t('Last Active')} + {#if sortKey === 'last_active_at'} + {sortOrder === 'asc' ? '▲' : '▼'} + {:else} + + {/if} - setSortKey('created_at')}> - {$i18n.t('Created at')} - {#if sortKey === 'created_at'} - {sortOrder === 'asc' ? '▲' : '▼'} - {:else} - - {/if} + setSortKey('created_at')} + > + {$i18n.t('Created at')} + {#if sortKey === 'created_at'} + {sortOrder === 'asc' ? '▲' : '▼'} + {:else} + + {/if} @@ -213,7 +233,8 @@ const query = search.toLowerCase(); return name.includes(query); } - }).sort((a, b) => { + }) + .sort((a, b) => { if (a[sortKey] < b[sortKey]) return sortOrder === 'asc' ? -1 : 1; if (a[sortKey] > b[sortKey]) return sortOrder === 'asc' ? 1 : -1; return 0;