mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-30 17:05:16 -05:00
refac
This commit is contained in:
1 parent
0b1e67c38e
commit
d823ebd96d
9 files changed
+78
-10
No files matched your search
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import ProfileImage from '$lib/components/chat/Messages/ProfileImage.svelte';
|
||||
import { getContext, onMount } from 'svelte';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { getApps, updateAppById, type App } from '$lib/apis/apps';
|
||||
@@ -73,7 +74,13 @@
|
||||
? ''
|
||||
: 'opacity-50'}"
|
||||
>
|
||||
<Grid className="size-4 shrink-0" strokeWidth="1.5" />
|
||||
{#if app.data.manifest.profile_image_url}
|
||||
<ProfileImage
|
||||
src={app.data.manifest.profile_image_url}
|
||||
allowExternal
|
||||
className="size-4 shrink-0 rounded!"
|
||||
/>
|
||||
{:else}<Grid className="size-4 shrink-0" strokeWidth="1.5" />{/if}
|
||||
<span class="truncate"
|
||||
>{app.name}
|
||||
<span class="text-gray-400 dark:text-gray-600">{app.slug}</span></span
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import ProfileImage from '$lib/components/chat/Messages/ProfileImage.svelte';
|
||||
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL } from '$lib/constants';
|
||||
import { WEBUI_NAME, config, user as _user, showSidebar } from '$lib/stores';
|
||||
import { goto } from '$app/navigation';
|
||||
@@ -229,7 +230,13 @@
|
||||
<div
|
||||
class="size-6 rounded-lg bg-gray-100 dark:bg-gray-850 flex items-center justify-center shrink-0"
|
||||
>
|
||||
<Grid className="size-3.5" />
|
||||
{#if app.data.manifest.profile_image_url}
|
||||
<ProfileImage
|
||||
src={app.data.manifest.profile_image_url}
|
||||
allowExternal
|
||||
className="size-6 rounded-lg!"
|
||||
/>
|
||||
{:else}<Grid className="size-3.5" />{/if}
|
||||
</div>
|
||||
<span class="truncate">{app.name}</span>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import ProfileImage from '$lib/components/chat/Messages/ProfileImage.svelte';
|
||||
import { getAbortSignal, getContext, onMount } from 'svelte';
|
||||
const i18n = getContext('i18n');
|
||||
|
||||
@@ -29,7 +30,7 @@
|
||||
let _models = [];
|
||||
let _users = [];
|
||||
let _channels = [];
|
||||
let _apps: { type: string; id: string; label: string }[] = [];
|
||||
let _apps: { type: string; id: string; label: string; profile_image_url?: string | null }[] = [];
|
||||
|
||||
type UserSuggestion = { id: string; name: string };
|
||||
|
||||
@@ -141,7 +142,12 @@
|
||||
.then(([apps, joined]) => {
|
||||
_apps = apps
|
||||
.filter((a) => a.is_active && joined.some((member) => member.id === a.id))
|
||||
.map((a) => ({ type: 'app', id: a.id, label: a.name }));
|
||||
.map((a) => ({
|
||||
type: 'app',
|
||||
id: a.id,
|
||||
label: a.name,
|
||||
profile_image_url: a.data.manifest.profile_image_url
|
||||
}));
|
||||
})
|
||||
.catch(() => {});
|
||||
}
|
||||
@@ -240,7 +246,13 @@
|
||||
{/if}
|
||||
</div>
|
||||
{:else if item.type === 'app'}
|
||||
<Grid className="size-4 mr-2" />
|
||||
{#if item.profile_image_url}
|
||||
<ProfileImage
|
||||
src={item.profile_image_url}
|
||||
allowExternal
|
||||
className="size-5 mr-2 rounded-lg!"
|
||||
/>
|
||||
{:else}<Grid className="size-4 mr-2" />{/if}
|
||||
{:else if item.type === 'model'}
|
||||
<img
|
||||
src={`${WEBUI_API_BASE_URL}/models/model/profile/image?id=${item.id}&lang=${$i18n.language}`}
|
||||
|
||||
@@ -400,7 +400,16 @@
|
||||
e.currentTarget.src = '/favicon.png';
|
||||
}}
|
||||
/>
|
||||
{:else if message.app_id}<span class="flex size-8 items-center justify-center rounded-full bg-gray-100 dark:bg-gray-800 text-xs" aria-label="App">App</span>
|
||||
{:else if message.app_id}
|
||||
{#if message.user?.profile_image_url}
|
||||
<ProfileImage
|
||||
src={message.user.profile_image_url}
|
||||
allowExternal
|
||||
className="size-6 mt-0.5 rounded-lg!"
|
||||
/>
|
||||
{:else}
|
||||
<span class="flex size-6 mt-0.5 items-center justify-center rounded-lg bg-gray-100 dark:bg-gray-800 text-xs" aria-label="App">App</span>
|
||||
{/if}
|
||||
{:else if message.user?.role === 'webhook'}
|
||||
<ProfileImage
|
||||
src={`${WEBUI_API_BASE_URL}/channels/webhooks/${message.user?.id}/profile/image`}
|
||||
|
||||
@@ -9,11 +9,12 @@
|
||||
const FALLBACK_SRC = `${WEBUI_BASE_URL}/static/favicon.png`;
|
||||
|
||||
export let src = FALLBACK_SRC;
|
||||
export let allowExternal = false;
|
||||
</script>
|
||||
|
||||
<img
|
||||
aria-hidden="true"
|
||||
src={safeImageUrl(src)}
|
||||
src={safeImageUrl(src, allowExternal)}
|
||||
class=" {className} object-cover rounded-2xl"
|
||||
alt="profile"
|
||||
draggable="false"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import ProfileImage from '$lib/components/chat/Messages/ProfileImage.svelte';
|
||||
import { toast } from 'svelte-sonner';
|
||||
import { getContext, onMount, onDestroy } from 'svelte';
|
||||
|
||||
@@ -357,7 +358,13 @@
|
||||
<div
|
||||
class="size-6 rounded-lg bg-gray-100 dark:bg-gray-850 flex items-center justify-center shrink-0"
|
||||
>
|
||||
<Grid className="size-3.5" />
|
||||
{#if app.data.manifest.profile_image_url}
|
||||
<ProfileImage
|
||||
src={app.data.manifest.profile_image_url}
|
||||
allowExternal
|
||||
className="size-6 rounded-lg!"
|
||||
/>
|
||||
{:else}<Grid className="size-3.5" />{/if}
|
||||
</div>
|
||||
<span class="truncate">{app.name}</span>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user