diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 1e797d2928..b7f0799652 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -63,13 +63,20 @@ } from '$lib/utils/connections'; import { WEBUI_API_BASE_URL, WEBUI_BASE_URL, WEBUI_HOSTNAME } from '$lib/constants'; - import { bestMatchingLanguage, displayFileHandler, getUserTimezone } from '$lib/utils'; + import { + bestMatchingLanguage, + cleanText, + displayFileHandler, + getUserTimezone, + removeAllDetails + } from '$lib/utils'; import { setTextScale } from '$lib/utils/text-scale'; import NotificationToast from '$lib/components/NotificationToast.svelte'; import AppSidebar from '$lib/components/app/AppSidebar.svelte'; import SyncStatsModal from '$lib/components/chat/Settings/SyncStatsModal.svelte'; import Spinner from '$lib/components/common/Spinner.svelte'; + import { getOutputText } from '$lib/components/chat/Messages/structuredOutput'; import { getUserSettings } from '$lib/apis/users'; import dayjs from 'dayjs'; import { getChannels } from '$lib/apis/channels'; @@ -611,8 +618,9 @@ if ((event.chat_id !== $chatId && !$temporaryChatEnabled) || isInBackground) { if (type === 'chat:completion') { - const { done, content, title } = data; + const { done, content, output, title } = data; const displayTitle = title || $i18n.t('New Chat'); + const contentPreview = cleanText(removeAllDetails(getOutputText(output) || content || '')); if (done) { if ( @@ -631,7 +639,7 @@ if ($isLastActiveTab) { if ($settings?.notificationEnabled ?? false) { new Notification(`${displayTitle} • Open WebUI`, { - body: content, + body: contentPreview, icon: `${WEBUI_BASE_URL}/static/favicon.png` }); } @@ -642,7 +650,7 @@ onClick: () => { goto(`/c/${event.chat_id}`); }, - content: content, + content: contentPreview, title: displayTitle }, duration: 15000,