Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions apps/desktop/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { Thread } from "@llm-space/core";
import type { EditorCommitScopeHandle } from "@llm-space/ui/components/code-editor/editor-commit-scope";
import { FirecrawlLimitDialog } from "@llm-space/ui/components/firecrawl-limit-dialog";
import {
useModels,
Expand Down Expand Up @@ -299,6 +300,27 @@ function PageWorkspace({
);
}, []);
const tabs = useThreadTabs({ canPruneRestoredTab });
const threadViewCommitHandlesRef = useRef(
new Map<string, EditorCommitScopeHandle>()
);
const commitThreadView = useCallback((paneId: string) => {
threadViewCommitHandlesRef.current.get(paneId)?.commitAll();
}, []);
const commitThreadViews = useCallback(
(closingTabs: AppTab[]) => {
for (const tab of closingTabs) {
if (tab.type === "thread") commitThreadView(tab.paneId);
}
},
[commitThreadView]
);
const handleViewCommitScopeReady = useCallback(
(paneId: string, handle: EditorCommitScopeHandle | null) => {
if (handle) threadViewCommitHandlesRef.current.set(paneId, handle);
else threadViewCommitHandlesRef.current.delete(paneId);
},
[]
);
const { executeCommand } = useCommands();
const models = useModels();
const refreshModels = useRefreshModels();
Expand Down Expand Up @@ -748,6 +770,7 @@ function PageWorkspace({
tabs: tabs.tabs,
targetId: target,
onBlocked: () => showRuntimeRunBlocked("closing this tab"),
commitViews: commitThreadViews,
close,
});
},
Expand All @@ -763,6 +786,7 @@ function PageWorkspace({
keepId: target,
runtimeId: targetRuntimeId,
onBlocked: () => showRuntimeRunBlocked("closing other tabs"),
commitViews: commitThreadViews,
closeOthers: closeOthersInRuntime,
});
},
Expand All @@ -773,6 +797,7 @@ function PageWorkspace({
tabs: tabs.tabs,
runtimeId,
onBlocked: () => showRuntimeRunBlocked("closing all tabs"),
commitViews: commitThreadViews,
closeAll: closeAllInRuntime,
});
},
Expand Down Expand Up @@ -1144,6 +1169,8 @@ function PageWorkspace({
onToggleSidebar={handleToggleSidebar}
lifecycleHost={paneLifecycleHost}
mutationRevision={mutationRevision}
commitThreadView={commitThreadView}
onViewCommitScopeReady={handleViewCommitScopeReady}
onThreadStateChange={handleThreadStateChange}
toolbarSlot={<UpdateIndicator />}
/>
Expand Down
Loading