From ae97a96379ed85d14e2b70cbd5ede233f1178534 Mon Sep 17 00:00:00 2001 From: Anuraag Jain Date: Sun, 18 Feb 2024 21:29:47 +0200 Subject: [PATCH 01/86] WIP feat: cancel model download --- .../components/chat/Settings/Models.svelte | 44 +++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/src/lib/components/chat/Settings/Models.svelte b/src/lib/components/chat/Settings/Models.svelte index aafa333f..cb557b55 100644 --- a/src/lib/components/chat/Settings/Models.svelte +++ b/src/lib/components/chat/Settings/Models.svelte @@ -52,15 +52,17 @@ // Remove the downloaded model delete modelDownloadStatus[modelName]; - console.log(data); + modelDownloadStatus = {...modelDownloadStatus} + + console.log('Cleaned:',modelDownloadStatus); if (!data.success) { toast.error(data.error); } else { - toast.success(`Model '${modelName}' has been successfully downloaded.`); + toast.success(`Model '${sanitizedModelTag}' has been successfully downloaded.`); const notification = new Notification(WEBUI_NAME, { - body: `Model '${modelName}' has been successfully downloaded.`, + body: `Model '${sanitizedModelTag}' has been successfully downloaded.`, icon: '/favicon.png' }); @@ -266,6 +268,7 @@ downloadProgress = 100; } modelDownloadStatus[opts.modelName] = { + reader, pullProgress: downloadProgress, digest: data.digest }; @@ -286,6 +289,15 @@ opts.callback({ success: true, modelName: opts.modelName }); } }; + const deleteModelPull = async(model: string) => { + const {reader} = modelDownloadStatus[model]; + if(reader){ + await reader.cancel(); + toast.success(`${model} download has been canceled`); + delete modelDownloadStatus[model]; + } + + }
@@ -364,12 +376,36 @@
{model}
-
+
{modelDownloadStatus[model].pullProgress ?? 0}% +
+ + +
+
{modelDownloadStatus[model].digest}
From 04e3b168a604d6e327b11a8310e4f1b8f38d1279 Mon Sep 17 00:00:00 2001 From: changchiyou Date: Wed, 13 Mar 2024 23:17:22 +0800 Subject: [PATCH 02/86] config: allow custom default user permissions - chat deletion Allow Chat Deletion --- backend/config.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/config.py b/backend/config.py index 831371bb..281aea2a 100644 --- a/backend/config.py +++ b/backend/config.py @@ -288,7 +288,9 @@ DEFAULT_PROMPT_SUGGESTIONS = ( DEFAULT_USER_ROLE = os.getenv("DEFAULT_USER_ROLE", "pending") -USER_PERMISSIONS = {"chat": {"deletion": True}} + +USER_PERMISSIONS_CHAT_DELETION = os.getenv('USER_PERMISSIONS_CHAT_DELETION', 'True') == 'True' +USER_PERMISSIONS = {"chat": {"deletion": USER_PERMISSIONS_CHAT_DELETION}} MODEL_FILTER_ENABLED = os.environ.get("MODEL_FILTER_ENABLED", False) From c6e14ce3272833ef139f2abcf8fdac70cdcc762c Mon Sep 17 00:00:00 2001 From: changchiyou Date: Thu, 14 Mar 2024 00:01:46 +0800 Subject: [PATCH 03/86] refactor: restrict the scope of `USER_PERMISSIONS_CHAT_DELETION` it can easily confuse people before becuase when people accidentally set `env.USER_PERMISSIONS_CHAT_DELETION` to `true/yes/Yes`, `USER_PERMISSIONS["chat"]["deletion"]` would become `False`, which is unexpectedly and hard to notice. --- backend/config.py | 8 ++++++-- backend/constants.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/backend/config.py b/backend/config.py index 281aea2a..feb65305 100644 --- a/backend/config.py +++ b/backend/config.py @@ -289,8 +289,12 @@ DEFAULT_PROMPT_SUGGESTIONS = ( DEFAULT_USER_ROLE = os.getenv("DEFAULT_USER_ROLE", "pending") -USER_PERMISSIONS_CHAT_DELETION = os.getenv('USER_PERMISSIONS_CHAT_DELETION', 'True') == 'True' -USER_PERMISSIONS = {"chat": {"deletion": USER_PERMISSIONS_CHAT_DELETION}} +USER_PERMISSIONS_CHAT_DELETION = os.getenv('USER_PERMISSIONS_CHAT_DELETION', 'True') + +if USER_PERMISSIONS_CHAT_DELETION not in ('True', 'False'): + raise ValueError(ERROR_MESSAGES.INCORRECT_FORMAT(" (e.g., True/False).")) + +USER_PERMISSIONS = {"chat": {"deletion": USER_PERMISSIONS_CHAT_DELETION == 'True'}} MODEL_FILTER_ENABLED = os.environ.get("MODEL_FILTER_ENABLED", False) diff --git a/backend/constants.py b/backend/constants.py index eacf8a20..55e0bcce 100644 --- a/backend/constants.py +++ b/backend/constants.py @@ -46,7 +46,7 @@ class ERROR_MESSAGES(str, Enum): PANDOC_NOT_INSTALLED = "Pandoc is not installed on the server. Please contact your administrator for assistance." INCORRECT_FORMAT = ( - lambda err="": f"Invalid format. Please use the correct format{err if err else ''}" + lambda err="": f"Invalid format. Please use the correct format{err}" ) RATE_LIMIT_EXCEEDED = "API rate limit exceeded" From bc5d322cbb6917c0293fb8f73d773e5e6ed08ce1 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Mon, 18 Mar 2024 17:03:08 -0700 Subject: [PATCH 04/86] fix: add doc modal styling --- src/lib/components/documents/AddDocModal.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/components/documents/AddDocModal.svelte b/src/lib/components/documents/AddDocModal.svelte index 3b64f6fc..22ea7b1c 100644 --- a/src/lib/components/documents/AddDocModal.svelte +++ b/src/lib/components/documents/AddDocModal.svelte @@ -138,7 +138,7 @@ />