mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-23 09:10:55 -05:00
refac
This commit is contained in:
@@ -63,13 +63,20 @@
|
|||||||
} from '$lib/utils/connections';
|
} from '$lib/utils/connections';
|
||||||
|
|
||||||
import { WEBUI_API_BASE_URL, WEBUI_BASE_URL, WEBUI_HOSTNAME } from '$lib/constants';
|
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 { setTextScale } from '$lib/utils/text-scale';
|
||||||
|
|
||||||
import NotificationToast from '$lib/components/NotificationToast.svelte';
|
import NotificationToast from '$lib/components/NotificationToast.svelte';
|
||||||
import AppSidebar from '$lib/components/app/AppSidebar.svelte';
|
import AppSidebar from '$lib/components/app/AppSidebar.svelte';
|
||||||
import SyncStatsModal from '$lib/components/chat/Settings/SyncStatsModal.svelte';
|
import SyncStatsModal from '$lib/components/chat/Settings/SyncStatsModal.svelte';
|
||||||
import Spinner from '$lib/components/common/Spinner.svelte';
|
import Spinner from '$lib/components/common/Spinner.svelte';
|
||||||
|
import { getOutputText } from '$lib/components/chat/Messages/structuredOutput';
|
||||||
import { getUserSettings } from '$lib/apis/users';
|
import { getUserSettings } from '$lib/apis/users';
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { getChannels } from '$lib/apis/channels';
|
import { getChannels } from '$lib/apis/channels';
|
||||||
@@ -611,8 +618,9 @@
|
|||||||
|
|
||||||
if ((event.chat_id !== $chatId && !$temporaryChatEnabled) || isInBackground) {
|
if ((event.chat_id !== $chatId && !$temporaryChatEnabled) || isInBackground) {
|
||||||
if (type === 'chat:completion') {
|
if (type === 'chat:completion') {
|
||||||
const { done, content, title } = data;
|
const { done, content, output, title } = data;
|
||||||
const displayTitle = title || $i18n.t('New Chat');
|
const displayTitle = title || $i18n.t('New Chat');
|
||||||
|
const contentPreview = cleanText(removeAllDetails(getOutputText(output) || content || ''));
|
||||||
|
|
||||||
if (done) {
|
if (done) {
|
||||||
if (
|
if (
|
||||||
@@ -631,7 +639,7 @@
|
|||||||
if ($isLastActiveTab) {
|
if ($isLastActiveTab) {
|
||||||
if ($settings?.notificationEnabled ?? false) {
|
if ($settings?.notificationEnabled ?? false) {
|
||||||
new Notification(`${displayTitle} • Open WebUI`, {
|
new Notification(`${displayTitle} • Open WebUI`, {
|
||||||
body: content,
|
body: contentPreview,
|
||||||
icon: `${WEBUI_BASE_URL}/static/favicon.png`
|
icon: `${WEBUI_BASE_URL}/static/favicon.png`
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -642,7 +650,7 @@
|
|||||||
onClick: () => {
|
onClick: () => {
|
||||||
goto(`/c/${event.chat_id}`);
|
goto(`/c/${event.chat_id}`);
|
||||||
},
|
},
|
||||||
content: content,
|
content: contentPreview,
|
||||||
title: displayTitle
|
title: displayTitle
|
||||||
},
|
},
|
||||||
duration: 15000,
|
duration: 15000,
|
||||||
|
|||||||
Reference in New Issue
Block a user