Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Finalize desktop Ensu Packs support

setalpf0f1c4096db8
diff --git a/rust/apps/ensu/changes/ensu-packs-desktop.md b/rust/apps/ensu/changes/ensu-packs-desktop.md
new file mode 100644
index 0000000000..a09d4f7f72
--- /dev/null
+++ b/rust/apps/ensu/changes/ensu-packs-desktop.md
@@ -0,0 +1 @@
+- Ensu packs support on desktop
diff --git a/web/apps/ensu/src/pages/chat.tsx b/web/apps/ensu/src/pages/chat.tsx
index f10f3bdd63..43e58c5052 100644
--- a/web/apps/ensu/src/pages/chat.tsx
+++ b/web/apps/ensu/src/pages/chat.tsx
@@ -689,6 +689,7 @@ const Page: React.FC = () => {
const providerRef = useRef<LlmProvider | null>(null);
const currentJobIdRef = useRef<number | null>(null);
const activeKnowledgeCitationsRef = useRef<SourceCitation[]>([]);
+ const activeKnowledgeDownloadsRef = useRef(new Set<string>());
const knowledgeCatalogPromiseRef = useRef<Promise<KnowledgePack[]> | null>(
null,
);
@@ -3607,6 +3608,9 @@ const Page: React.FC = () => {
);
const handleDownloadKnowledgePack = useCallback(
(stableId: string) => {
+ if (activeKnowledgeDownloadsRef.current.has(stableId)) return;
+ activeKnowledgeDownloadsRef.current.add(stableId);
+
const previousPack = knowledgePacks.find(
(pack) => pack.stableId === stableId,
);
@@ -3652,6 +3656,7 @@ const Page: React.FC = () => {
void refreshKnowledgeCatalog();
})
.finally(() => {
+ activeKnowledgeDownloadsRef.current.delete(stableId);
setKnowledgeDownloadProgress((current) => ({
...current,
[stableId]: undefined,