mirror of
https://github.com/open-webui/computer.git
synced 2026-12-04 10:37:57 -05:00
refac
This commit is contained in:
1 parent
b453559389
commit
1126819b73
2 files changed
+25
-10
No files matched your search
@@ -308,7 +308,8 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Automations -->
|
||||
<!-- Automations (only when chat/LLM backend is available) -->
|
||||
{#if $chatEnabled}
|
||||
<div class="px-1.5 mt-1 shrink-0">
|
||||
<a
|
||||
href="/automations"
|
||||
@@ -323,6 +324,7 @@
|
||||
<span class="flex-1 text-left overflow-hidden text-ellipsis whitespace-nowrap">Automations</span>
|
||||
</a>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
<!-- Workspace section header -->
|
||||
<div class="flex items-center justify-between h-8 pl-3.5 pr-1.5 shrink-0">
|
||||
|
||||
@@ -294,6 +294,8 @@
|
||||
|
||||
// ── Socket listener ─────────────────────────────────────────
|
||||
|
||||
let landingRefreshTimer: ReturnType<typeof setTimeout> | null = null;
|
||||
|
||||
function handleSocketEvent(data: {
|
||||
chat_id: string;
|
||||
message_id: string;
|
||||
@@ -305,15 +307,25 @@
|
||||
}) {
|
||||
// On the landing page, update the chat list in place from socket events
|
||||
if (isLanding) {
|
||||
if (data.done) {
|
||||
previousChats = previousChats.map((c) =>
|
||||
c.id === data.chat_id ? { ...c, is_active: false } : c
|
||||
);
|
||||
}
|
||||
if (data.title) {
|
||||
previousChats = previousChats.map((c) =>
|
||||
c.id === data.chat_id ? { ...c, title: data.title! } : c
|
||||
);
|
||||
const knownChat = previousChats.some((c) => c.id === data.chat_id);
|
||||
if (!knownChat) {
|
||||
// New chat created elsewhere — debounce-reload the list
|
||||
if (landingRefreshTimer) clearTimeout(landingRefreshTimer);
|
||||
landingRefreshTimer = setTimeout(() => {
|
||||
landingRefreshTimer = null;
|
||||
loadPreviousChats(chatPage);
|
||||
}, 300);
|
||||
} else {
|
||||
if (data.done) {
|
||||
previousChats = previousChats.map((c) =>
|
||||
c.id === data.chat_id ? { ...c, is_active: false } : c
|
||||
);
|
||||
}
|
||||
if (data.title) {
|
||||
previousChats = previousChats.map((c) =>
|
||||
c.id === data.chat_id ? { ...c, title: data.title! } : c
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -419,6 +431,7 @@
|
||||
socket.off('events:chat', handleSocketEvent);
|
||||
socket.off('connect', handleReconnect);
|
||||
}
|
||||
if (landingRefreshTimer) clearTimeout(landingRefreshTimer);
|
||||
// Don't clear streamingChatTabs here -- the global listener in
|
||||
// chat.ts handles cleanup when the "done" event arrives, so the
|
||||
// spinner persists even when the chat tab is not active.
|
||||
|
||||
Reference in new issue
Block a user