fix(ui): resolve owner avatars against the API base url and add a fallback (#28272)

This commit is contained in:
G30
2026-08-11 13:05:35 -04:00
committed by GitHub
parent 29541cbb52
commit 25455e943d
2 changed files with 14 additions and 2 deletions
@@ -11,6 +11,7 @@
import dayjs from 'dayjs';
import localizedFormat from 'dayjs/plugin/localizedFormat';
import { getTimeRange } from '$lib/utils';
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
import ChevronUp from '$lib/components/icons/ChevronUp.svelte';
import ChevronDown from '$lib/components/icons/ChevronDown.svelte';
import ChevronLeft from '$lib/components/icons/ChevronLeft.svelte';
@@ -240,9 +241,14 @@
{#if showOwnerInfo && chat.user_id && chat.owner_name}
<Tooltip content={chat.owner_name}>
<img
src="/api/v1/users/{chat.user_id}/profile/image"
src="{WEBUI_API_BASE_URL}/users/{chat.user_id}/profile/image"
alt=""
class="size-4 rounded-full shrink-0 object-cover"
on:error={(e) => {
if (!e.currentTarget.src.endsWith('/static/favicon.png')) {
e.currentTarget.src = `${WEBUI_BASE_URL}/static/favicon.png`;
}
}}
/>
</Tooltip>
{/if}
@@ -16,6 +16,7 @@
<script lang="ts">
import { toast } from 'svelte-sonner';
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
import { goto, invalidate, invalidateAll } from '$app/navigation';
import { onMount, getContext, createEventDispatcher, tick } from 'svelte';
import { LinkPreview } from 'bits-ui';
@@ -508,9 +509,14 @@
{#if ownerUserId}
<Tooltip content={ownerName || 'Unknown'}>
<img
src="/api/v1/users/{ownerUserId}/profile/image"
src="{WEBUI_API_BASE_URL}/users/{ownerUserId}/profile/image"
alt=""
class="size-3.5 rounded-full shrink-0 object-cover mr-1.5"
on:error={(e) => {
if (!e.currentTarget.src.endsWith('/static/favicon.png')) {
e.currentTarget.src = `${WEBUI_BASE_URL}/static/favicon.png`;
}
}}
/>
</Tooltip>
{/if}