Skip to content

Commit

Permalink
feat(FR-404): show or hide model folder related info
Browse files Browse the repository at this point in the history
  • Loading branch information
agatha197 committed Jan 20, 2025
1 parent 5e36c40 commit 8894192
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 2 deletions.
1 change: 1 addition & 0 deletions config.toml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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]"
Expand Down
4 changes: 3 additions & 1 deletion react/src/components/FolderCreateModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ const FolderCreateModal: React.FC<FolderCreateModalProps> = ({
<Form.Item label={t('data.UsageMode')} name={'usage_mode'}>
<Radio.Group>
<Radio value={'general'}>General</Radio>
<Radio value={'model'}>Model</Radio>
{baiClient._config.enableModelFolders ? (
<Radio value={'model'}>Model</Radio>
) : null}
</Radio.Group>
</Form.Item>
<Divider />
Expand Down
1 change: 1 addition & 0 deletions react/src/hooks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@ type BackendAIConfig = {
enableLLMPlayground: boolean;
enableImportFromHuggingFace: boolean;
enableContainerCommit: boolean;
enableModelFolders: boolean;
appDownloadUrl: string;
systemSSHImage: string;
fasttrackEndpoint: string;
Expand Down
2 changes: 1 addition & 1 deletion react/src/pages/VFolderListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const VFolderListPage: React.FC<VFolderListPageProps> = (props) => {
key: 'automount',
tab: t('data.AutomountFolders'),
},
{
baiClient._config.enableModelFolders && {
key: 'model',
tab: t('data.Models'),
},
Expand Down
10 changes: 10 additions & 0 deletions src/components/backend-ai-login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 8894192

Please sign in to comment.