refac: profile_image_url optimization

This commit is contained in:
Timothy Jaeryang Baek
2025-11-20 20:43:59 -05:00
parent cd30152c83
commit 6442871947
28 changed files with 56 additions and 97 deletions
@@ -171,8 +171,7 @@
</div>
{:else if item.type === 'model'}
<img
src={item?.data?.info?.meta?.profile_image_url ??
`${WEBUI_BASE_URL}/static/favicon.png`}
src={`${WEBUI_API_BASE_URL}/models/model/profile/image?id=${item.id}&lang=${$i18n.language}`}
alt={item?.data?.name ?? item.id}
class="rounded-full size-5 items-center mr-2"
/>
@@ -185,8 +185,7 @@
/>
{:else}
<img
src={message.reply_to_message.user?.profile_image_url ??
`${WEBUI_BASE_URL}/static/favicon.png`}
src={`${WEBUI_API_BASE_URL}/users/${message.reply_to_message.user?.id}/profile/image`}
alt={message.reply_to_message.user?.name ?? $i18n.t('Unknown User')}
class="size-4 ml-0.5 rounded-full object-cover"
/>
@@ -220,7 +219,7 @@
{:else}
<ProfilePreview user={message.user}>
<ProfileImage
src={message.user?.profile_image_url ?? `${WEBUI_BASE_URL}/static/favicon.png`}
src={`${WEBUI_API_BASE_URL}/users/${message.user.id}/profile/image`}
className={'size-8 ml-0.5'}
/>
</ProfilePreview>
@@ -2,7 +2,7 @@
import { getContext, onMount } from 'svelte';
const i18n = getContext('i18n');
import { WEBUI_BASE_URL } from '$lib/constants';
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
export let user = null;
</script>
@@ -11,8 +11,7 @@
<div class=" flex gap-3.5 w-full py-3 px-3 items-center">
<div class=" items-center flex shrink-0">
<img
crossorigin="anonymous"
src={user?.profile_image_url ?? `${WEBUI_BASE_URL}/static/favicon.png`}
src={`${WEBUI_API_BASE_URL}/users/${user?.id}/profile/image`}
class=" size-12 object-cover rounded-xl"
alt="profile"
/>
+2 -1
View File
@@ -11,6 +11,7 @@
import PencilSquare from '../icons/PencilSquare.svelte';
import Tooltip from '../common/Tooltip.svelte';
import Sidebar from '../icons/Sidebar.svelte';
import { WEBUI_API_BASE_URL } from '$lib/constants';
const i18n = getContext('i18n');
@@ -80,7 +81,7 @@
>
<div class=" self-center">
<img
src={$user?.profile_image_url}
src={`${WEBUI_API_BASE_URL}/users/${$user?.id}/profile/image`}
class="size-6 object-cover rounded-full"
alt="User profile"
draggable="false"