From 889419210daa13c2119015535476993354931511 Mon Sep 17 00:00:00 2001 From: agatha197 Date: Mon, 20 Jan 2025 11:46:05 +0900 Subject: [PATCH] feat(FR-404): show or hide model folder related info --- config.toml.sample | 1 + react/src/components/FolderCreateModal.tsx | 4 +++- react/src/hooks/index.tsx | 1 + react/src/pages/VFolderListPage.tsx | 2 +- src/components/backend-ai-login.ts | 10 ++++++++++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/config.toml.sample b/config.toml.sample index e8183e0ce5..348e8387e7 100644 --- a/config.toml.sample +++ b/config.toml.sample @@ -34,6 +34,7 @@ enableModelStore = false # Enable model store feature. (From Back enableLLMPlayground = false # Enable LLM Playground feature. (From Backend.AI 24.03) enableExtendLoginSession = false # If true, enables login session extension UI. (From Backend.AI 24.09) enableImportFromHuggingFace = false # Enable import from Hugging Face feature. (From Backend.AI 24.09) +enableModelFolders = true # Enable model folders feature. (From Backend.AI 23.03) [wsproxy] proxyURL = "[Proxy URL]" diff --git a/react/src/components/FolderCreateModal.tsx b/react/src/components/FolderCreateModal.tsx index 99d7f8fcd1..34d7d21ede 100644 --- a/react/src/components/FolderCreateModal.tsx +++ b/react/src/components/FolderCreateModal.tsx @@ -227,7 +227,9 @@ const FolderCreateModal: React.FC = ({ General - Model + {baiClient._config.enableModelFolders ? ( + Model + ) : null} diff --git a/react/src/hooks/index.tsx b/react/src/hooks/index.tsx index 39aae8aade..7d1c9ab712 100644 --- a/react/src/hooks/index.tsx +++ b/react/src/hooks/index.tsx @@ -432,6 +432,7 @@ type BackendAIConfig = { enableLLMPlayground: boolean; enableImportFromHuggingFace: boolean; enableContainerCommit: boolean; + enableModelFolders: boolean; appDownloadUrl: string; systemSSHImage: string; fasttrackEndpoint: string; diff --git a/react/src/pages/VFolderListPage.tsx b/react/src/pages/VFolderListPage.tsx index eafc1ecb3c..b68c145a64 100644 --- a/react/src/pages/VFolderListPage.tsx +++ b/react/src/pages/VFolderListPage.tsx @@ -99,7 +99,7 @@ const VFolderListPage: React.FC = (props) => { key: 'automount', tab: t('data.AutomountFolders'), }, - { + baiClient._config.enableModelFolders && { key: 'model', tab: t('data.Models'), }, diff --git a/src/components/backend-ai-login.ts b/src/components/backend-ai-login.ts index 5b73bb34ff..dfa7915699 100644 --- a/src/components/backend-ai-login.ts +++ b/src/components/backend-ai-login.ts @@ -144,6 +144,7 @@ export default class BackendAILogin extends BackendAIPage { @property({ type: Boolean }) enableLLMPlayground = false; @property({ type: Boolean }) enableImportFromHuggingFace = false; @property({ type: Boolean }) enableExtendLoginSession = false; + @property({ type: Boolean }) enableModelFolders = true; @property({ type: Boolean }) showNonInstalledImages = false; @property({ type: String }) eduAppNamePrefix; @property({ type: String }) pluginPages; @@ -880,6 +881,13 @@ export default class BackendAILogin extends BackendAIPage { value: generalConfig?.enableExtendLoginSession, } as ConfigValueObject, ) as boolean; + + // Enable model folders support + this.enableModelFolders = this._getConfigValueByExists(generalConfig, { + valueType: 'boolean', + defaultValue: true, + value: generalConfig?.enableModelFolders, + } as ConfigValueObject) as boolean; } /** @@ -1916,6 +1924,8 @@ export default class BackendAILogin extends BackendAIPage { this.enableImportFromHuggingFace; globalThis.backendaiclient._config.enableExtendLoginSession = this.enableExtendLoginSession; + globalThis.backendaiclient._config.enableModelFolders = + this.enableModelFolders; globalThis.backendaiclient._config.pluginPages = this.pluginPages; globalThis.backendaiclient._config.blockList = this.blockList; globalThis.backendaiclient._config.inactiveList = this.inactiveList;