From b908ae29331654cae31d4494f11b487f346a7035 Mon Sep 17 00:00:00 2001 From: Hoang Ha <64120343+hahuyhoang411@users.noreply.github.com> Date: Mon, 15 Apr 2024 12:57:52 +0700 Subject: [PATCH] Chore: Change CommandR to unavailable (#2722) * fix: move to comming soon * fix: Q4 for consistancy * version pump extension * pump version model * fix: highlight unsupported tag --------- Co-authored-by: Louis --- .../inference-nitro-extension/package.json | 2 +- .../resources/models/command-r-34b/model.json | 4 +-- .../models/wizardcoder-13b/model.json | 10 +++--- web/containers/DropdownListSidebar/index.tsx | 2 +- web/containers/Layout/TopBar/index.tsx | 8 ++++- web/containers/ModelLabel/index.tsx | 19 +++++++++-- .../ExploreModelItemHeader/index.tsx | 32 ++++++------------- 7 files changed, 42 insertions(+), 35 deletions(-) diff --git a/extensions/inference-nitro-extension/package.json b/extensions/inference-nitro-extension/package.json index 5da92c150..1916da4b6 100644 --- a/extensions/inference-nitro-extension/package.json +++ b/extensions/inference-nitro-extension/package.json @@ -1,7 +1,7 @@ { "name": "@janhq/inference-nitro-extension", "productName": "Nitro Inference Engine", - "version": "1.0.0", + "version": "1.0.1", "description": "This extension embeds Nitro, a lightweight (3mb) inference engine written in C++. See https://nitro.jan.ai.\nAdditional dependencies could be installed to run without Cuda Toolkit installation.", "main": "dist/index.js", "node": "dist/node/index.cjs.js", diff --git a/extensions/inference-nitro-extension/resources/models/command-r-34b/model.json b/extensions/inference-nitro-extension/resources/models/command-r-34b/model.json index acb66779c..850429376 100644 --- a/extensions/inference-nitro-extension/resources/models/command-r-34b/model.json +++ b/extensions/inference-nitro-extension/resources/models/command-r-34b/model.json @@ -8,7 +8,7 @@ "id": "command-r-34b", "object": "model", "name": "Command-R v01 34B Q4", - "version": "1.0", + "version": "1.1", "description": "C4AI Command-R developed by CohereAI is optimized for a variety of use cases including reasoning, summarization, and question answering.", "format": "gguf", "settings": { @@ -27,7 +27,7 @@ }, "metadata": { "author": "CohereAI", - "tags": ["34B", "Finetuned"], + "tags": ["34B", "Finetuned", "Coming Soon", "Unavailable"], "size": 21500000000 }, "engine": "nitro" diff --git a/extensions/inference-nitro-extension/resources/models/wizardcoder-13b/model.json b/extensions/inference-nitro-extension/resources/models/wizardcoder-13b/model.json index 051c739a0..cae96c26b 100644 --- a/extensions/inference-nitro-extension/resources/models/wizardcoder-13b/model.json +++ b/extensions/inference-nitro-extension/resources/models/wizardcoder-13b/model.json @@ -1,20 +1,20 @@ { "sources": [ { - "filename": "wizardcoder-python-13b-v1.0.Q5_K_M.gguf", - "url": "https://huggingface.co/TheBloke/WizardCoder-Python-13B-V1.0-GGUF/resolve/main/wizardcoder-python-13b-v1.0.Q5_K_M.gguf" + "filename": "wizardcoder-python-13b-v1.0.Q4_K_M.gguf", + "url": "https://huggingface.co/TheBloke/WizardCoder-Python-13B-V1.0-GGUF/resolve/main/wizardcoder-python-13b-v1.0.Q4_K_M.gguf" } ], "id": "wizardcoder-13b", "object": "model", - "name": "Wizard Coder Python 13B Q5", - "version": "1.0", + "name": "Wizard Coder Python 13B Q4", + "version": "1.1", "description": "WizardCoder 13B is a Python coding model. This model demonstrate high proficiency in specific domains like coding and mathematics.", "format": "gguf", "settings": { "ctx_len": 4096, "prompt_template": "### Instruction:\n{prompt}\n### Response:", - "llama_model_path": "wizardcoder-python-13b-v1.0.Q5_K_M.gguf" + "llama_model_path": "wizardcoder-python-13b-v1.0.Q4_K_M.gguf" }, "parameters": { "temperature": 0.7, diff --git a/web/containers/DropdownListSidebar/index.tsx b/web/containers/DropdownListSidebar/index.tsx index bf4d873cc..75c139af3 100644 --- a/web/containers/DropdownListSidebar/index.tsx +++ b/web/containers/DropdownListSidebar/index.tsx @@ -276,7 +276,7 @@ const DropdownListSidebar = ({ {toGibibytes(x.metadata.size)} {x.metadata.size && ( - + )} diff --git a/web/containers/Layout/TopBar/index.tsx b/web/containers/Layout/TopBar/index.tsx index 7f108f15a..cbb151751 100644 --- a/web/containers/Layout/TopBar/index.tsx +++ b/web/containers/Layout/TopBar/index.tsx @@ -16,6 +16,8 @@ import CommandSearch from '@/containers/Layout/TopBar/CommandSearch' import { showLeftSideBarAtom } from '@/containers/Providers/KeyListener' +import { toaster } from '@/containers/Toast' + import { MainViewState } from '@/constants/screens' import { useClickOutside } from '@/hooks/useClickOutside' @@ -61,7 +63,11 @@ const TopBar = () => { const onCreateConversationClick = async () => { if (assistants.length === 0) { - alert('No assistant available') + toaster({ + title: 'No assistant available.', + description: `Could not create a new thread. Please add an assistant.`, + type: 'error', + }) } else { requestCreateNewThread(assistants[0]) } diff --git a/web/containers/ModelLabel/index.tsx b/web/containers/ModelLabel/index.tsx index 54f2838af..5f32499ae 100644 --- a/web/containers/ModelLabel/index.tsx +++ b/web/containers/ModelLabel/index.tsx @@ -1,5 +1,7 @@ import React from 'react' +import { ModelMetadata } from '@janhq/core' +import { Badge } from '@janhq/uikit' import { useAtomValue } from 'jotai' import { useActiveModel } from '@/hooks/useActiveModel' @@ -19,10 +21,17 @@ import { } from '@/helpers/atoms/SystemBar.atom' type Props = { - size: number + metadata: ModelMetadata +} +const UnsupportedModel = () => { + return ( + + Coming Soon + + ) } -const ModelLabel: React.FC = ({ size }) => { +const ModelLabel: React.FC = ({ metadata }) => { const { activeModel } = useActiveModel() const totalRam = useAtomValue(totalRamAtom) const usedRam = useAtomValue(usedRamAtom) @@ -52,7 +61,11 @@ const ModelLabel: React.FC = ({ size }) => { return null } - return getLabel(size) + return metadata.tags.includes('Coming Soon') ? ( + + ) : ( + getLabel(metadata.size ?? 0) + ) } export default React.memo(ModelLabel) diff --git a/web/screens/ExploreModels/ExploreModelItemHeader/index.tsx b/web/screens/ExploreModels/ExploreModelItemHeader/index.tsx index 86af5e3dd..1a794c83f 100644 --- a/web/screens/ExploreModels/ExploreModelItemHeader/index.tsx +++ b/web/screens/ExploreModels/ExploreModelItemHeader/index.tsx @@ -19,6 +19,10 @@ import { twMerge } from 'tailwind-merge' import ModalCancelDownload from '@/containers/ModalCancelDownload' +import ModelLabel from '@/containers/ModelLabel' + +import { toaster } from '@/containers/Toast' + import { MainViewState } from '@/constants/screens' import { useCreateNewThread } from '@/hooks/useCreateNewThread' @@ -47,22 +51,6 @@ type Props = { open: string } -const getLabel = (size: number, ram: number, unit: string = 'RAM') => { - if (size * 1.25 >= ram) { - return ( - - Not enough {unit} - - ) - } else { - return ( - - Recommended - - ) - } -} - const ExploreModelItemHeader: React.FC = ({ model, onClick, open }) => { const { downloadModel } = useDownloadModel() const downloadingModels = useAtomValue(getDownloadingModelAtom) @@ -105,7 +93,11 @@ const ExploreModelItemHeader: React.FC = ({ model, onClick, open }) => { const onUseModelClick = useCallback(async () => { if (assistants.length === 0) { - alert('No assistant available') + toaster({ + title: 'No assistant available.', + description: `Could not use Model ${model.name} as no assistant is available.`, + type: 'error', + }) return } await requestCreateNewThread(assistants[0], model) @@ -163,11 +155,7 @@ const ExploreModelItemHeader: React.FC = ({ model, onClick, open }) => { {toGibibytes(model.metadata.size)} - {getLabel( - model.metadata.size, - ram, - settings?.run_mode === 'gpu' ? 'VRAM' : 'RAM' - )} + {} {downloadButton}