mirror of
https://github.com/open-webui/open-webui.git
synced 2026-11-22 21:50:42 -05:00
refac
This commit is contained in:
1 parent
6238d5456b
commit
03d8d3e353
3 files changed
+23
-13
No files matched your search
@@ -4505,13 +4505,16 @@
|
||||
const currentHistory = history;
|
||||
processing = 'uploading';
|
||||
try {
|
||||
if (files.some((file) => file.status === 'pending' && file.file instanceof File)) {
|
||||
const _chatId = await getChatId(currentHistory);
|
||||
if (_chatId === null) return { status: 'rejected' };
|
||||
if (history !== currentHistory) return { status: 'rejected' };
|
||||
if (!(await messageInput?.uploadPendingFiles(_chatId || (await initChatHandler(history)))))
|
||||
return { status: 'rejected' };
|
||||
}
|
||||
// Set up the chat before the message is posted and the input cleared, so a refusal
|
||||
// (e.g. a missing working directory) leaves the draft in place.
|
||||
const _chatId = await getChatId(currentHistory);
|
||||
if (_chatId === null) return { status: 'rejected' };
|
||||
if (history !== currentHistory) return { status: 'rejected' };
|
||||
if (
|
||||
files.some((file) => file.status === 'pending' && file.file instanceof File) &&
|
||||
!(await messageInput?.uploadPendingFiles(_chatId || (await initChatHandler(history))))
|
||||
)
|
||||
return { status: 'rejected' };
|
||||
if (history !== currentHistory) return { status: 'rejected' };
|
||||
} catch (error) {
|
||||
toast.error(`${error}`);
|
||||
@@ -5857,6 +5860,7 @@
|
||||
class:hidden={fullWidthTabs && !mainChatActive}
|
||||
style={fullWidthTabs ? mainChatStyle : undefined}
|
||||
data-main-chat-pane
|
||||
data-chat-id={$chatId}
|
||||
data-panel-group={fullWidthTabs ? mainChatGroupId : undefined}
|
||||
on:focusin={() => fullWidthTabs && tabs?.focusMainChat()}
|
||||
on:pointerdown={() => fullWidthTabs && tabs?.focusMainChat()}
|
||||
|
||||
@@ -1667,7 +1667,14 @@
|
||||
}
|
||||
|
||||
beforeNavigate(({ from, to, cancel, willUnload }) => {
|
||||
if (from?.url.pathname === to?.url.pathname) return;
|
||||
if (from?.url.pathname === to?.url.pathname) {
|
||||
// The router stays on the main chat while other tabs are in front; going there uncovers it.
|
||||
if (to && location.pathname !== to.url.pathname) {
|
||||
focusMainChat();
|
||||
if (!isLargeScreen) showTabs.set(false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
captureView();
|
||||
if (viewEntry) void flushChatView(viewEntry);
|
||||
if (willUnload && hasChatViewDrafts()) cancel();
|
||||
|
||||
@@ -541,11 +541,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!event?.internal &&
|
||||
((event.chat_id !== $chatId && !$openEmbeddedChatIds.has(event.chat_id) && !$temporaryChat) ||
|
||||
isInBackground)
|
||||
) {
|
||||
const isVisible = !!document
|
||||
.querySelector(`[data-chat-id="${CSS.escape(event.chat_id)}"]`)
|
||||
?.checkVisibility();
|
||||
if (!event?.internal && ((!isVisible && !$temporaryChat) || isInBackground)) {
|
||||
if (type === 'chat:completion') {
|
||||
const { done, content, output, title } = data;
|
||||
const displayTitle = title || $i18n.t('New Chat');
|
||||
|
||||
Reference in new issue
Block a user