mirror of
https://github.com/open-webui/open-webui
synced 2025-06-04 03:37:35 +00:00
refac
This commit is contained in:
parent
056f24dc57
commit
ccbf5a08f3
@ -1,11 +1,21 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { settings } from '$lib/stores';
|
import { WEBUI_BASE_URL } from '$lib/constants';
|
||||||
import ProfileImageBase from './ProfileImageBase.svelte';
|
|
||||||
|
|
||||||
export let className = 'size-8';
|
export let className = 'size-8';
|
||||||
export let src = '';
|
export let src = `${WEBUI_BASE_URL}/static/favicon.png`;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class={`flex-shrink-0 ${($settings?.chatDirection ?? 'LTR') === 'LTR' ? 'mr-3' : 'ml-3'}`}>
|
<img
|
||||||
<ProfileImageBase {src} {className} />
|
crossorigin="anonymous"
|
||||||
</div>
|
src={src === ''
|
||||||
|
? `${WEBUI_BASE_URL}/static/favicon.png`
|
||||||
|
: src.startsWith(WEBUI_BASE_URL) ||
|
||||||
|
src.startsWith('https://www.gravatar.com/avatar/') ||
|
||||||
|
src.startsWith('data:') ||
|
||||||
|
src.startsWith('/')
|
||||||
|
? src
|
||||||
|
: `/user.png`}
|
||||||
|
class=" {className} object-cover rounded-full -translate-y-[1px]"
|
||||||
|
alt="profile"
|
||||||
|
draggable="false"
|
||||||
|
/>
|
||||||
|
@ -1,21 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { WEBUI_BASE_URL } from '$lib/constants';
|
|
||||||
|
|
||||||
export let className = 'size-8';
|
|
||||||
export let src = `${WEBUI_BASE_URL}/static/favicon.png`;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<img
|
|
||||||
crossorigin="anonymous"
|
|
||||||
src={src === ''
|
|
||||||
? `${WEBUI_BASE_URL}/static/favicon.png`
|
|
||||||
: src.startsWith(WEBUI_BASE_URL) ||
|
|
||||||
src.startsWith('https://www.gravatar.com/avatar/') ||
|
|
||||||
src.startsWith('data:') ||
|
|
||||||
src.startsWith('/')
|
|
||||||
? src
|
|
||||||
: `/user.png`}
|
|
||||||
class=" {className} object-cover rounded-full -translate-y-[1px]"
|
|
||||||
alt="profile"
|
|
||||||
draggable="false"
|
|
||||||
/>
|
|
@ -477,10 +477,13 @@
|
|||||||
id="message-{message.id}"
|
id="message-{message.id}"
|
||||||
dir={$settings.chatDirection}
|
dir={$settings.chatDirection}
|
||||||
>
|
>
|
||||||
<ProfileImage
|
<div class={`flex-shrink-0 ${($settings?.chatDirection ?? 'LTR') === 'LTR' ? 'mr-3' : 'ml-3'}`}>
|
||||||
src={model?.info?.meta?.profile_image_url ??
|
<ProfileImage
|
||||||
($i18n.language === 'dg-DG' ? `/doge.png` : `${WEBUI_BASE_URL}/static/favicon.png`)}
|
src={model?.info?.meta?.profile_image_url ??
|
||||||
/>
|
($i18n.language === 'dg-DG' ? `/doge.png` : `${WEBUI_BASE_URL}/static/favicon.png`)}
|
||||||
|
className={'size-8'}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="flex-auto w-0 pl-1">
|
<div class="flex-auto w-0 pl-1">
|
||||||
<Name>
|
<Name>
|
||||||
|
@ -88,11 +88,15 @@
|
|||||||
|
|
||||||
<div class=" flex w-full user-message" dir={$settings.chatDirection} id="message-{message.id}">
|
<div class=" flex w-full user-message" dir={$settings.chatDirection} id="message-{message.id}">
|
||||||
{#if !($settings?.chatBubble ?? true)}
|
{#if !($settings?.chatBubble ?? true)}
|
||||||
<ProfileImage
|
<div class={`flex-shrink-0 ${($settings?.chatDirection ?? 'LTR') === 'LTR' ? 'mr-3' : 'ml-3'}`}>
|
||||||
src={message.user
|
<ProfileImage
|
||||||
? ($models.find((m) => m.id === message.user)?.info?.meta?.profile_image_url ?? '/user.png')
|
src={message.user
|
||||||
: (user?.profile_image_url ?? '/user.png')}
|
? ($models.find((m) => m.id === message.user)?.info?.meta?.profile_image_url ??
|
||||||
/>
|
'/user.png')
|
||||||
|
: (user?.profile_image_url ?? '/user.png')}
|
||||||
|
className={'size-8'}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="flex-auto w-0 max-w-full pl-1">
|
<div class="flex-auto w-0 max-w-full pl-1">
|
||||||
{#if !($settings?.chatBubble ?? true)}
|
{#if !($settings?.chatBubble ?? true)}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
import { WEBUI_BASE_URL } from '$lib/constants';
|
import { WEBUI_BASE_URL } from '$lib/constants';
|
||||||
import { Handle, Position, type NodeProps } from '@xyflow/svelte';
|
import { Handle, Position, type NodeProps } from '@xyflow/svelte';
|
||||||
|
|
||||||
import ProfileImageBase from '../Messages/ProfileImageBase.svelte';
|
import ProfileImage from '../Messages/ProfileImage.svelte';
|
||||||
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
import Tooltip from '$lib/components/common/Tooltip.svelte';
|
||||||
import Heart from '$lib/components/icons/Heart.svelte';
|
import Heart from '$lib/components/icons/Heart.svelte';
|
||||||
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
>
|
>
|
||||||
{#if data.message.role === 'user'}
|
{#if data.message.role === 'user'}
|
||||||
<div class="flex w-full">
|
<div class="flex w-full">
|
||||||
<ProfileImageBase
|
<ProfileImage
|
||||||
src={data.user?.profile_image_url ?? '/user.png'}
|
src={data.user?.profile_image_url ?? '/user.png'}
|
||||||
className={'size-5 -translate-y-[1px]'}
|
className={'size-5 -translate-y-[1px]'}
|
||||||
/>
|
/>
|
||||||
@ -40,7 +40,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="flex w-full">
|
<div class="flex w-full">
|
||||||
<ProfileImageBase
|
<ProfileImage
|
||||||
src={data?.model?.info?.meta?.profile_image_url ?? ''}
|
src={data?.model?.info?.meta?.profile_image_url ?? ''}
|
||||||
className={'size-5 -translate-y-[1px]'}
|
className={'size-5 -translate-y-[1px]'}
|
||||||
/>
|
/>
|
||||||
|
Loading…
Reference in New Issue
Block a user