From 4fa0e3e4d9ffff18412d5a80e43d9c475b8b4e56 Mon Sep 17 00:00:00 2001 From: marijnvg-tng Date: Thu, 28 Nov 2024 17:18:08 +0100 Subject: [PATCH] Made the user imput for adding custom models clearer (restricted to repositories only / no single-files) Signed-off-by: marijnvg-tng --- WebUI/package-lock.json | 110 +++++++++++++++++++++++++- WebUI/package.json | 6 +- WebUI/src/assets/i18n/en-US.json | 7 +- WebUI/src/components/AddLLMDialog.vue | 38 ++++++++- service/model_downloader.py | 1 - 5 files changed, 151 insertions(+), 11 deletions(-) diff --git a/WebUI/package-lock.json b/WebUI/package-lock.json index a3955050..f87ef951 100644 --- a/WebUI/package-lock.json +++ b/WebUI/package-lock.json @@ -370,6 +370,18 @@ "node": ">=6.0.0" } }, + "node_modules/@babel/runtime": { + "version": "7.26.0", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.26.0.tgz", + "integrity": "sha512-FDSOghenHTiToteC/QRlv2q3DhPZ/oOXTBoirfWNx1Cx3TMVcGWQtMMmQcSvb/JjpNeGzx8Pq/b4fKEJuWm1sw==", + "license": "MIT", + "dependencies": { + "regenerator-runtime": "^0.14.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, "node_modules/@babel/standalone": { "version": "7.25.8", "resolved": "https://registry.npmjs.org/@babel/standalone/-/standalone-7.25.8.tgz", @@ -5978,7 +5990,6 @@ "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true, "license": "MIT" }, "node_modules/lodash.defaults": { @@ -7122,6 +7133,17 @@ "node": ">=10.4.0" } }, + "node_modules/popper.js": { + "version": "1.16.1", + "resolved": "https://registry.npmjs.org/popper.js/-/popper.js-1.16.1.tgz", + "integrity": "sha512-Wb4p1J4zyFTbM+u6WuO4XstYx4Ky9Cewe4DWrel7B0w6VVICvPwdOpotjzcf6eD8TsckVnIMNONQyPIUFOUbCQ==", + "deprecated": "You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/popperjs" + } + }, "node_modules/postcss": { "version": "8.4.47", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz", @@ -7272,6 +7294,23 @@ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==" }, + "node_modules/prettier": { + "version": "2.8.8", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", + "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "license": "MIT", + "optional": true, + "peer": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -7532,6 +7571,12 @@ "node": ">=8.10.0" } }, + "node_modules/regenerator-runtime": { + "version": "0.14.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.1.tgz", + "integrity": "sha512-dYnhHh0nJoMfnkZs6GmmhFknAGRrLznOu5nc9ML+EJxGvrx6H7teuevqVqCuPcPK//3eDrrjQhehXVx9cnkGdw==", + "license": "MIT" + }, "node_modules/require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -8047,7 +8092,6 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true, "license": "BSD-3-Clause", "engines": { "node": ">=0.10.0" @@ -8896,6 +8940,68 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, + "node_modules/v-popover": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/v-popover/-/v-popover-0.1.13.tgz", + "integrity": "sha512-B7Knf+06cM7zPjvbRZNVubJ7f6HLPZFOwnc13ATOFAfS3XMnLUztQMtGQzJ7MzJvEvV9vGL7pdrszrpmSf+R3A==", + "license": "MIT", + "dependencies": { + "@floating-ui/dom": "^1.5.3" + }, + "peerDependencies": { + "vue": "^3.2.0" + } + }, + "node_modules/v-tooltip": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/v-tooltip/-/v-tooltip-2.1.3.tgz", + "integrity": "sha512-xXngyxLQTOx/yUEy50thb8te7Qo4XU6h4LZB6cvEfVd9mnysUxLEoYwGWDdqR+l69liKsy3IPkdYff3J1gAJ5w==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.13.10", + "lodash": "^4.17.21", + "popper.js": "^1.16.1", + "vue-resize": "^1.0.1" + } + }, + "node_modules/v-tooltip/node_modules/@vue/compiler-sfc": { + "version": "2.7.16", + "resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-2.7.16.tgz", + "integrity": "sha512-KWhJ9k5nXuNtygPU7+t1rX6baZeqOYLEforUPjgNDBnLicfHCoi48H87Q8XyLZOrNNsmhuwKqtpDQWjEFe6Ekg==", + "peer": true, + "dependencies": { + "@babel/parser": "^7.23.5", + "postcss": "^8.4.14", + "source-map": "^0.6.1" + }, + "optionalDependencies": { + "prettier": "^1.18.2 || ^2.0.0" + } + }, + "node_modules/v-tooltip/node_modules/vue": { + "version": "2.7.16", + "resolved": "https://registry.npmjs.org/vue/-/vue-2.7.16.tgz", + "integrity": "sha512-4gCtFXaAA3zYZdTp5s4Hl2sozuySsgz4jy1EnpBHNfpMa9dK1ZCG7viqBPCwXtmgc8nHqUsAu3G4gtmXkkY3Sw==", + "deprecated": "Vue 2 has reached EOL and is no longer actively maintained. See https://v2.vuejs.org/eol/ for more details.", + "license": "MIT", + "peer": true, + "dependencies": { + "@vue/compiler-sfc": "2.7.16", + "csstype": "^3.1.0" + } + }, + "node_modules/v-tooltip/node_modules/vue-resize": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/vue-resize/-/vue-resize-1.0.1.tgz", + "integrity": "sha512-z5M7lJs0QluJnaoMFTIeGx6dIkYxOwHThlZDeQnWZBizKblb99GSejPnK37ZbNE/rVwDcYcHY+Io+AxdpY952w==", + "license": "MIT", + "dependencies": { + "@babel/runtime": "^7.13.10" + }, + "peerDependencies": { + "vue": "^2.6.0" + } + }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", diff --git a/WebUI/package.json b/WebUI/package.json index cac1a0ac..72bddf72 100644 --- a/WebUI/package.json +++ b/WebUI/package.json @@ -5,20 +5,16 @@ "scripts": { "dev": "cross-env VITE_PLATFORM_TITLE=\"for Local® Dev™ Mode\" vite", "preview": "vite preview", - "fetch-build-resources": "cross-env node ./build/scripts/fetch-python-package-resources.js --target_dir=../build_resources", - "prepare-python-env": "cross-env node ./build/scripts/prepare-python-env.js --build_resources_dir=../build_resources --target_dir=../build-envs/online/env", "install-full-python-env": "cross-env node ./build/scripts/install-full-python-env.js --env_dir=../build-envs/online/env --comfy_ui_dir=../build_resources/ComfyUI", "provide-electron-build-resources": "cross-env node build/scripts/provide-electron-build-resources.js --build_resources_dir=../build_resources --backend_dir=../service --target_dir=./external", - "prepare-build:arc": "cross-env npm run prepare-python-env && npm run provide-electron-build-resources -- --python_env_dir=../build-envs/online/env && node ./build/scripts/render-template.js --online_installer --platform=arc", "prepare-build:arc-offline": "cross-env && npm run prepare-python-env && npm run install-full-python-env -- --platform=arc && npm run provide-electron-build-resources -- --python_env_dir=../build-envs/offline/arc/env && node ./build/scripts/render-template.js --no-online_installer --platform=arc", "prepare-build:ultra": "cross-env npm run prepare-python-env && npm run provide-electron-build-resources -- --python_env_dir=../build-envs/online/env && node ./build/scripts/render-template.js --online_installer --platform=ultra", "prepare-build:ultra-offline": "cross-env npm run prepare-python-env && npm run install-full-python-env -- --platform=ultra && npm run provide-electron-build-resources -- --python_env_dir=../build-envs/offline/ultra/env && node ./build/scripts/render-template.js --no-online_installer --platform=ultra", "prepare-build:ultra2": "cross-env npm run prepare-python-env && npm run provide-electron-build-resources -- --python_env_dir=../build-envs/online/env && node ./build/scripts/render-template.js --online_installer --platform=ultra2", "prepare-build:ultra2-offline": "cross-env npm run prepare-python-env && npm run install-full-python-env -- --platform=ultra2 && npm run provide-electron-build-resources -- --python_env_dir=../build-envs/offline/ultra2/env && node ./build/scripts/render-template.js --no-online_installer --platform=ultra2", - "build:arc": "cross-env-shell PLATFORM=\"arc\" VITE_PLATFORM_TITLE=\"for Intel® Arc™\" \"vue-tsc && vite build && electron-builder --config build/build-config.json --win --x64\"", "build:arc-offline": "cross-env-shell PLATFORM=\"arc\" VITE_PLATFORM_TITLE=\"for Intel® Arc™\" \"vue-tsc && vite build && electron-builder --config build/build-config-offline.json --win --x64\"", "build:ultra": "cross-env-shell PLATFORM=\"ultra\" VITE_PLATFORM_TITLE=\"for Intel® Core™ Ultra\" \"vue-tsc && vite build && electron-builder --config build/build-config.json --win --x64\"", @@ -46,6 +42,8 @@ "tailwind-merge": "^2.5.4", "tailwindcss-animate": "^1.0.7", "unplugin-auto-import": "^0.18.3", + "v-popover": "^0.1.13", + "v-tooltip": "^2.1.3", "vue": "^3.5.12", "zod": "^3.23.8" }, diff --git a/WebUI/src/assets/i18n/en-US.json b/WebUI/src/assets/i18n/en-US.json index 892d8ab3..4c11bc29 100644 --- a/WebUI/src/assets/i18n/en-US.json +++ b/WebUI/src/assets/i18n/en-US.json @@ -125,7 +125,12 @@ "DECREASE_FONT_SIZE": "Shrink Text", "ANSWER_RAG_ENABLE":"Enable File Query", "ANSWER_RAG_OPEN_DIALOG":"Open File Uploader", - "REQUEST_LLM_MODEL_NAME":"Add a model of your choice from huggingface.co,
for example: meta-llama/Llama-3.2-1B ", + "REQUEST_LLM_MODEL_NAME":"Add a model of your choice from huggingface.co", + "REQUEST_LLM_MODEL_DESCRIPTION": "You can download a model repository with the syntax", + "REQUEST_LLM_MODEL_EXAMPLE": "<namespace>/<repo_name>, e.g. 'openai-community/gpt2'", + "REQUEST_LLM_SINGLE_EXAMPLE": "<namespace>/<file_path>, e.g. 'microsoft/Phi-3-mini-4k-instruct-gguf/Phi-3-mini-4k-instruct-q4.gguf'", + "REQUEST_LLM_MODEL_DESCRIPTION_tmp":"You can either download a model repository by providing <namespace>/<repo_name>, e.g. 'openai-community/gpt2' or a single model file, by typing <namespace>/<file_path>, e.g. 'microsoft/Phi-3-mini-4k-instruct-gguf/Phi-3-mini-4k-instruct-q4.gguf'", + "REQUEST_LLM_MODEL_DISCLAIMER":"NOTE: Not every model on huggingface.co is suited for the task you want it to perform.
Carefully read the model introduction and requirements before downloading.", "DOWNLOADER_CONFRIM_TIP":"You are missing one or more models needed to run. Would you like to download the model(s) listed below?", "DOWNLOADER_MODEL":"Model", "DOWNLOADER_INFO":"Info", diff --git a/WebUI/src/components/AddLLMDialog.vue b/WebUI/src/components/AddLLMDialog.vue index a80d68d2..dbbe0be3 100644 --- a/WebUI/src/components/AddLLMDialog.vue +++ b/WebUI/src/components/AddLLMDialog.vue @@ -4,8 +4,21 @@
-

- + +
+

+
+
+ + +
+ +

+
    +
  • + +
+

{{ addModelErrorMessage }}

@@ -15,6 +28,7 @@
+ \ No newline at end of file + + + \ No newline at end of file diff --git a/service/model_downloader.py b/service/model_downloader.py index 2efab81e..33cc306d 100644 --- a/service/model_downloader.py +++ b/service/model_downloader.py @@ -285,7 +285,6 @@ def move_to_desired_position(self): path.abspath(desired_repo_root_dir_name) ) - def start_report_download_progress(self): thread = Thread(target=self.report_download_progress) thread.start()