From 20657bb3da91b9769c19278c833786043786497d Mon Sep 17 00:00:00 2001 From: NamH Date: Mon, 15 Apr 2024 21:52:22 +0700 Subject: [PATCH 01/21] fix: cannot cancel model which is progress at 0 percent (#2727) Signed-off-by: James Co-authored-by: James --- core/src/node/api/processors/download.ts | 13 ++++++++----- core/src/node/helper/download.ts | 4 ++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/core/src/node/api/processors/download.ts b/core/src/node/api/processors/download.ts index 98464dd52..d26e46d59 100644 --- a/core/src/node/api/processors/download.ts +++ b/core/src/node/api/processors/download.ts @@ -66,6 +66,7 @@ export class Downloader implements Processor { localPath: normalizedPath, } DownloadManager.instance.downloadProgressMap[modelId] = initialDownloadState + DownloadManager.instance.downloadInfo[normalizedPath] = initialDownloadState if (downloadRequest.downloadType === 'extension') { observer?.(DownloadEvent.onFileDownloadUpdate, initialDownloadState) @@ -118,12 +119,14 @@ export class Downloader implements Processor { if (rq) { DownloadManager.instance.networkRequests[fileName] = undefined rq?.abort() - } else { - observer?.(DownloadEvent.onFileDownloadError, { - fileName, - error: 'aborted', - }) } + + const downloadInfo = DownloadManager.instance.downloadInfo[fileName] + observer?.(DownloadEvent.onFileDownloadError, { + ...downloadInfo, + fileName, + error: 'aborted', + }) } resumeDownload(observer: any, fileName: any) { diff --git a/core/src/node/helper/download.ts b/core/src/node/helper/download.ts index b9fb88bb5..b7560d100 100644 --- a/core/src/node/helper/download.ts +++ b/core/src/node/helper/download.ts @@ -8,8 +8,12 @@ export class DownloadManager { public static instance: DownloadManager = new DownloadManager() + // store the download information with key is model id public downloadProgressMap: Record = {} + // store the download infomation with key is normalized file path + public downloadInfo: Record = {} + constructor() { if (DownloadManager.instance) { return DownloadManager.instance From 49401bd8eb9d463f8a6dd06d71eaf618ee92731d Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Mon, 15 Apr 2024 21:52:36 +0700 Subject: [PATCH 02/21] fix: broken several ui when model name too long (#2728) --- web/containers/DropdownListSidebar/index.tsx | 51 +++---- .../SystemMonitor/TableActiveModel/index.tsx | 22 ++- web/screens/Settings/Advanced/index.tsx | 129 +++++++++--------- web/screens/Settings/Models/Row.tsx | 16 ++- 4 files changed, 120 insertions(+), 98 deletions(-) diff --git a/web/containers/DropdownListSidebar/index.tsx b/web/containers/DropdownListSidebar/index.tsx index 361ae658c..892535717 100644 --- a/web/containers/DropdownListSidebar/index.tsx +++ b/web/containers/DropdownListSidebar/index.tsx @@ -266,12 +266,36 @@ const DropdownListSidebar = ({ value={x.id} className={twMerge( x.id === selectedModel?.id && 'bg-secondary', - 'my-0 pb-8 pt-4' + 'my-0 py-2' )} > -
- {x.name} -
+
+
+

{x.name}

+
+

{x.id}

+ {clipboard.copied && copyId === x.id ? ( + + ) : ( + { + clipboard.copy(x.id) + setCopyId(x.id) + }} + /> + )} +
+
+
{toGibibytes(x.metadata.size)} @@ -281,25 +305,6 @@ const DropdownListSidebar = ({
-
- {x.id} - {clipboard.copied && copyId === x.id ? ( - - ) : ( - { - clipboard.copy(x.id) - setCopyId(x.id) - }} - /> - )} -
)) )} diff --git a/web/containers/Layout/BottomBar/SystemMonitor/TableActiveModel/index.tsx b/web/containers/Layout/BottomBar/SystemMonitor/TableActiveModel/index.tsx index 8bcccdba2..afdb553f4 100644 --- a/web/containers/Layout/BottomBar/SystemMonitor/TableActiveModel/index.tsx +++ b/web/containers/Layout/BottomBar/SystemMonitor/TableActiveModel/index.tsx @@ -34,7 +34,7 @@ const TableActiveModel = () => { return ( {col} @@ -46,17 +46,27 @@ const TableActiveModel = () => { - {activeModel.name} - {activeModel.id} - + +

{activeModel.name}

+ + +

{activeModel.id}

+ + {toGibibytes(activeModel.metadata.size)} - + v{activeModel.version} - +
{/* CPU / GPU switching */} - {!isMac && ( + {isMac && (
@@ -223,73 +223,76 @@ const Advanced = () => { for further assistance.

- {gpuList.length > 0 && !gpuEnabled && ( + +
+ {gpuList.length > 0 && !gpuEnabled && ( + + + + + + + Disabling NVIDIA GPU Acceleration may result in reduced + performance. It is recommended to keep this enabled for + optimal user experience. + + + + + )} + - { + if (e === true) { + saveSettings({ runMode: 'gpu' }) + setGpuEnabled(true) + snackbar({ + description: + 'Successfully turned on GPU Acceleration', + type: 'success', + }) + } else { + saveSettings({ runMode: 'cpu' }) + setGpuEnabled(false) + snackbar({ + description: + 'Successfully turned off GPU Acceleration', + type: 'success', + }) + } + // Stop any running model to apply the changes + if (e !== gpuEnabled) stopModel() + }} /> - - - Disabling NVIDIA GPU Acceleration may result in reduced - performance. It is recommended to keep this enabled for - optimal user experience. - - - + {gpuList.length === 0 && ( + + + Your current device does not have a compatible GPU for + monitoring. To enable GPU monitoring, please ensure your + device has a supported Nvidia or AMD GPU with updated + drivers. + + + + )} - )} - - - - { - if (e === true) { - saveSettings({ runMode: 'gpu' }) - setGpuEnabled(true) - snackbar({ - description: - 'Successfully turned on GPU Acceleration', - type: 'success', - }) - } else { - saveSettings({ runMode: 'cpu' }) - setGpuEnabled(false) - snackbar({ - description: - 'Successfully turned off GPU Acceleration', - type: 'success', - }) - } - // Stop any running model to apply the changes - if (e !== gpuEnabled) stopModel() - }} - /> - - {gpuList.length === 0 && ( - - - Your current device does not have a compatible GPU for - monitoring. To enable GPU monitoring, please ensure your - device has a supported Nvidia or AMD GPU with updated - drivers. - - - - )} - +